lmer

Restart mixed effect model estimation with previously estimated values

五迷三道 提交于 2020-06-09 11:38:06
问题 I'm using lmer() in package lme4 to estimate mixed effects models. This works well, but now I want to run the estimation process for a fixed number of iterations, then resume the process by specifying start values, as calculated by the last estimation process. According to the help for ?lmer this is possible, by setting the arguments: start - these are the new start values, and according to the help one can extract the value in slot ST from a fitted model and use these, i.e. use x@ST maxiter

How to plot random intercept and slope in a mixed model with multiple predictors?

跟風遠走 提交于 2019-12-21 02:43:07
问题 Is it possible to plot the random intercept or slope of a mixed model when it has more than one predictor? With one predictor I would do like this: #generate one response, two predictors and one factor (random effect) resp<-runif(100,1, 100) pred1<-c(resp[1:50]+rnorm(50, -10, 10),resp[1:50]+rnorm(50, 20, 5)) pred2<-resp+rnorm(100, -10, 10) RF1<-gl(2, 50) #gamm library(mgcv) mod<-gamm(resp ~ pred1, random=list(RF1=~1)) plot(pred1, resp, type="n") for (i in ranef(mod$lme)[[1]]) { abline(fixef

How does lmer (from the R package lme4) compute log likelihood?

这一生的挚爱 提交于 2019-12-20 10:08:03
问题 I'm trying to understand the function lmer. I've found plenty of information about how to use the command, but not much about what it's actually doing (save for some cryptic comments here: http://www.bioconductor.org/help/course-materials/2008/PHSIntro/lme4Intro-handout-6.pdf). I'm playing with the following simple example: library(data.table) library(lme4) options(digits=15) n<-1000 m<-100 data<-data.table(id=sample(1:m,n,replace=T),key="id") b<-rnorm(m) data$y<-rand[data$id]+rnorm(n)*0.1

anova() does not display p-value when used with lmerTest

删除回忆录丶 提交于 2019-12-11 04:30:33
问题 I'm trying to use lmerTest to have p-values for my fixed effects. I have 4 different random intercepts, 3 crossed and one nested : test.reml <- lmerTest::lmer(y ~ s1 + min + cot + min:cot + ge + vis + dur + mo + nps + dist + st1 + st2 + di1 + s1:cot + s1:min + s1:cot:min + s1:ge + s1:vis + s1:dur + s1:mo + s1:nps + s1:dist + s1:st1 + s1:st2 + s1:di1 + (1|Unique_key) + (s1-1|object) + (ns1-1|object) + (1|region), bdr, REML=1) The objects are observed two times and the correlation between the

invalid grouping factor specification in lmer model

萝らか妹 提交于 2019-12-10 20:38:36
问题 I am attempting to run a mixed effects model using the lmer function. My experiment included metabolic rates at different temperatures using some of the same individuals (some missing data). The structure of the textfile looks like this: > str(data.by.animal) 'data.frame': 18 obs. of 17 variables: $ animal: Factor w/ 18 levels "08_03","08_07",..: 17 6 5 10 15 14 11 12 16 9 ... $ temp : int 2 0 -2 -4 -6 -8 -10 -12 -14 -16 ... $ X2 : num 0.0129 0.0176 0.0132 NA 0.0144 0.0133 0.0101 When I run

Error message: Error in fn(x, …) : Downdated VtV is not positive definite

好久不见. 提交于 2019-12-10 15:53:35
问题 Thanks in advance for anyone who gives this a look over. I've seen this problem once on the archives but I'm a bit new to R and had a lot of trouble understanding both the problem and the solution... I'm trying to use the lmer function to create a minimum adequate model. My model is Mated ~ Size * Attempts * Status + (random factor). as.logical(Mated) as.numeric(Size) as.factor(Attempts) as.factor(Status) (These have all worked on previous models) So after all that I try running my model:

lmerTest and lmer: Error message

[亡魂溺海] 提交于 2019-12-10 00:16:31
问题 I have run lmerTest and lmer in R in the version 2013: > library(lmerTest) > data1.frame <- read.delim("colorness.txt", fileEncoding="UTF-16") > str(data1.frame) > lmer3 <- lmerTest::lmer(duration ~ (1|item) + (1+color|speaker) + group*color*sex, data=data1.frame, REML=FALSE, na.action=na.omit) The lmer3 works fine for me. And when I checked the data in str(data1.frame), there is nothing wrong. But when I put this command > summary(lmer3) It gives me this message: Error in `colnames<-`(`*tmp*

Confidence interval of random effects with lmer

大兔子大兔子 提交于 2019-12-08 13:15:09
问题 I am using lmer from lme4 package to calculate confidence interval for variance component . When I fit the model there is warning messages : fit <- lmer(Y~X+Z+X:Z+(X|group),data=sim_data) Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : unable to evaluate scaled gradient 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge: degenerate Hessian with 1 negative eigenvalues I searched a lot to understand why

lmerTest and lmer: Error message

孤街醉人 提交于 2019-12-04 21:32:46
I have run lmerTest and lmer in R in the version 2013: > library(lmerTest) > data1.frame <- read.delim("colorness.txt", fileEncoding="UTF-16") > str(data1.frame) > lmer3 <- lmerTest::lmer(duration ~ (1|item) + (1+color|speaker) + group*color*sex, data=data1.frame, REML=FALSE, na.action=na.omit) The lmer3 works fine for me. And when I checked the data in str(data1.frame), there is nothing wrong. But when I put this command > summary(lmer3) It gives me this message: Error in `colnames<-`(`*tmp*`, value = c("Estimate", "Std. Error", "df", : length of 'dimnames' [2] not equal to array extent

How to compute standard errors for predicted data

佐手、 提交于 2019-12-04 06:00:53
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 5 years ago . I am trying to generate standard errors for predicted values. I use the below code to generate the predicted values but it fails to also give the standard errors. ord6 <- veg$ord1-2 laimod.group = lmer(log(lai+0.000019) ~ ord6*plant_growth_form + (1|plot.code) + (1|species.code), data=veg, REML=FALSE) summary(laimod.group) new.ord6 <- c(-1,0,1,2,3,4,5,6,7) new.plant_growth_form