-
Notifications
You must be signed in to change notification settings - Fork 1
/
mwe_slurm.R
28 lines (21 loc) · 962 Bytes
/
mwe_slurm.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
library(tidyverse)
library(ccesMRPprep)
# example question metadata
questions_samp[20, ]
## do this once:
# ccc <- get_cces_dataverse("cumulative")
# write_rds(ccc, "data/input/cces/cces_cumulative.rds")
# predictors
ccc <- ccc_std_demographics(read_rds("data/input/cces/cces_cumulative.rds"))
# outcome (after downloading the full datasets to local, looping get_cces_dataverse()).
cc_outcome <- get_cces_question(qcode = "CC18_322c",
qID = "CC18_332C",
year = "2018")
# final dataframe (before deriving outcome data)
cces_df <- inner_join(ccc, cc_outcome, by = c("year", "case_id"))
# ACS (after getting ACS key, see help page)
acs_df <- get_acs_cces(year = 2018,
varlist = acscodes_age_sex_educ,
varlab_df = acscodes_df)
ps_df <- get_poststrat(acs_df,
model_ff = "yes|trials(n_response) ~ age + gender + educ + (1|cd)")