Skip to content

Instantly share code, notes, and snippets.

@jamesdunham
Last active February 16, 2017 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesdunham/0cdf8ec0584794d8d72191b78147d460 to your computer and use it in GitHub Desktop.
Save jamesdunham/0cdf8ec0584794d8d72191b78147d460 to your computer and use it in GitHub Desktop.
library(rstan)
stan_model <- readLines("https://raw.githubusercontent.com/jamesdunham/dgo/master/exec/2017_01_04.stan")
stan_data <- structure(list(NNl2=structure(c(0L,0L,0L,0L),.Dim=c(2L,2L,1L)),SSl2=structure(c(0L,0L,0L,0L),.Dim=c(2L,2L,1L)),XX=structure(c(0,1,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,1),.Dim=c(6L,3L),.Dimnames=list(c("SC__black","VA__black","SC__other","VA__other","SC__white","VA__white"),c("VA","race3other","race3white"))),ZZ=structure(c(0,0,0,0,0,0),.Dim=c(2L,3L,1L),.Dimnames=list(c("2009","2010"),c("VA","race3other","race3white"),"")),ZZ_prior=structure(c(0,0,0,0,0,0),.Dim=c(2L,3L,1L),.Dimnames=list(c("2009","2010"),c("VA","race3other","race3white"),"")),G=6L,Q=2L,T=2L,N=24L,P=3L,S=1,H=1L,D=1L,Hprior=1L,WT=structure(c(1,1,1,1,1,1,1,1,1,1,1,1),.Dim=c(2L,1L,6L)),l2_only=structure(c(0L,0L,0L,0L),.Dim=c(2L,2L)),G_hier=1L,constant_item=TRUE,n_vec=structure(c(20,36,11,13,102,190,0,0,0,0,0,0,31,40,5,15,95,150,31,40,5,15,94,150),.Names=c("2009__SC__black__affirmative_action_gt1","2009__VA__black__affirmative_action_gt1","2009__SC__other__affirmative_action_gt1","2009__VA__other__affirmative_action_gt1","2009__SC__white__affirmative_action_gt1","2009__VA__white__affirmative_action_gt1","2009__SC__black__gaymarriage_amendment_gt1","2009__VA__black__gaymarriage_amendment_gt1","2009__SC__other__gaymarriage_amendment_gt1","2009__VA__other__gaymarriage_amendment_gt1","2009__SC__white__gaymarriage_amendment_gt1","2009__VA__white__gaymarriage_amendment_gt1","2010__SC__black__affirmative_action_gt1","2010__VA__black__affirmative_action_gt1","2010__SC__other__affirmative_action_gt1","2010__VA__other__affirmative_action_gt1","2010__SC__white__affirmative_action_gt1","2010__VA__white__affirmative_action_gt1","2010__SC__black__gaymarriage_amendment_gt1","2010__VA__black__gaymarriage_amendment_gt1","2010__SC__other__gaymarriage_amendment_gt1","2010__VA__other__gaymarriage_amendment_gt1","2010__SC__white__gaymarriage_amendment_gt1","2010__VA__white__gaymarriage_amendment_gt1")),s_vec=structure(c(19,29,2,4,20,62,0,0,0,0,0,0,24,34,3,8,17,44,17,24,3,10,50,94),.Names=c("2009__SC__black__affirmative_action_gt1","2009__VA__black__affirmative_action_gt1","2009__SC__other__affirmative_action_gt1","2009__VA__other__affirmative_action_gt1","2009__SC__white__affirmative_action_gt1","2009__VA__white__affirmative_action_gt1","2009__SC__black__gaymarriage_amendment_gt1","2009__VA__black__gaymarriage_amendment_gt1","2009__SC__other__gaymarriage_amendment_gt1","2009__VA__other__gaymarriage_amendment_gt1","2009__SC__white__gaymarriage_amendment_gt1","2009__VA__white__gaymarriage_amendment_gt1","2010__SC__black__affirmative_action_gt1","2010__VA__black__affirmative_action_gt1","2010__SC__other__affirmative_action_gt1","2010__VA__other__affirmative_action_gt1","2010__SC__white__affirmative_action_gt1","2010__VA__white__affirmative_action_gt1","2010__SC__black__gaymarriage_amendment_gt1","2010__VA__black__gaymarriage_amendment_gt1","2010__SC__other__gaymarriage_amendment_gt1","2010__VA__other__gaymarriage_amendment_gt1","2010__SC__white__gaymarriage_amendment_gt1","2010__VA__white__gaymarriage_amendment_gt1")),observed=c(1L,2L,3L,4L,5L,6L,13L,14L,15L,16L,17L,18L,19L,20L,21L,22L,23L,24L),N_observed=18L,separate_t=FALSE,hierarchical_model=TRUE,delta_tbar_prior_mean=0.65,delta_tbar_prior_sd=0.25,innov_sd_delta_scale=2.5,innov_sd_theta_scale=2.5),.Names=c("NNl2","SSl2","XX","ZZ","ZZ_prior","G","Q","T","N","P","S","H","D","Hprior","WT","l2_only","G_hier","constant_item","n_vec","s_vec","observed","N_observed","separate_t","hierarchical_model","delta_tbar_prior_mean","delta_tbar_prior_sd","innov_sd_delta_scale","innov_sd_theta_scale"))
rstan::stan(model_code = stan_model, data = stan_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment