lme4

Plot model fit for discrete variable, from average model

核能气质少年 提交于 2020-01-15 01:13:17
问题 I have a set of linear mixed models, and have created an average model. I'd like to plot the model fits for two levels of a factor, included in the average model. A simple example: library(lme4) library(MuMIn) mtcars2 <- mtcars mtcars2$vs <- factor(mtcars2$vs) gl <- lmer(mpg ~ am + disp + hp + qsec + (1 | cyl), mtcars2, REML = FALSE, na.action = 'na.fail') d <- dredge(gl) av <- model.avg(d, subset = cumsum(weight) <= 0.95) summary(av) Call: model.avg(object = d, subset = cumsum(weight) <= 0

How to add fixed effect to four-parameter logistic model in nlmer

空扰寡人 提交于 2020-01-13 10:15:16
问题 I am trying to use nlmer with SSfpl to fit some data with a four-parameter logistic function. I can get a fine fit for the overall data using: nm.fpl <- nlmer(meanFix ~ SSfpl(Time, A, B, xmid, scal) ~ (scal | Subject), data = dataSubset, start = c(A = 0.2, B = 0.7, xmid = 600, scal = 100)) Now I want to add a fixed effect of Condition , which has 2 within-Subject levels. I would like to evaluate whether the two Conditions differ in terms of any of the 4 parameters (A, B, xmid, scal), but I

How to add fixed effect to four-parameter logistic model in nlmer

被刻印的时光 ゝ 提交于 2020-01-13 10:13:30
问题 I am trying to use nlmer with SSfpl to fit some data with a four-parameter logistic function. I can get a fine fit for the overall data using: nm.fpl <- nlmer(meanFix ~ SSfpl(Time, A, B, xmid, scal) ~ (scal | Subject), data = dataSubset, start = c(A = 0.2, B = 0.7, xmid = 600, scal = 100)) Now I want to add a fixed effect of Condition , which has 2 within-Subject levels. I would like to evaluate whether the two Conditions differ in terms of any of the 4 parameters (A, B, xmid, scal), but I

How to add fixed effect to four-parameter logistic model in nlmer

妖精的绣舞 提交于 2020-01-13 10:12:23
问题 I am trying to use nlmer with SSfpl to fit some data with a four-parameter logistic function. I can get a fine fit for the overall data using: nm.fpl <- nlmer(meanFix ~ SSfpl(Time, A, B, xmid, scal) ~ (scal | Subject), data = dataSubset, start = c(A = 0.2, B = 0.7, xmid = 600, scal = 100)) Now I want to add a fixed effect of Condition , which has 2 within-Subject levels. I would like to evaluate whether the two Conditions differ in terms of any of the 4 parameters (A, B, xmid, scal), but I

plotting GLMM estimate line with categorical and interaction variables

旧巷老猫 提交于 2020-01-12 10:45:30
问题 I am working in R with a GLMM with a mixture of continuous and categorical variables with some interactions. I have used the dredge and model.avg functions in MuMIn to obtain effect estimates for each variable. My problem is in how best to plot the results. I want to make a figure showing the effect of one variable (forest) on my data where the trendline reflects the forest parameter estimate, but I can't figure out how to hold the categorical variables and interaction variables at their

glmulti runs indefinitely when using genetic algorithm with lme4

谁都会走 提交于 2020-01-12 05:12:11
问题 I'm using glmulti for model averaging in R. There are ~10 variables in my model, making exhaustive screening impractical - I therefore need to use the genetic algorithm (GA) (call: method = "g"). I need to include random effects so I'm using glmulti as a wrapper for lme4. Methods for doing this are available here http://www.inside-r.org/packages/cran/glmulti/docs/glmulti and there is also a pdf included with the glmulti package that goes into more detail. The problem is that when telling

R ranef(model, condVar) attributes NULL, but postVar show results + deprecated warning

[亡魂溺海] 提交于 2020-01-05 04:12:29
问题 I am finding a weird behaviour in lmer (lme4 version 1.1.12) model fits trying to extract random effect attributes (conditional variances). With the Arabidopsis dataset: #Model maybe makes no sense and fits horribly, but that doesn't matter for my point model <- lmer(total.fruits ~ nutrient * gen + (nutrient + gen | reg), data=Arabidopsis) # Get conditional variances with postVar generates output + warning attr(ranef(model, postVar=T)[[1]], "postVar") , , 1 [,1] [,2] [,3] [1,] 45.263 -3.37843

Error using mediation package with lme4 model: mediator model is not yet implemented

旧城冷巷雨未停 提交于 2020-01-05 03:44:26
问题 I have a data.frame , df : > str(df_ss) 'data.frame': 571 obs. of 4 variables: $ final_grade : num 0.733 0.187 0.502 0.194 0.293 ... $ time_spent : num -0.2 -0.326 -0.709 -0.168 -0.254 ... $ gender_female: num 1 0 1 0 0 0 1 1 1 1 ... $ course_ID : Factor w/ 26 levels "1","2","3","4",..: 14 18 13 21 24 15 3 24 9 13 ... I am trying to see how time_spent moderates the relationship between gender_female and final_grade . I'm specifying a random effect for course_ID . The models I specified using

Standardisation in MuMIn package in R

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-04 14:30:13
问题 I am using the 'MuMIn' package in R to select models and calculate effect sizes of the input variables (rain, brk, onset, wid). To make my effect size comparable between variables, I standardised them using standardize function in arm package. Here is the code that I am following: For reference, please refer to the appendix of this paper: http://onlinelibrary.wiley.com/doi/10.1111/j.1420-9101.2010.02210.x/full Grueber et al. 2011: Multimodel inference in ecology and evolution: challenges and

Standardisation in MuMIn package in R

孤街醉人 提交于 2020-01-04 14:30:09
问题 I am using the 'MuMIn' package in R to select models and calculate effect sizes of the input variables (rain, brk, onset, wid). To make my effect size comparable between variables, I standardised them using standardize function in arm package. Here is the code that I am following: For reference, please refer to the appendix of this paper: http://onlinelibrary.wiley.com/doi/10.1111/j.1420-9101.2010.02210.x/full Grueber et al. 2011: Multimodel inference in ecology and evolution: challenges and