MCEMfit_gen {refitME}R Documentation

Function for fitting any likelihood-based model using the MCEM algorithm

Description

Function for wrapping the MCEM algorithm on any likelihood-based model where predictors are subject to measurement error/error-in-variables.

Usage

MCEMfit_gen(
  mod,
  family,
  sigma.sq.u,
  B = 50,
  epsilon = 1e-05,
  silent = FALSE,
  theta.est = 1,
  shape.est = 1,
  ...
)

Arguments

mod

: a model object (this is the naive fitted model). Make sure the first p input predictor variables entered in the naive model are the specified error-contaminated variables. These p predictors also need the measurement error variance to be specified in sigma.sq.u, see below.

family

: a specified family/distribution.

sigma.sq.u

: measurement error (ME) variance. A scalar if there is only one error-contaminated predictor variable, otherwise this must be stored as a vector (of ME variances) or a matrix if the ME covariance matrix is known.

B

: the number of Monte Carlo replication values (default is set to 50).

epsilon

: a set convergence threshold (default is set to 0.00001).

silent

: if TRUE, the convergence message (which tells the user if the model has converged and reports the number of iterations required) is suppressed (default is set to FALSE).

theta.est

: an initial value for the dispersion parameter (this is required for fitting negative binomial models).

shape.est

: an initial value for the shape parameter (this is required for fitting gamma models).

...

: further arguments passed through to the function that was used to fit mod, that will be used in refitting. These need only be specified if making changes to the arguments as compared to the original call that produced mod.

Value

MCEMfit_gen returns the original naive fitted model object but coefficient estimates and residuals have been replaced with the final MCEM model fit. Standard errors are included and returned, if mod is a class of object accepted by the sandwich package (such as glm, gam, survreg and many more).

Author(s)

Jakub Stoklosa, Wen-Han Hwang and David I. Warton.

References

Carroll, R. J., Ruppert, D., Stefanski, L. A., and Crainiceanu, C. M. (2006). Measurement Error in Nonlinear Models: A Modern Perspective. 2nd Ed. London: Chapman & Hall/CRC.

Stoklosa, J., Hwang, W-H., and Warton, D.I. refitME: Measurement Error Modelling using Monte Carlo Expectation Maximization in R.

See Also

MCEMfit_glm and MCEMfit_gam


[Package refitME version 1.2.2 Index]