lm_imp
, glm_imp
and lme_imp
estimate linear, generalized
linear and linear mixed models, respectively, using MCMC sampling.
lm_imp(formula, data, n.chains = 3, n.adapt = 100, n.iter = 0, thin = 1,
monitor_params = NULL, inits = TRUE, modelname = NULL,
modeldir = NULL, overwrite = FALSE, keep_model = FALSE, quiet = TRUE,
progress.bar = "text", warn = TRUE, auxvars = NULL, meth = NULL,
refcats = NULL, scale_vars = NULL, hyperpars = NULL, ...)glm_imp(formula, family, data, n.chains = 3, n.adapt = 100, n.iter = 0,
thin = 1, monitor_params = NULL, inits = TRUE, modelname = NULL,
modeldir = NULL, overwrite = FALSE, keep_model = FALSE, quiet = TRUE,
progress.bar = "text", warn = TRUE, auxvars = NULL, meth = NULL,
refcats = NULL, scale_vars = NULL, hyperpars = NULL, ...)
lme_imp(fixed, data, random, n.chains = 3, n.adapt = 100, n.iter = 0,
thin = 1, monitor_params = NULL, inits = TRUE, modelname = NULL,
modeldir = NULL, overwrite = FALSE, keep_model = FALSE, quiet = TRUE,
progress.bar = "text", warn = TRUE, auxvars = NULL, meth = NULL,
refcats = NULL, scale_vars = NULL, hyperpars = NULL, ...)
An object of class JointAI
There are some optional parameters that can be passed to …
scale_pars
optional matrix of parameters used for centering and
scaling continuous covariates. If not specified, this will be calculated
automatically. If FALSE
, no scaling will be done.
glm_imp()
gaussian |
with links: identity , log |
binomial |
with links: logit , probit , log , cloglog |
Gamma |
with links: identity , log |
poisson |
with links: log , identity |
Implemented imputation models that can be chosen in the argument meth
are:
norm |
linear model |
lognorm |
log-linear model for skewed continuous data |
logit |
logistic model for binary data |
multinomial |
multinomial logit model for unordered categorical variables |
ordinal |
cumulative logit model for ordered categorical variables |
monitor_params
)Named vector specifying which parameters should be monitored. This can be done
either directly by specifying the name of the parameter or indirectly by one
of the key words summarizing a number of parameters. Except for other
,
in which parameter names are specified directly, parameter (groups) are just
set as TRUE
or FALSE
.
If left unspecified, monitor_params = c("analysis_main" = TRUE)
will be used.
name/key word | what is monitored |
analysis_main |
betas , tau_y and sigma_y |
analysis_random |
ranef , D , invD , RinvD |
imp_pars |
alphas , tau_imp , gamma_imp , delta_imp |
imps |
imputed values |
betas |
regression coefficients of the analysis model |
tau_y |
precision of the residuals from the analysis model |
sigma_y |
standard deviation of the residuals from the analysis model |
ranef |
random effects |
D |
covariance matrix of the random effects |
invD |
inverse of D |
RinvD |
matrix in prior for invD |
alphas |
regression coefficients in the imputation models |
tau_imp |
precision parameters of the residuals from imputation models |
gamma_imp |
intercepts in ordinal imputation models |
delta_imp |
increments of ordinal intercepts |
other |
additional parameters |
monitor_params = c("analysis_main" = TRUE, "tau_y" = FALSE)
would monitor the regression parameters betas
and residual standard
deviation sigma_y
, but not the residual precision.
monitor_params = c(imps = TRUE)
would monitor betas
, tau_y
,
and sigma_y
(because analysis_main = TRUE
by default) as well as
the imputed values.
traceplot
, densplot
,
summary.JointAI
, MC_error
,
GR_crit
, jags.model
,
coda.samples
, predict.JointAI
# NOT RUN {
mod1 <- lm_imp(y~C1 + C2 + M2, data = wideDF, n.iter = 100)
mod2 <- glm_imp(B1 ~ C1 + C2 + M2, data = wideDF,
family = binomial(link = "logit"), n.iter = 100)
mod3 <- lme_imp(y ~ C1 + B2 + L1 + time, random = ~ time|id,
data = longDF, n.iter = 500)
# }
Run the code above in your browser using DataLab