Call the lme4
machinery more directly, in a
manner analogous to lm.fit
require(Matrix) # sparse matrices are required!
devFun <- mkGeneralGlmerDevfun(y = responseVector,
X = modelMatrixFixef,
Zt = as(t(modelMatrixRanef), "dgCMatrix"),
Lambdat = as(upperTriangularCovarFactor, "dgCMatrix"),
family = binomial(),
initPars = initialParameterVector,
parInds = listOfIndicesToParameterVector,
mapToCovFact = function(covarianceParameters) ...,
...)
Now optimize it!
opt <- optim(initialParameterVector, devFun)
The fitted objects are in the environment of the deviance function
environment(devFun)$pp$beta(1)