Description Usage Arguments Value Author(s) References See Also

View source: R/refitME_package.r

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

1 2 3 4 5 6 7 8 9 10 11 | ```
MCEMfit_gen(
mod,
family,
sigma.sq.u,
B = 50,
epsilon = 1e-05,
silent = FALSE,
theta.est = 1,
shape.est = 1,
...
)
``` |

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

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

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

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.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.