Skip to contents

Make "control.family" argument for passing to the "inla" function

Usage

make_inlamemi_control.family(
  formula_mis = NULL,
  family_moi,
  error_type = "classical",
  prior.prec.moi = NULL,
  prior.prec.berkson = NULL,
  prior.prec.classical = NULL,
  prior.prec.imp = NULL,
  initial.prec.moi = NULL,
  initial.prec.berkson = NULL,
  initial.prec.classical = NULL,
  initial.prec.imp = NULL,
  control.family.moi = NULL,
  control.family.berkson = NULL,
  control.family.classical = NULL,
  control.family.imp = NULL,
  control.family = NULL
)

Arguments

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

prior.prec.moi

a string containing the parameters for the prior for the precision of the residual term for the model of interest.

prior.prec.berkson

a string containing the parameters for the prior for the precision of the error term for the Berkson error model.

prior.prec.classical

a string containing the parameters for the prior for the precision of the error term for the classical error model.

prior.prec.imp

a string containing the parameters for the precision of the latent variable x, which is the variable being described in the imputation model.

initial.prec.moi

the initial value for the precision of the residual term for the model of interest.

initial.prec.berkson

the initial value for the precision of the residual term for the Berkson error term.

initial.prec.classical

the initial value for the precision of the residual term for the classical error term.

initial.prec.imp

the initial value for the precision of the residual term for the latent variable r.

control.family.moi

control.family component for model of interest. Can be specified here using the inla syntax instead of passing the "prior.prec..." and "initial.prec..." arguments, or in the cases when other hyperparameters are needed for the model of interest, see for instance survival models.

control.family.berkson

control.family component Berkson model. Can be specified here using the inla syntax instead of passing the "prior.prec..." and "initial.prec..." arguments. Useful in the cases when more flexibility is needed, for instance if one wants to specify a different prior distribution than Gamma.

control.family.classical

control.family component for classical model. Can be specified here using the inla syntax instead of passing the "prior.prec..." and "initial.prec..." arguments. Useful in the cases when more flexibility is needed, for instance if one wants to specify a different prior distribution than Gamma.

control.family.imp

control.family component for imputation model. Can be specified here using the inla syntax instead of passing the "prior.prec..." and "initial.prec..." arguments. Useful in the cases when more flexibility is needed, for instance if one wants to specify a different prior distribution than Gamma.

control.family

control.family for use in inla (can be provided directly instead of passing the "prior.prec...." and "initial.prec..." arguments. If this is specified, any other "control.family..." or "prior.prec..." arguments provided will be ignored.

Value

the "control.family" argument to be passed to inla, a list of "control.family" arguments for each model in the hierarchical measurement error model.

Examples

make_inlamemi_control.family(
  family_moi = "gaussian",
  error_type = c("berkson", "classical"),
  prior.prec.moi = c(10, 9),
  prior.prec.berkson = c(10, 9),
  prior.prec.classical = c(10, 9),
  prior.prec.imp = c(10, 9),
  initial.prec.moi = 1,
  initial.prec.berkson = 1,
  initial.prec.classical = 1,
  initial.prec.imp = 1)
#> [[1]]
#> [[1]]$hyper
#> [[1]]$hyper$prec
#> [[1]]$hyper$prec$initial
#> [1] 0
#> 
#> [[1]]$hyper$prec$param
#> [1] 10  9
#> 
#> [[1]]$hyper$prec$fixed
#> [1] FALSE
#> 
#> 
#> 
#> 
#> [[2]]
#> [[2]]$hyper
#> [[2]]$hyper$prec
#> [[2]]$hyper$prec$initial
#> [1] 0
#> 
#> [[2]]$hyper$prec$param
#> [1] 10  9
#> 
#> [[2]]$hyper$prec$fixed
#> [1] FALSE
#> 
#> 
#> 
#> 
#> [[3]]
#> [[3]]$hyper
#> [[3]]$hyper$prec
#> [[3]]$hyper$prec$initial
#> [1] 0
#> 
#> [[3]]$hyper$prec$param
#> [1] 10  9
#> 
#> [[3]]$hyper$prec$fixed
#> [1] FALSE
#> 
#> 
#> 
#> 
#> [[4]]
#> [[4]]$hyper
#> [[4]]$hyper$prec
#> [[4]]$hyper$prec$initial
#> [1] 0
#> 
#> [[4]]$hyper$prec$param
#> [1] 10  9
#> 
#> [[4]]$hyper$prec$fixed
#> [1] FALSE
#> 
#> 
#> 
#> 

make_inlamemi_control.family(
  family_moi = "weibull.surv",
  error_type = c("classical", "missing"),
  control.family.moi =
    list(hyper = list(alpha = list(param = 0.01,
                                   initial = log(1.4),
                                   fixed = FALSE))),
  prior.prec.classical = c(0.5, 0.5),
  prior.prec.imp = c(0.5, 0.5),
  initial.prec.classical = 2.8,
  initial.prec.imp = 1)
#> [[1]]
#> [[1]]$hyper
#> [[1]]$hyper$alpha
#> [[1]]$hyper$alpha$param
#> [1] 0.01
#> 
#> [[1]]$hyper$alpha$initial
#> [1] 0.3364722
#> 
#> [[1]]$hyper$alpha$fixed
#> [1] FALSE
#> 
#> 
#> 
#> 
#> [[2]]
#> [[2]]$hyper
#> [[2]]$hyper$prec
#> [[2]]$hyper$prec$initial
#> [1] 1.029619
#> 
#> [[2]]$hyper$prec$param
#> [1] 0.5 0.5
#> 
#> [[2]]$hyper$prec$fixed
#> [1] FALSE
#> 
#> 
#> 
#> 
#> [[3]]
#> [[3]]$hyper
#> [[3]]$hyper$prec
#> [[3]]$hyper$prec$initial
#> [1] 0
#> 
#> [[3]]$hyper$prec$param
#> [1] 0.5 0.5
#> 
#> [[3]]$hyper$prec$fixed
#> [1] FALSE
#> 
#> 
#> 
#>