View source: R/convenience-functions.R
prep_me_data | R Documentation |
Prepares the list of data required for geostan's (spatial) measurement error models. Given a data frame of standard errors and any optional arguments, the function returns a list with all required data for the models, filling in missing elements with default values.
prep_me_data(
se,
car_parts,
prior,
logit = rep(FALSE, times = ncol(se)),
bounds = c(-Inf, Inf)
)
se |
Data frame of standard errors; column names must match (exactly) the variable names used in the model formula. |
car_parts |
A list of data required for spatial CAR models, as created by |
prior |
A named list of prior distributions (see
|
logit |
Optional vector of logical values ( |
bounds |
Rarely needed; an optional numeric vector of length two providing the upper and lower bounds, respectively, of the variables (e.g., a magnitudes must be greater than 0). If not provided, they will be set to c(-Inf, Inf) (i.e., unbounded). |
A list of data as required for (spatial) ME models. Missing arguments will be filled in with default values, including prior distributions.
se_log
data(georgia)
## for a non-spatial prior model for two covariates
se <- data.frame(ICE = georgia$ICE.se,
college = georgia$college.se)
ME <- prep_me_data(se)
## see default priors
print(ME$prior)
## set prior for the scale parameters
ME <- prep_me_data(se,
prior = list(scale = student_t(df = c(10, 10),
location = c(0, 0),
scale = c(20, 20))))
## for a spatial prior model (often recommended)
A <- shape2mat(georgia, "B")
cars <- prep_car_data(A)
ME <- prep_me_data(se,
car_parts = cars)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.