MCEMfit_glm {refitME}R Documentation

Function for wrapping the MCEM algorithm on lm or glm objects

Description

Function for wrapping the MCEM algorithm on GLMs where predictors are subject to measurement error/error-in-variables.

Usage

MCEMfit_glm(
  mod,
  family,
  sigma.sq.u,
  B = 50,
  epsilon = 1e-05,
  silent = FALSE,
  ...
)

Arguments

mod

: a lm/glm 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).

...

: further arguments passed to lm or glm.

Value

MCEMfit_glm returns the naive fitted model object where coefficient estimates, the covariance matrix, fitted values, the log-likelihood, and residuals have been replaced with the final MCEM model fit. Standard errors and the effective sample size (which diagnose how closely the proposal distribution matches the posterior, see equation (2) of Stoklosa, Hwang and Warton) have also been included as outputs.

Author(s)

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

Source

See https://github.com/JakubStats/refitME for an RMarkdown vignette with examples.

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_gam

Examples

# A GLM example I - binary response data.

library(refitME)

data(Framinghamdata)

glm_naiv <- glm(Y ~ w1 + z1 + z2 + z3, x = TRUE, family = binomial, data = Framinghamdata)

# The error-contaminated predictor in this example is systolic blood pressure (w1).

sigma.sq.u <- 0.006295  # ME variance, as obtained from Carroll et al. (2006) monograph.

B <- 50 # The number of Monte Carlo replication values.

glm_MCEM <- refitME(glm_naiv, sigma.sq.u, B)


[Package refitME version 1.2.2 Index]