Git Product home page Git Product logo

firearms-and-mhp-public's Introduction

Firearms and Mental Health Providers

Analysis of the relationship between deaths from firearms, rates of gun ownership, and the ratio of mental health providers to the local population. This repository contains R scripts for the statistical analyses and the generation of pertinent tables and figures. Code is public, for manuscript review purposes, as of 18 May 2024.

Locations

.../R - Scripts

.../data - raw and cleaned data

.../results - tables, charts, figures, imputed data, etc

Code

Script 1 - import and clean data

  • Bins states into quartiles by gun ownership rate
  • Generate contents of eTable 1
  • Saves data as df.Rds

Script 2 - describe data

  • Examine missingness
  • Generate Table 1 and eTable 2
  • Compare censored vs. uncensored subsets

Script 3 - imputation and modeling

  • Pearson's correlations
  • Figures 1 and 2
  • Perform crude (unadjusted) and intermediate (limited adjustments) models
  • Impute values for missing segregation data
  • Apply a mixed effects model to the imputed data sets, and pool the coefficients into a final, complete-adjusted model.
  • Generate Table 2 (concise and long form versions)

Script 4 - sensitivity analyses

  • Compare random forest to primary mean matching, for imputation of segregation missing values
  • Generate, visualize, and apply multiple sensitivity models for missing firearms numbers in censored counties

Tips

To quickly view the model results:

load("results/imputation.RData")
summary(mc4)
summary(mi.continuous)
summary(mi.qrt)
summary(pool_pmm) # full model, vs continuous values for firearm fatalities
summary(pool_pmm_qrt) # vs quartiled bins of firearm fatalities

To generate sensitivity model coefficients only, run the following parts of script 4

  • Part 1
  • Part 5, lines to create sensitivity.list
  • Part 6 (helper functions)
  • Part 7 (batch run of models)

Authors

  • Kelly Corbett
  • Malcolm Schongalla
  • Erika Moen

firearms-and-mhp-public's People

Contributors

schongallam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.