This generic function fits a linear mixed-effects model in the formulation described in Laird and Ware (1982) but allowing for censored normal responses. In this version, the with-in group errors are assumed independent and identically distributed.

1 | ```
lmec(yL, cens, X, Z, cluster, maxstep = 200, varstruct = "unstructured", init, method = "ML", epsstop = 0.001, abspmv = 0.001, mcmc0 = 100, sdl = 0.1, iter2 = 15, trs = 5, pls = 5, mcmcmax = 1000)
``` |

`yL` |
Observed left-censored response vector |

`cens` |
Censoring indicator: if yL>ytrue, then cens=1 |

`X` |
Design matrix for the fixed-effects model, it needs to include a column of 1's if the intercept is present |

`Z` |
If the design matrix for the random-effects is diag(Z1, Z2, ..., Zm), then Z=(Z1',Z2', ..., Zm')' |

`cluster` |
Cluster indicator taking values between 1 and m |

`maxstep` |
The maximum number of EM iterations |

`varstruct` |
Variance structure for random effects, current options are unstructured and diagonal. |

`init` |
Intial estimated parameters (it is optional), it is a list with components beta, bi, sigma and Delta. |

`method` |
Options are ML, REML and MLmcmc |

`epsstop` |
The threshold for the difference between two consecutive likelihood values in EM sequence |

`abspmv` |
Absolute error tolerance for pmvnorm() function |

`mcmc0` |
The burn-in MCMC sample size for E-step of EM |

`sdl` |
The target standard deviation for the log-likelihood |

`iter2` |
Number of steps in stage 2 for evaluating standard deviation of log-likelihhood |

`trs` |
Number of increase in sample size during transition face |

`pls` |
Number of steps in plateau face of MCEM |

`mcmcmax` |
Maximum MCEM sample size |

`beta` |
Estimated fixed effects |

`bi` |
Estimated random effects |

`sigma` |
Residual standard deviation |

`Psi` |
Variance matrix of random effects |

`Delta` |
Matrix such that Delta'*Delta=sigma2*solve(Psi) |

`loglik` |
Maximum log-likelihood value (or surrogate objective function) |

`varFix` |
Variance matrix for fixed effects |

`method` |
Options are ML, REML and MLmcmc |

`varstruct` |
Variance structure for random effects, current options are unstructured and diagonal |

`step` |
Number of EM iterations |

`likseq` |
Log-likelihood EM sequence |

Florin Vaida (fvaida@ucsd.edu) and Lin Liu (linliu@ucsd.edu)

Vaida, Florin and Liu, Lin, Fast Implementation For Normal Mixed Effects Models with Censored Response (submitted).

Vaida, Florin and Fitzgerald, Anthony and DeGruttola, Victor (2007), Efficient Hybrid EM for nonlinear mixed effects models with censored response, Computational Statistics and Data Analysis, 51, 5718-5730.

1 2 3 4 5 6 7 8 9 10 | ```
data(UTIdata)
UTIdata <- subset(UTIdata, !is.na(RNA))
o <- order(UTIdata$Patid, UTIdata$Fup)
UTIdata <- UTIdata[o,]
cens = (UTIdata$RNAcens==1)+0
y = log10(UTIdata$RNA)
X = cbind((UTIdata$Fup==0)+0, (UTIdata$Fup==1)+0, (UTIdata$Fup==3)+0, (UTIdata$Fup==6)+0, (UTIdata$Fup==9)+0, (UTIdata$Fup==12)+0, (UTIdata$Fup==18)+0, (UTIdata$Fup==24)+0)
Z = matrix(rep(1, length(y)), ncol=1)
cluster = as.numeric(UTIdata$Patid)
fit = lmec(yL=y,cens=cens, X=X, Z=Z, cluster=cluster, method='ML', maxstep=40)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.