A model for use in rstap examples.

Format

Calling example("example_model") will run the model in the Examples section, below, and the resulting stapreg object will then be available in the global environment. The chains and iter arguments are specified to make this example small in size. In practice, we recommend that they be left unspecified in order to use the default values (4 and 2000 respectively) or increased if there are convergence problems. The cores argument is optional and on a multicore system, the user may well want to set that equal to the number of chains being executed.

See also

The Longituinal Vignette for stap_glmer.

Examples

## following lines make example run faster distdata <- subset(homog_longitudinal_bef_data[,c("subj_ID","measure_ID","class","dist")], subj_ID<=10) timedata <- subset(homog_longitudinal_bef_data[,c("subj_ID","measure_ID","class","time")], subj_ID<=10) timedata$time <- as.numeric(timedata$time) subjdata <- subset(homog_longitudinal_subject_data,subj_ID<=10) example_model <- stap_glmer(y_bern ~ centered_income + sex + centered_age + stap(Coffee_Shop) + (1|subj_ID), family = gaussian(), subject_data = subjdata, distance_data = distdata, time_data = timedata, subject_ID = 'subj_ID', group_ID = 'measure_ID', prior_intercept = normal(location = 25, scale = 4, autoscale = FALSE), prior = normal(location = 0, scale = 4, autoscale = FALSE), prior_stap = normal(location = 0, scale = 4), prior_theta = list(Coffee_Shop = list(spatial = log_normal(location = 1, scale = 1), temporal = log_normal(location = 1, scale = 1))), max_distance = 3, max_time = 50, # chains, cores, and iter set to make the example small and fast chains = 1, iter = 25, cores = 1)
#> #> SAMPLING FOR MODEL 'stap_continuous' NOW (CHAIN 1). #> Chain 1: #> Chain 1: Gradient evaluation took 0.000173 seconds #> Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 1.73 seconds. #> Chain 1: Adjust your expectations accordingly! #> Chain 1: #> Chain 1: #> Chain 1: WARNING: No variance estimation is #> Chain 1: performed for num_warmup < 20 #> Chain 1: #> Chain 1: Iteration: 1 / 25 [ 4%] (Warmup) #> Chain 1: Iteration: 2 / 25 [ 8%] (Warmup) #> Chain 1: Iteration: 4 / 25 [ 16%] (Warmup) #> Chain 1: Iteration: 6 / 25 [ 24%] (Warmup) #> Chain 1: Iteration: 8 / 25 [ 32%] (Warmup) #> Chain 1: Iteration: 10 / 25 [ 40%] (Warmup) #> Chain 1: Iteration: 12 / 25 [ 48%] (Warmup) #> Chain 1: Iteration: 13 / 25 [ 52%] (Sampling) #> Chain 1: Iteration: 14 / 25 [ 56%] (Sampling) #> Chain 1: Iteration: 16 / 25 [ 64%] (Sampling) #> Chain 1: Iteration: 18 / 25 [ 72%] (Sampling) #> Chain 1: Iteration: 20 / 25 [ 80%] (Sampling) #> Chain 1: Iteration: 22 / 25 [ 88%] (Sampling) #> Chain 1: Iteration: 24 / 25 [ 96%] (Sampling) #> Chain 1: Iteration: 25 / 25 [100%] (Sampling) #> Chain 1: #> Chain 1: Elapsed Time: 0.010851 seconds (Warm-up) #> Chain 1: 0.938751 seconds (Sampling) #> Chain 1: 0.949602 seconds (Total) #> Chain 1:
#> Warning: There were 1 chains where the estimated Bayesian Fraction of Missing Information was low. See #> http://mc-stan.org/misc/warnings.html#bfmi-low
#> Warning: Examine the pairs() plot to diagnose sampling problems
#> Warning: The largest R-hat is 2.06, indicating chains have not mixed. #> Running the chains for more iterations may help. See #> http://mc-stan.org/misc/warnings.html#r-hat
#> Warning: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable. #> Running the chains for more iterations may help. See #> http://mc-stan.org/misc/warnings.html#bulk-ess
#> Warning: Tail Effective Samples Size (ESS) is too low, indicating posterior variances and tail quantiles may be unreliable. #> Running the chains for more iterations may help. See #> http://mc-stan.org/misc/warnings.html#tail-ess
#> Warning: Markov chains did not converge! Do not analyze results!