1 |
fit |
|
varpattern |
|
form |
|
data |
|
... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ##---- 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 (fit, varpattern = "", form = terms(fit), data = getData(fit),
...)
{
getData <- function(x) UseMethod("getData")
getData.lme <- function(x) x$data
getData.lmer <- function(x) x@frame
model.mat <- model.matrix(form, data, ...)
fe <- fixef(fit)
effect.names <- grep(varpattern, names(fe), value = T)
ret <- c(model.mat[, effect.names] %*% fe[effect.names])
names(ret) <- rownames(model.mat)
retnames <- rownames(fit$resid)
ret <- ret[retnames]
attr(ret, "predictors") <- effect.names
ret
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.