example_model: Example model

Description Format See Also Examples

Description

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

 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
 ## 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)

rstap documentation built on May 1, 2019, 9:21 p.m.