1 | predict.mer(model, data = model.matrix(model), form, verbose = FALSE)
|
model |
|
data |
|
form |
|
verbose |
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 26 27 28 29 30 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (model, data = model.matrix(model), form, verbose = FALSE)
{
help = "\n This is a crude predict method for class 'mer'\n Limitations:\n 1) When invoked on the model it only returns the linear predictor for the\n complete data. Note that a complete data frame is easily obtained with\n model.frame( model )\n 2) When the 'data' argument is provided for 'new' data, it is also\n necessary to provide the correct rhs of the fixed effects formula.\n\n "
if (missing(form) & !missing(data)) {
cat(help)
stop("Need 'form' if 'data' given")
}
if (!missing(data)) {
data = model.matrix(form, data)
cnames = colnames(data)
if (verbose)
print(cnames)
fnames = names(fixef(model))
if (verbose)
print(fnames)
if (any(cnames != fnames)) {
cat("\nMatrix names:\n")
print(cnames)
cat("\nCoeff names:\n")
print(fnames)
warning("matrix and coeff names not the same")
}
}
data %*% fixef(model)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.