lme4

solution to the warning message using glmer

对着背影说爱祢 提交于 2021-02-07 06:11:55
问题 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:10:32
问题 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

How to do specific, custom contrasts in EMMEANs with multiple nested factor levels but without subsetting data

假装没事ソ 提交于 2021-02-05 09:23:06
问题 Here is my data frame (my real DF has way more data points): rearing.temp<-c("15", "15", "15", "15", "19", "19", "19", "19") source<-c("field", "field", "woods", "woods", "field", "field", "woods", "woods") runway.temp<-c("40","20","40","20","40","20","40","20") velocity<-c("2.3", "2.1", "1.9", "1.9", "2.3", "2.2", "2.3", "2.0") snail<-data.frame(rearing.temp, source, runway.temp, velocity) Here is my model: mod <- lmer(velocity ~ runway.temp*source*rearing.temp + (1|family) + (1|collection

How to extract the goodness-of-fit statistics from lmer() model for msummary from modelsummary package

给你一囗甜甜゛ 提交于 2021-02-04 21:06:17
问题 I am using lmerTest::lmer() to perform linear regression with repeated measures data. My model contains a fixed effect (factor with 5 levels) and a random effect (subject): library(lmerTest) model_lm <- lmer(likertscore ~ task.f + (1 | subject), data = df_long) I would like to include the total number of observations, the number of subjects, total R^2, and the R^2 of the fixed effects in the regression table which I generate with modelsummary() . I tried to extract these and build a gof_map

How to extract the goodness-of-fit statistics from lmer() model for msummary from modelsummary package

对着背影说爱祢 提交于 2021-02-04 21:02:03
问题 I am using lmerTest::lmer() to perform linear regression with repeated measures data. My model contains a fixed effect (factor with 5 levels) and a random effect (subject): library(lmerTest) model_lm <- lmer(likertscore ~ task.f + (1 | subject), data = df_long) I would like to include the total number of observations, the number of subjects, total R^2, and the R^2 of the fixed effects in the regression table which I generate with modelsummary() . I tried to extract these and build a gof_map

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,

Passing strings into 'contrasts' argument of lme/lmer

时光怂恿深爱的人放手 提交于 2021-01-28 11:47:09
问题 I am writing a sub-routine to return output of longitudinal mixed-effects models. I want to be able to pass elements from lists of variables into lme/lmer as the outcome and predictor variables. I would also like to be able to specify contrasts within these mixed-effects models, however I am having trouble with getting the contrasts() argument to recognise the strings as the variable names referred to in the model specification within the same lme/lme4 call. Here's some toy data, set.seed(345

Grouping error with lmer

≡放荡痞女 提交于 2021-01-27 10:35:13
问题 I have a data frame with the following structure: > t <- read.csv("combinedData.csv")[,1:7] > str(t) 'data.frame': 699 obs. of 7 variables: $ Awns : int 0 0 0 0 0 0 0 0 1 0 ... $ Funnel : Factor w/ 213 levels "MEL001","MEL002",..: 1 1 2 2 2 3 4 4 4 4 ... $ Plant : int 1 2 1 3 8 1 1 2 3 5 ... $ Line : Factor w/ 8 levels "a","b","c","cA",..: 2 2 1 1 1 3 1 1 1 1 ... $ X : int 1 2 3 4 7 8 9 10 11 12 ... $ ID : Factor w/ 699 levels "MEL_001-1b","MEL_001-2b",..: 1 2 3 4 5 6 7 8 9 10 ... $ BobWhite

Grouping error with lmer

旧巷老猫 提交于 2021-01-27 10:35:10
问题 I have a data frame with the following structure: > t <- read.csv("combinedData.csv")[,1:7] > str(t) 'data.frame': 699 obs. of 7 variables: $ Awns : int 0 0 0 0 0 0 0 0 1 0 ... $ Funnel : Factor w/ 213 levels "MEL001","MEL002",..: 1 1 2 2 2 3 4 4 4 4 ... $ Plant : int 1 2 1 3 8 1 1 2 3 5 ... $ Line : Factor w/ 8 levels "a","b","c","cA",..: 2 2 1 1 1 3 1 1 1 1 ... $ X : int 1 2 3 4 7 8 9 10 11 12 ... $ ID : Factor w/ 699 levels "MEL_001-1b","MEL_001-2b",..: 1 2 3 4 5 6 7 8 9 10 ... $ BobWhite

specifying multiple separate random effects in nlme

筅森魡賤 提交于 2021-01-24 07:17:28
问题 I am analysing some whale tourism data and am trying to construct linear mixed effect models in the nlme package to see if any of my explanatory variables affect encounter time between whales and tourists. (I am also open to running this model in lme4 .) My variables are: mins : encounter time (response variable) Id : individual whale ID (random effect) Vessel : vessel Id (random effect) Sex : sex of the animal Length : length of the animal Year Month (nested within Year ). So my random