SCM

SCM Repository

[matrix] Diff of /branches/trunk-lme4/R/lmer.R
ViewVC logotype

Diff of /branches/trunk-lme4/R/lmer.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 449, Fri Jan 21 22:01:21 2005 UTC revision 452, Sun Jan 23 10:09:03 2005 UTC
# Line 60  Line 60 
60                       function(x) list(model.matrix(eval(substitute(~term,                       function(x) list(model.matrix(eval(substitute(~term,
61                                                                     list(term=x[[2]]))),                                                                     list(term=x[[2]]))),
62                                                     frm),                                                     frm),
63                                        eval(substitute(as.factor(fac),                                        eval(substitute(as.factor(fac)[,drop = TRUE],
64                                                        list(fac = x[[3]])), frm)))                                                        list(fac = x[[3]])), frm)))
65            names(random) <- unlist(lapply(bars, function(x) deparse(x[[3]])))            names(random) <- unlist(lapply(bars, function(x) deparse(x[[3]])))
66    
67            ## order factor list by decreasing number of levels            ## order factor list by decreasing number of levels
68            nlev <- sapply(random, function(x) length(levels(x[[2]])))            nlev <- sapply(random, function(x) length(levels(x[[2]])))
69            if (any(diff(nlev) < 0)) {            if (any(diff(nlev) > 0)) {
70                random <- random[rev(order(nlev))]                random <- random[rev(order(nlev))]
71            }            }
72              fixed.form <- nobars(formula)
73              if (!inherits(fixed.form, "formula")) fixed.form <- ~ 1 # default formula
74            mmats <- c(lapply(random, "[[", 1),            mmats <- c(lapply(random, "[[", 1),
75                       .fixed = list(cbind(model.matrix(nobars(formula), frm),                       .fixed = list(cbind(model.matrix(fixed.form, frm),
76                       .response = model.response(frm))))                       .response = model.response(frm))))
77            obj <- .Call("lmer_create", lapply(random, "[[", 2), mmats, PACKAGE = "Matrix")            obj <- .Call("lmer_create", lapply(random, "[[", 2), mmats, PACKAGE = "Matrix")
78            obj@call <- match.call()            obj@call <- match.call()

Legend:
Removed from v.449  
changed lines
  Added in v.452

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge