stan_data <- list( n_obs = nrow(data), census_length = data$census_interval, obs_dbh1 = data$dbh_prev, obs_dbh2 = data$dbh) true_dbh_model <-' data { int<lower=1> n_obs; vector[n_obs] census_length; vector[n_obs] obs_dbh1; vector[n_obs] obs_dbh2; } parameters { real<lower=0> true_dbh1[n_obs]; real log_mu_true_dbh1; real<lower=0> log_sigma_true_dbh1; real<lower=0> dbh_increment[n_obs]; } model { real true_dbh2[n_obs]; for (i in 1:n_obs) { // Calculating true growth for fitted data true_dbh2[i] <- true_dbh1[i] + (dbh_increment[i] * census_length[i]); } // Observation error obs_dbh1 ~ normal(true_dbh1, 0.75); obs_dbh2 ~ normal(true_dbh2, 0.75); // Priors log_mu_true_dbh1 ~ normal(0,2.5); log_sigma_true_dbh1 ~ cauchy(0,2.5); true_dbh1 ~ lognormal(log_mu_true_dbh1, log_sigma_true_dbh1); dbh_increment ~ lognormal(0,1); } generated quantities { real true_dbh2[n_obs]; for (i in 1:n_obs) { // recalculating true growth for fitted data true_dbh2[i] <- true_dbh1[i] + (dbh_increment[i] * census_length[i]); } }' fit <- sflist2stanfit(mclapply(1:3, mc.cores=3, function(i) { stan(model_code = true_dbh_model, data= stan_data, pars = c("log_mu_true_dbh1","log_sigma_true_dbh1", "true_dbh1","true_dbh2"), chains = 1, chain_id = i, iter = 1000, control=list(stepsize=0.05, adapt_delta=0.9), refresh=1, thin=5) }))Error in sflist2stanfit(mclapply(1:3, mc.cores = 3, function(i) { :
'sflist' must be a list of 'stanfit' objects
I'm working with a relatively simple model being applied to a large amount of data (180,000 observations). I need to extract the summary estimates of both true_dbh1 and true_dbh2 (i.e. 180,000 x 2 estimates).
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/t2B2W_AjlDc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
I didn't know get_posterior_means() would also give you the estimates of unmonitored parameters!I'll give it a try! Though is there a way to calculate the Rhats/effective sample sizes associated with these posteriors? Just to make sure they have adequately converged?