lme4

LMER: Error in model.frame.default… variable lengths differ (Without NA's)

狂风中的少年 提交于 2019-12-24 07:49:26
问题 I've looked through a couple of other questions similar to mine, and the one most relevant wasn't answered, while the others all came down to missing data and data lengths. I am trying to model compositional dissmiliarity after a disturbance through time. I sampled at discrete timepoints: 0, 3, 6, and 9 months. I am interested in the fixed effect of time on recovery, but at each point, season and other environmental variables changed and led to differing variability between 0, 3, 6, and 9

'undefined columns selected' using 'predict' with newdata lme4

僤鯓⒐⒋嵵緔 提交于 2019-12-24 03:48:12
问题 I'm trying to use the 'predict' function on new data after running an nlmer model, and am running into issues. The dataset I use for the model looks like so (except patient_id has an actual value, which I can't share): > data patient_id variable value M_visit_time M_agesero D_intercept D_agesero 1: SECRET vl 4.542850 1.624658 33.16164 0 0.00000 2: SECRET vl 4.408664 2.010959 33.16164 0 0.00000 3: SECRET vl 4.493095 2.219178 33.16164 0 0.00000 4: SECRET vl 4.540980 2.583562 33.16164 0 0.00000

R lme4 Error in '/usr/lib/rstudio/bin/rsession' : malloc(): memory corruption:

China☆狼群 提交于 2019-12-24 01:06:08
问题 Whenever I run lmer or glmer from lme4 package, I get the following error: Error in '/usr/lib/rstudio/bin/rsession' : malloc(): memory corruption: I update all R packages but still getting the same error. sessionInfo() R version 3.3.2 (2016-10-31) Platform: i686-pc-linux-gnu (32-bit) Running under: Ubuntu 16.04.2 LTS locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC

Profile for merMod objects (lme4)

让人想犯罪 __ 提交于 2019-12-23 06:00:57
问题 I am not understanding how does profile work in lmer ? Sometimes it gives exactly same number of values as total number of observations, and sometimes fewer or higher than total number of observations. Also what is .zeta in the output of profile? (2) Again pp <- profile(fitted,"theta_",quiet=TRUE)#fitted is a fitted model is giving values for every random and fixed effects, but cc <- confint(pp) is producing confidence interval for only variance-components. Why ? In ?profile documentation, I

Calculating CIs of fixed effects using confint in R

狂风中的少年 提交于 2019-12-23 04:29:19
问题 I would like to perform bootstrapping to obtain 95% Cis of my fixed effects in a binomial GLMM: m <- glmer(cbind(df$Valid.detections, df$Missed.detections) ~ distance + Habitat + Replicate + transmitter.depth + receiver.depth + wind.speed + wtc + Transmitter + (1 | Unit) + (1 | SUR.ID) + distance:Transmitter + distance:Habitat + distance:transmitter.depth + distance:receiver.depth + distance:wind.speed, data = df, family = binomial(link=logit),control=glmerControl(calc.derivs=F)) I found that

Generating predictive simulations from a multilevel model with random intercepts

本秂侑毒 提交于 2019-12-23 03:07:30
问题 I am struggling to understand how, in R, to generate predictive simulations for new data using a multilevel linear regression model with a single set of random intercepts. Following the example on pp. 146-147 of this text, I can execute this task for a simple linear model with no random effects. What I can't wrap my head around is how to extend the set-up to accommodate random intercepts for a factor added to that model. I'll use iris and some fake data to show where I'm getting stuck. I'll

How to plot mixed-effects model estimates in ggplot2 in R?

隐身守侯 提交于 2019-12-22 17:28:15
问题 I have a 2x2x2 factorial design with one random effect. The data (dat) is as follows: colour size level marbles set Blue Large Low 80 1 Blue Large High 9 2 Blue Small Low 91 1 Blue Small High 2 1 White Large Low 80 2 White Large High 9 1 White Small Low 91 2 White Small High 2 1 I want to plot two models: mod1 <- lmer(marbles ~ colour + size + level + colour:size + colour:level + size:level + (1|set), data = dat) mod2 <- lmer(marbles ~ colour + size + level +(1|set), data = dat) I usually use

Back-transform coefficients from glmer with scaled independent variables for prediction

安稳与你 提交于 2019-12-22 12:56:09
问题 I've fitted a mixed model using the lme4 package. I transformed my independent variables with the scale() function prior to fitting the model. I now want to display my results on a graph using predict() , so I need the predicted data to be back on the original scale. How do I do this? Simplified example: database <- mtcars # Scale data database$wt <- scale(mtcars$wt) database$am <- scale(mtcars$am) # Make model model.1 <- glmer(vs ~ scale(wt) + scale(am) + (1|carb), database, family =

Plotting Regression results from lme4 in R using Lattice (or something else)

主宰稳场 提交于 2019-12-22 10:59:51
问题 I have fit a regression using lme4 thanks to a previous answer. Now that I have a regression fit for each state I'd like to use lattice to plot QQ plots for each state. I would also like to plot error plots for each state in a lattice format. How do I make a lattice plot using the results of a lme4 regression? Below is a simple sample (yeah, I like a good alliteration) using two states. I would like to make a two panel lattice made from the object fits. library(lme4) d <- data.frame(state=rep

glmer with user-defined link function giving error: (maxstephalfit) PIRLS step-halvings failed to reduce deviance

六眼飞鱼酱① 提交于 2019-12-22 10:58:16
问题 While attempting to leverage a user-defined link function with a random-effect glmer, I've run into an error that I don't know how to troubleshoot: Error: (maxstephalfit) PIRLS step-halvings failed to reduce deviance in pwrssUpdate Does anyone have any advice on how one might approach resolving this error? It doesn't provide much direction. I've attempted to follow the instructions for defining a new link function (specifically a scaled logit) as outlined at rpubs.com/bbolker/logregexp, but I