lme4

Alternative optimization algorithms for lmer

喜欢而已 提交于 2021-02-08 06:17:19
问题 The function lmer in the lme4 package uses by default bobyqa from the minqa package as optimization algorithm. According to the following post https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q1/020075.html, it is possible to use also the other optimization algorirthms in the minqa package How can one use uobyqa or newuoa as optimization algorithm for lmer ? library(lme4) fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy, control=lmerControl(optimizer="bobyqa")) 回答1: You can't

Alternative optimization algorithms for lmer

狂风中的少年 提交于 2021-02-08 06:17:14
问题 The function lmer in the lme4 package uses by default bobyqa from the minqa package as optimization algorithm. According to the following post https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q1/020075.html, it is possible to use also the other optimization algorirthms in the minqa package How can one use uobyqa or newuoa as optimization algorithm for lmer ? library(lme4) fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy, control=lmerControl(optimizer="bobyqa")) 回答1: You can't

Plotting the predictions of a mixed model as a line in R

三世轮回 提交于 2021-02-07 10:51:39
问题 I'm trying to plot the predictions ( predict() ) of my mixed model below such that I can obtain my conceptually desired plot as a line below. I have tried to plot my model's predictions, but I don't achieve my desired plot. Is there a better way to define predict() so I can achieve my desired plot? library(lme4) dat3 <- read.csv('https://raw.githubusercontent.com/rnorouzian/e/master/dat3.csv') m4 <- lmer(math~pc1+pc2+discon+(pc1+pc2+discon|id), data=dat3) newdata <- with(dat3, expand.grid(pc1

R - Extract ns spline object from lmer model and predict on new data

纵然是瞬间 提交于 2021-02-07 10:31:19
问题 I'm looking to predict 'terms', especially ns splines, from an lmer model. I've replicated the problem with the mtcars dataset (technically poor example, but works to get the point across). Here is what I'm trying to do with a linear model: data(mtcars) mtcarsmodel <- lm(wt ~ ns(drat,2) + hp + as.factor(gear), data= mtcars) summary(mtcarsmodel) coef(mtcarsmodel) test <- predict(mtcarsmodel, type = "terms") Perfect. However, there is no equivalent 'terms' option for lmer predict (unresolved

R - Extract ns spline object from lmer model and predict on new data

馋奶兔 提交于 2021-02-07 10:31:04
问题 I'm looking to predict 'terms', especially ns splines, from an lmer model. I've replicated the problem with the mtcars dataset (technically poor example, but works to get the point across). Here is what I'm trying to do with a linear model: data(mtcars) mtcarsmodel <- lm(wt ~ ns(drat,2) + hp + as.factor(gear), data= mtcars) summary(mtcarsmodel) coef(mtcarsmodel) test <- predict(mtcarsmodel, type = "terms") Perfect. However, there is no equivalent 'terms' option for lmer predict (unresolved

Warning lme4: Model failed to converge with max|grad|

两盒软妹~` 提交于 2021-02-07 09:14:05
问题 I have to run a lmer with a log transformed response variable, a continuous variable as fixed effect and and a nested random effect: first<-lmer(logterrisize~spm + (1|studyarea/teriid), data = Data_table_for_analysis_Character_studyarea, control=lmerControl(optimizer="Nelder_Mead", optCtrl=list(maxfun=1e4))) I got this error message: Error in length(value <- as.numeric(value)) == 1L : Downdated VtV is not positive definite I tried this with bobyqa() as optimization argument and got this

Difference in model fitness estimate between lmer() and anova() [closed]

冷暖自知 提交于 2021-02-07 09:13:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 8 years ago . Improve this question I want to model the treatment effect over time on biological data using lmer() to take into account the individual effect. The procedure usually used is to build several models by deleting step by step fixed effects and interactions terms and then find the best models using anova(model1

Warning lme4: Model failed to converge with max|grad|

南楼画角 提交于 2021-02-07 09:06:17
问题 I have to run a lmer with a log transformed response variable, a continuous variable as fixed effect and and a nested random effect: first<-lmer(logterrisize~spm + (1|studyarea/teriid), data = Data_table_for_analysis_Character_studyarea, control=lmerControl(optimizer="Nelder_Mead", optCtrl=list(maxfun=1e4))) I got this error message: Error in length(value <- as.numeric(value)) == 1L : Downdated VtV is not positive definite I tried this with bobyqa() as optimization argument and got this

solution to the warning message using glmer

左心房为你撑大大i 提交于 2021-02-07 06:17:08
问题 As many other people, I'm having troubles running a model which uses glmer function from package lme4. Here is my model: model = glmer(depvar ~ variety*cover+amplitude+time+ (1|pp) + (1|stim), data = datafile, family=poisson) And here is the warning I get: Warning message: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 0.00606839 (tol = 0.001, component 1) I read at this link that if I add control=glmerControl(optimizer="bobyqa

solution to the warning message using glmer

孤者浪人 提交于 2021-02-07 06:12:01
问题 As many other people, I'm having troubles running a model which uses glmer function from package lme4. Here is my model: model = glmer(depvar ~ variety*cover+amplitude+time+ (1|pp) + (1|stim), data = datafile, family=poisson) And here is the warning I get: Warning message: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 0.00606839 (tol = 0.001, component 1) I read at this link that if I add control=glmerControl(optimizer="bobyqa