# simexlme: SIMEX algorithm for linear mixed effects models In SurvDisc: Discrete Time Survival and Longitudinal Data Analysis

## Description

Implementation of the SIMEX algorithm for measurement error models according to Cook and Stefanski.

## Usage

 ```1 2 3``` ```simexlme(model, model.model, SIMEXvariable, respvar, grpvar, corform, measurement.error, measurement.error.resp, lambda = c(0.5, 1, 1.5, 2), B = 100, fitting.method = "quadratic", jackknife.estimation = "quadratic") ```

## Arguments

 `model` naive model `model.model` dataframe containing all variables in the model `SIMEXvariable` character name of the variable with measurement error. Assumed to be the baseline measurement. `respvar` character name of the response variable. The response is assumed to represent a change from baseline. `grpvar` character name of the grouping variable for the random effects in the model. `corform` formula for the correlation of residual errors within groups. see example `measurement.error` The known standard deviation of measurement errors for `SIMEXvariable`. `measurement.error.resp` The known stadard deviaiton for `respvar` `lambda` vector of lambdas for which the simulation step should be done `B` number of iterations for each lambda `fitting.method` fitting method for extrapolation. Only `linear` or `quadratic` are recommended. `jackknife.estimation` specifying the extrapolation method for jackknife variance estimation.

## Details

See documentation for `mcsimex` function. This function for lme models was adapted from that function, which is designed to handle linear and generalized linear models, but not lme models. In this function, the measurement error variable must be the baseline value of some measurement and the response is the change from baseline in the same measurement. There is assumed to be one value of this baseline measurement per level of the grouping variable in the mixed effect model. The correlation between the measurement errors for two response values within a subject is assumed to be equal to be equal to the variance of baseline divided by the sum of the variance of baseline and variance of post-baseline errors. For example, for a study measuring the effect of some weight loss treatment, the grouping variable could be subject, the baseline weight is the covariate with measurement error and the response is change from baseline in weight.

## Value

An object of class 'simex' which contains:

 `coefficients` the corrected coefficients of the SIMEX model `SIMEX.estimates` the estimates for every lambda `model` the naive model `measurement.error` the known error standard deviations for `SIMEXvariable` `B` the number of iterations `extrapolation` the model object of the extrapolation step `fitting.method` the fitting method used in the extrapolation step `residuals` the residuals of the main model `fitted.values` the fitted values of the main model `call` the function call `variance.jackknife` the jackknife variance estimate `extrapolation.variance` the model object of the variance extrapolation `variance.jackknife.lambda` the data set for the extrapolation `variance.asymptotic` the asymptotic variance estimates `theta` the estimates for every B and lambda

## Author(s)

John Lawrence,[email protected], Jianjin Xu, Wolfgang Lederer, Heidi Seibold

## References

Cook, J.R. and Stefanski, L.A. (1994) Simulation-extrapolation estimation in parametric measurement error models. Journal of American Statistical Association, 89, 1314 – 1328

`simex`,`lme`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25``` ```set.seed(1234) data("simGFRdata") simGFR=simGFR[is.element(simGFR\$time,c(1:12)/4) & is.element(simGFR\$PID,c(1:80)*100),] fm2=nlme::lme.formula(fixed = cfb ~ time + x1:time + trt + trt:time + trt:x1:time + 0, data = simGFR, random = ~time | PID, correlation = nlme::corCompSymm(0.5,form = ~time | PID, fixed = TRUE), control=nlme::lmeControl(returnObject=TRUE)) (s1 = simexlme(model=fm2, model.model=simGFR[,c("cfb","PID","time","x1","trt")], SIMEXvariable="x1",respvar="cfb",grpvar="PID",corform="~time | PID", measurement.error=res.sd,measurement.error.resp=res.sd, lambda = c(0.5,2),B = 2, fitting.method = "linear", jackknife.estimation = FALSE)) plot(s1) #values of fixed effects used to simulate data c(fixed.time,fixed.trt,fixed.leGFR,fixed.trttime,fixed.leGFRtrt) #naive estimates fm2\$coefficients\$fixed #SIMEX corrected estimates s1\$coefficients ```