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 |
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 |
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 |
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.