Skip to content

Replication and supplemental files for shared satisfaction paper

Notifications You must be signed in to change notification settings

mikebader/project-shared-satisfaction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Replication Repository for Shared Satisfaction among Residents Living in Multiracial Neighborhoods

Description

The repository contains data and files necessary to replicate the analyses in

Bader, Michael D. M. 2022. “Shared Satisfaction among Residents Living in Multiracial Neighborhoods.” Social Problems. doi: 10.1093/socpro/spac038.

Documentation

You may view the steps used to construct and analyze the data (without replicating yourself) at https://mikebader.github.io/project-shared-satisfaction.

Replication Instructions

Clone repository

If you would like to replicate the analysis yourself, you must have Git Large File Storage installed on your machine and enabled in git:

git lfs install

Once you have done that, you can clone the repository:

git clone --recurse-submodules https://github.com/mikebader/project-shared-satisfaction.git

Obtain external data

After cloning the repository, you need to download the Longitudinal Tract Database by John Logan and colleagues. You can download the data here. Request the full count data for the year 2000.

You will be prompted to download a .zip file. Extract the files from that .zip file and copy or move the file ltdb_std_2000_fullcount.csv into the data subdirectory.

Replicate analyses locally

You should be able to replicate the analysis by opening the file analysis/analysis.Rproj in RStudio and building the project. After you open the file, run the following in the console to load local versions of the libraries used:

renv::restore()

After you do this, you will need to restart R by either pressing Cmd/Ctrl-Shift-0 or navigating to Session -> Restart. You may then build the project (and replicate all of the analyses) one of two ways:

  • Using the graphical user interface (GUI). If you open the analysis/analysis.Rproj file in Rstudio, a tab labeled "Build" should appear in the Environment/History window in RStudio. Click on that tab and then click the "Build Book" button.

  • Using the command-line in the console. Type the following command into the console:

      rmarkdown::render_site(encoding = "UTF-8")
    

Both methods will replicate the analyses. Note, however, that lines 503-506 of the file analysis/data-construction.Rmd are commented out by default. This permits the replication using the exact version of dcassvy.Rdata used in the paper. If you un-comment those line, dcassvy.Rdata will be overwritten using randomized multiple imputation datasets that do not match the analysis, and doing so will result in slight variations from the reported results.

The results will be saved in a series of HTML files the docs directory.

View Documented Code

The documentation contained in the docs directory may also be viewed at https://mikebader.github.io/project-shared-satisfaction/ without replicating the code yourself. The code contained in each .Rmd file in the analysis directory corresponds to sections of the documentation:

Note that lines 503-506 of the file analysis/data-construction.Rmd are commented out by default. This permits the replication using the exact version of dcassvy.Rdata used in the paper. If you un-comment those line, dcassvy.Rdata will be overwritten using randomized multiple imputation datasets that do not match the analysis, and doing so will result in slight variations from the reported results.

Manuscript Typesetting

The manuscript is written in Markdown and designed to be typeset into a PDF using pandoc. To typeset with pandoc, you will first need to install the pandoc-xnos filter suite (instructions at link). Then navigate to the drafts directory of the repository and use the following command:

pandoc multiethnic-nhoods.md -o multiethnic-nhoods.pdf --filter pandoc-xnos --citeproc

About

Replication and supplemental files for shared satisfaction paper

Topics

Resources

Stars

Watchers

Forks