lme4

lme4 upgrade produces error message even after grouping variables within the data frame

試著忘記壹切 提交于 2019-12-02 17:43:47
问题 I've been running linear mixed models using an old version of lme4. Now that I have updated lme4 I'm getting the following error: Error en [[<-.data.frame ( *tmp* , i, value = integer(0)) : replacement has 0 rows, data has 4211 I found in this website an answer that suggests to put all the grouping variables within the data frame specified by the data argument. I've done that but my code still doesn't work. Here it is: msdgtot=glmer(sdg.dens ~ ngbr.trees + (1 + ngbr.trees | factor(species)),

warning messages when trying to run glmer in r

為{幸葍}努か 提交于 2019-12-02 17:18:31
Dear Stack Overflow community, Currently I'm trying to rerun an old data analysis, binomial glmer model, (from early 2013) on the latest version of R and lme4, because I don't have the old versions of R and lme4 anymore. However, I experience similar warning messages as previous threads by dmartin and carine (first warning message) and other threads outside stack overflow (warnings 2 and 3). These warning messages didn't pop up on the earlier version of R and lme4 I used, so it must have something to do with latest updates? A subset of my dataset: df <- structure(list(SUR.ID = structure(c(1L,

Extract random effect variances from lme4 mer model object

て烟熏妆下的殇ゞ 提交于 2019-12-02 17:01:13
I have a mer object that has fixed and random effects. How do I extract the variance estimates for the random effects? Here is a simplified version of my question. study <- lmer(Reaction ~ Days + (1|Subject), data = sleepstudy) study This gives a long output - not too long in this case. Anyway, how do I explicitly select the Random effects: Groups Name Variance Std.Dev. Subject (Intercept) 1378.18 37.124 Residual 960.46 30.991 part of the output? I want the values themselves. I have taken long looks at str(study) and there's nothing there! Also checked any extractor functions in the lme4

Multivariate Linear Mixed Model in lme4

Deadly 提交于 2019-12-02 16:50:30
I wonder how to fit multivariate linear mixed model with lme4 . I fitted univariate linear mixed models with the following code: library(lme4) lmer.m1 <- lmer(Y1~A*B+(1|Block)+(1|Block:A), data=Data) summary(lmer.m1) anova(lmer.m1) lmer.m2 <- lmer(Y2~A*B+(1|Block)+(1|Block:A), data=Data) summary(lmer.m2) anova(lmer.m2) I'd like to know how to fit multivariate linear mixed model with lme4 . The data is below: Block A B Y1 Y2 1 1 1 135.8 121.6 1 1 2 149.4 142.5 1 1 3 155.4 145.0 1 2 1 105.9 106.6 1 2 2 112.9 119.2 1 2 3 121.6 126.7 2 1 1 121.9 133.5 2 1 2 136.5 146.1 2 1 3 145.8 154.0 2 2 1 102

How to modify slots lme4 >1.0

▼魔方 西西 提交于 2019-12-02 10:50:07
问题 I have been using the code below to successfully modify the 'Zt', 'L', and 'A' slots of models fit using lme4 versions <1.0. I just updated to lme4 1.0-4 today and found that the model objects are different. Can anyone provide insight/guidance as to how to modify these slots in the new lmer model objects? dat<-structure(list(pop1 = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 10L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 7L,

lme4 upgrade produces error message even after grouping variables within the data frame

瘦欲@ 提交于 2019-12-02 07:34:02
I've been running linear mixed models using an old version of lme4. Now that I have updated lme4 I'm getting the following error: Error en [[<-.data.frame ( *tmp* , i, value = integer(0)) : replacement has 0 rows, data has 4211 I found in this website an answer that suggests to put all the grouping variables within the data frame specified by the data argument. I've done that but my code still doesn't work. Here it is: msdgtot=glmer(sdg.dens ~ ngbr.trees + (1 + ngbr.trees | factor(species)), data=d.sdg.ngb,family=poisson) Error en [[<-.data.frame ( *tmp* , i, value = integer(0)) : replacement

merTools predictInterval() for model with nested random effect

余生颓废 提交于 2019-12-01 13:00:14
Does predictInterval() from the merTools package not like nested random effects? For example, using the msleep dataset from the ggplot2 package: library("lme4") library("merTools") library("ggplot2") mod <- lmer(sleep_total ~ bodywt + (1|vore/order), data=msleep) predInt <- predictInterval(merMod=mod, newdata=msleep) Returns an error: Error in '[.data.frame'(newdata, , j) : undefined columns selected This runs fine no problem: mod <- lmer(sleep_total ~ bodywt + (1|vore) + (1|order), data=msleep) predInt <- predictInterval(merMod=mod, newdata=msleep) (Well actually it gives a warning about NA

merTools predictInterval() for model with nested random effect

北战南征 提交于 2019-12-01 12:16:26
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 3 years ago . Does predictInterval() from the merTools package not like nested random effects? For example, using the msleep dataset from the ggplot2 package: library("lme4") library("merTools") library("ggplot2") mod <- lmer(sleep_total ~ bodywt + (1|vore/order), data=msleep) predInt <- predictInterval(merMod=mod, newdata=msleep) Returns an error: Error in '[.data.frame'(newdata, , j) :

lme4 upgrade produces error message Error in `[[<-.data.frame`(`*tmp*`, i, value = integer(0))

廉价感情. 提交于 2019-12-01 10:55:06
问题 I have constructed a generalized mixed linear model with lmer (lme4) last week which worked fine: fit<-lmer(dat$presence~log(dat$SIZE_strict)*dat$Troph_level+log(dat$HAB500EXCL_strict+1)+(1|dat$dataset), family=poisson, REML=FALSE) After updating the lme4 package however, the model no longer worked, giving the error message: Error in `[[<-.data.frame`(`*tmp*`, i, value = integer(0)) : replacement has 0 rows, data has 174 In addition: Warning messages: 1: In lmer(dat$presence ~ log(dat$SIZE

What does this mean in lme4: function 'dataptr' not provided by package 'Rcpp'

故事扮演 提交于 2019-12-01 05:34:31
问题 I'm trying to do LMM using lme4, and this message pops up: Error in initializePtr() : function 'dataptr' not provided by package 'Rcpp' What should I do? 回答1: After a while, I got it. 1) Reinstall the latest version of Rcpp is the solution. 2) If you are not using lme4, but you also have this problem ("function 'dataptr' not provided by package 'Rcpp'") in combination with dyn.load(), it might be worth noting do not forget to include library(Rcpp) or require(Rcpp) on your code before dyn.load