This repository contains code that was used to generate the analysis of our first statewide survey with YouGov. This README provides instructions on replicating.
This analysis was carried out in SPSS. If you're at Brown, you can get a copy of SPSS by visiting software.brown.edu. After you've procured that software, you should just be able to run the scripts in this folder.
The data are provided in SPSS .sav
formats. They can be found in the /data
folder. In particular,
- Data from the Rhode Island sample can be found in
/data/TPL_Testing_Survey_FirstWave_RI.sav
. - Data from the national sample can be found in
/data/TPL_Testing_Survey_FirstWave_US.sav
.
To reproduce the analyses, perform the following steps:
- Launch SPSS
- Select
Open
>Data
and choose eitherTPL_Testing_Survey_FirstWave_RI.sav
orTPL_Testing_Survey_FirstWave_US.sav
data file - Select
Open
>Syntax
and choose the desired segment of the analysis. Note that they are named in order that they appear in the ultimate report. - Select all commands and click
Run
Note that qualitative results can be found in the /data/qualitative
folder.
If you'd like to look at the data and aren't an SPSS user, you can open it with the pyreadstat
package. To do so, we suggest the following syntax:
import pyreadstat
df, metadata = pyreadstat.read_sav('data/TPL_Testing_Survey_FirstWave_RI.sav')
The resulting df
is a pandas dataframe. The metadata
can be inspected to find the details of the questions asked.
We are using renv
to manage package dependencies. So you will need this installed in your system first.
When you first start R in the root directory of this project you should do renv::init()
and then renv::restore()
to ensure that you have the packages needed for analysis.
Then, again, from the root of the project directory, you should be able to build a pdf document like so (if you have latex installed on your system):
library(rmarkdown)
render('analysis/outcome_analysis.Rmd`)
MIT