r,matrix,sparse-matrix,lme4,lmer

If mmList is there, then it's not going away (however poorly documented it may be -- feel free to suggest documentation improvements ...). How about do.call(cbind,getME(m2,"mmList")) (which would seem to generalize correctly for multi-term models)? I agree that it's a bit of a pain that Zt doesn't distinguish correctly between...

source("lmer_nocorr_dat.R") ## get data library(lme4) ml1 <- lmer(rt ~ treatment + (1+treatment|subject),data=dd) Summary function for getting just the bits of the output we're interested in at the moment. (Print RE variances rather than standard deviations because they're additive, making it easier to tell which terms are being combined or separated.)...

r,ggplot2,lme4,mixed-models,lmer

The issue is that when you use expand.grid with both wt and wt^2, you create all possible combinations of wt and wt^2. This modification of your code works: newdata <- with(mtcars, expand.grid(wt=unique(wt), gear=unique(gear), hp=mean(hp))) newdata$wtsq <- newdata$wt^2 newdata$pred <- predict(m, newdata) p <- ggplot(newdata, aes(x=wt, y=pred, colour=gear, group=gear)) p +...

This should be fairly straightforward (although it would me more straightforward with a reproducible example ...) If you have a fitted model land1, then ## I'm picking arbitrary values here since I don't ## know what's sensible for your system pframe <- data.frame(area_forage_uncult=200:210) predict(land1,newdata=pframe,re.form=~0) The argument re.form=~0 tells the predict()...

Updated: generalized to allow for scaling of the response as well as the predictors. Here's a fairly crude implementation. If our original (unscaled) regression is Y = b0 + b1*x1 + b2*x2 ... Then our scaled regression is (Y0-mu0)/s0 = b0' + (b1'*(1/s1*(x1-mu1))) + b2'*(1/s2*(x2-mu2))+ ... This is equivalent to...

The best way to answer this question is to look at the code of lme4:::summary.merMod to figure out how to get the pieces you need. This ought to do it: library(lme4) fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy) t.stat <- function(x) fixef(x)/sqrt(diag(vcov(x))) t.stat(fm1) ## (Intercept) Days ##...

The thing here is that random effect was eliminated as being NS according to the LR test. Then the anova method for the fixed effects model, the "lm" object was applied and no elimination of NS fixed effects was done. You are right, that the output is different from "lmer"...

Try to use the capture.output() function. Like this: Results <- capture.output(summary(your.lmer.model)) It stores the summary information in the new variable. After that you can use it in e.g. ReporteRs paragraph functions....

You can represent your model a variety of different ways. The easiest is to plot data by the various parameters using different plotting tools (color, shape, line type, facet), which is what you did with your example except for the random effect site. Model residuals can also be plotted to...

You should try check.nobs.vs.rankZ="ignore". lmerControl doesn't need to specify anything other than the non-default options: at a quick glance, these are your non-default values: lmerControl(check.nobs.vs.nlev = "ignore",check.nobs.vs.rankZ = "ignore",check.nlev.gtreq.5 = "ignore",check.nobs.vs.nRE="ignore", check.rankX = c("ignore"), check.scaleX = "ignore", check.formula.LHS="ignore", check.conv.grad = .makeCC("warning", tol = 1e-3, relTol = NULL)) In general I...

Create a data frame (e.g. lines.df) with intercept (e.g. int) and slope (slo) variables where each line of the df corresponds to one facet, then plot over the top: + geom_abline(aes(intercept = int, slope = slo), data = lines.df) ...