mixed-models

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

Get subject-specific peak velocity and age at peak velocity values from linear mixed spline models

喜你入骨 提交于 2021-02-08 04:01:55
问题 I am fitting a linear mixed effects model with a natural spline function for age in order to describe the nonlinear trajectory for a repeated outcome y (bone mineral content in grams) across time ( age in years). How can I solve the spline derivatives to get the velocity curve and estimate for each individual their peak velocity (grams/year) and age at peak velocity (years) from this model? This is the example data dat <- structure(list(id = c(1001L, 1001L, 1001L, 1001L, 1001L, 1002L, 1003L,

Get subject-specific peak velocity and age at peak velocity values from linear mixed spline models

爷,独闯天下 提交于 2021-02-08 04:01:27
问题 I am fitting a linear mixed effects model with a natural spline function for age in order to describe the nonlinear trajectory for a repeated outcome y (bone mineral content in grams) across time ( age in years). How can I solve the spline derivatives to get the velocity curve and estimate for each individual their peak velocity (grams/year) and age at peak velocity (years) from this model? This is the example data dat <- structure(list(id = c(1001L, 1001L, 1001L, 1001L, 1001L, 1002L, 1003L,

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

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

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

Individual age at peak velocity from linear mixed natural spline model

耗尽温柔 提交于 2021-01-29 12:49:00
问题 This thread continues with Get subject-specific peak velocity and age at peak velocity values from linear mixed spline models. I am fitting a linear mixed effects model with a natural spline function for age. I would like to estimate age at peak velocity (apv - years) and peak velocity (pv - grams) for each person in the dataset by differentiating the spline terms. The model includes a random quadratic slope for age. How can I estimate the person-specific apv and pv? I am using the

MuMin Package - Dredge of Model still running 15 hours later

微笑、不失礼 提交于 2021-01-29 08:32:10
问题 I am running a dredge of a linear mixed effect model in the MuMin package in R, The model is quite big (see below) > Monster <- lmer(Fw.FratioFall ~ Average_mintemp_winter + (Average_mintemp_winter^2) > + percentage_woody_coverage + (percentage_woody_coverage^2) > + kmRoads.km2 + (kmRoads.km2^2) + Fracking > + WELLS_ACTIVED + (WELLS_ACTIVED^2) + BadlandsCoyote.1000_mi > + (BadlandsCoyote.1000_mi^2) + cougar_presence + COYOTE_springsurveys > + (COYOTE_springsurveys^2) + d3.1 + (d3.1^2) + WT

Multiple random effects in a linear mixed model with nlme and lme4

可紊 提交于 2021-01-29 06:17:40
问题 I would like to study differences in fat between 2 visits with a linear mixed effects model. So everything would start as lme(fat~ , now... for the coefficients, I have some that will change from visit 1 to visit 2, as they are hypertension status, diabetis status, bmi, waist circunference, smoking_status etc. And other variables that won't change from visit 1 to visit 2, as they are gender or ethnicity. Note that the following variables are dummy ( hypertension status, diabetis status,

Predicting to raster stack at population level with glmmTMB in R

风流意气都作罢 提交于 2021-01-28 06:23:29
问题 I'm trying to predict to a raster stack in R, using a GLMM I fit with the glmmTMB package, at the population level (i.e. setting random effects to 0). I followed Ben Bolker's solution in this thread which works for models fit with lme4 , but even though the function argument re.form=~0 appears to be applicable to predict.glmmTMB in addition to predict.merMod , it's not working for me when I predict using a glmmTMB model. Here is an example using the same example code provided by Robert