Skip to contents

Make formula for measurement error and missing data model

Usage

make_inlamemi_formula(
  formula_moi,
  formula_imp,
  formula_mis = NULL,
  family_moi = "gaussian",
  error_type = "classical",
  error_variable = NULL,
  prior.beta.error,
  prior.gamma.error = NULL,
  vars = NULL
)

Arguments

formula_moi

an object of class "formula", describing the main model to be fitted.

formula_imp

an object of class "formula", describing the imputation model for the mismeasured and/or missing observations.

formula_mis

an object of class "formula", describing the missingness model. Does not need to have a response variable, since this will always be a binary missingness indicator.

family_moi

a string indicating the likelihood family for the model of interest (the main model).

error_type

type of error (one or more of "classical", "berkson", "missing")

error_variable

character vector with the name(s) of the variable(s) with error.

prior.beta.error

parameters for the Gaussian prior for the coefficient of the error prone variable.

prior.gamma.error

parameters for the Gaussian prior for the coefficient of the variable with missingness in the missingness model.

vars

Results from a call to "extract_variables_from_formula" function. If this is not passed as an argument, it is called inside the function.

Value

An object of class "formula".

Examples

make_inlamemi_formula(formula_moi = y ~ x + z,
                      formula_imp = x ~ z,
                      error_type = "classical",
                      prior.beta.error = c(0, 1/1000)
                      )
#> list(y_moi, x_classical, x_imp) ~ -1 + beta.0 + beta.z + alpha.x.0 + 
#>     alpha.x.z + f(beta.x, copy = "id.x", hyper = list(beta = list(param = c(0, 
#>     0.001), fixed = FALSE))) + f(id.x, weight.x, model = "iid", 
#>     values = 1:n, hyper = list(prec = list(initial = -15, fixed = TRUE)))
#> <environment: 0x5610770737e0>