lme4

How can I sort random effects by value of the random effect (not the intercept) in dotplot or ggplot2

只谈情不闲聊 提交于 2019-12-04 15:03:22
I suspect the answer to this question is rather simple and I just don't know what it is. Long story short, I want to display a dotplot of the random intercepts and slopes from a model I am estimating. I'm using the ggCaterpillar function helpfully introduced here . However, this function, as well as the standard dotplot from lattice, sort the ensuing graph by decreasing order of the random intercept. I would like to sort the graph by increasing value of the random effect (either alphabetical or numerical). Consider this minimum working example that comes standard in the lme4 package, along

glmer model from early 2013: warning message about convergence when re-running it

倖福魔咒の 提交于 2019-12-04 14:27:59
More than 1 year ago (Feb 2013), I had used lmer to run a mixed effect model involving a binomial outcome with the following command: nl3.lmer <- glmer( cul.bi ~ food.act + where + intlan + inter.cul + via.m + via.h + (1|Id), data=drm, family=binomial) Everything had worked fine, without any error or warning messages and I had presented my results. When trying to look at it today I ran into two problems: 1) summary(nl3.lmer) Length Class Mode 1 mer S4 ...instead of the usual summary. Is it because of the change of class from a mer object to a merMod object? I read something about that change

R: analyzing multiple responses (i.e. dependent variables) in a mixed effects model (lme4)

会有一股神秘感。 提交于 2019-12-04 11:54:24
I have a, what I thought, really simple question. In a longitudinal experiment with a group of participants has everyone rated everyone else on, let's say, 10 variables (e.g. "This person is likeable.", "This person is dull." and so on) at 7 different times. If i want to get some sort of perceiver and target variance for one variable/response I'd use: lmer(scale(Var1) ~ (1|target) + (1|perceiver), data= subset(x, time_point == 1)) Here we have a dependent variable "Var1" of a dataframe "x" with the specification of the 1st time_point (which is also a variable of x). So far so good, this works

Speed up lmer function in R

半腔热情 提交于 2019-12-04 08:28:25
问题 I would like to share some of my thoughts when trying to improve the model fitting time of a linear mixed effects model in R using the lme4 package. Dataset Size: The dataset consists, approximately, of 400.000 rows and 32 columns. Unfortunately, no information can be shared about the nature of the data. Assumptions and Checks: It is assumed that the response variable comes from a Normal distribution. Prior to the model fitting process, variables were tested for collinearity and

fitting a linear mixed model to a very large data set

我怕爱的太早我们不能终老 提交于 2019-12-04 07:21:13
I want to run a mixed model (using lme4::lmer ) on 60M observations of the following format; all predictor/dependent variables are categorical (factors) apart from the continuous dependent variable tc ; patient is the grouping variable for a random intercept term. I have 64-bit R and 16Gb RAM and I'm working from a central server. RStudio is the most recent server version. model <- lmer(tc~sex+age+lho+atc+(1|patient), data=master,REML=TRUE) lho sex tc age atc patient 18 M 16.61 45-54 H 628143 7 F 10.52 12-15 G 2013855 30 M 92.73 35-44 N 2657693 19 M 24.92 70-74 G 2420965 12 F 17.44 65-69 A

How to compute standard errors for predicted data

佐手、 提交于 2019-12-04 06:00:53
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 5 years ago . I am trying to generate standard errors for predicted values. I use the below code to generate the predicted values but it fails to also give the standard errors. ord6 <- veg$ord1-2 laimod.group = lmer(log(lai+0.000019) ~ ord6*plant_growth_form + (1|plot.code) + (1|species.code), data=veg, REML=FALSE) summary(laimod.group) new.ord6 <- c(-1,0,1,2,3,4,5,6,7) new.plant_growth_form

Is there a way of getting “marginal effects” from a `glmer` object

无人久伴 提交于 2019-12-03 19:09:03
问题 I am estimating random effects logit model using glmer and I would like to report Marginal Effects for the independent variables. For glm models, package mfx helps compute marginal effects. Is there any package or function for glmer objects? Thanks for your help. A reproducible example is given below mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv") mydata$rank <- factor(mydata$rank) #creating ranks id <- rep(1:ceiling(nrow(mydata)/2), times=c(2)) #creating ID variable mydata

rank deficiency warning mixed model lmer

允我心安 提交于 2019-12-03 17:20:13
I have a dataset with 142 data entries: 121 individuals measured on two occasions (two years, before and after treatment, Year = 0 or 1), in the second year 46 individuals were in treated plots and the rest were in control plots (treatment = 0 or 1). Here's some example data: ID <- c("480", "480", "620", "620","712","712") Year <- c("0", "1", "0", "1","0", "1") Plot <- c("14", "14", "13", "13","20","20") Treat <- c("0", "0", "0", "1", "0", "1") Exp <- c("31", "43", "44", "36", "29", "71") ExpSqrt <- c("5.567764", "6.557439", "6.633250", "6.000000", "5.385165", "8.426150") Winter <- data.frame

glmer - predict with binomial data (cbind count data)

感情迁移 提交于 2019-12-03 15:03:23
I am trying to predict values over time (Days in x axis) for a glmer model that was run on my binomial data. Total Alive and Total Dead are count data. This is my model, and the corresponding steps below. full.model.dredge<-glmer(cbind(Total.Alive,Total.Dead)~(CO2.Treatment+Lime.Treatment+Day)^3+(Day|Container)+(1|index), data=Survival.data,family="binomial") We have accounted for overdispersion as you can see in the code (1:index). We then use the dredge command to determine the best fitted models with the main effects (CO2.Treatment, Lime.Treatment, Day) and their corresponding interactions.

Better fits for a linear model

依然范特西╮ 提交于 2019-12-03 13:56:32
问题 I am fitting some lines and I feel like I am telling R exactly how to fit them, but I feel like there is something (some factor or effect) I am unaware of that is preventing a good fit. My experimental unit is "plot" as in field plot, which I am sorry is confusing. The data can be found: https://www.dropbox.com/s/a0tplyvs8lxu1d0/rootmeansv2.csv . with df$plot.f<-as.factor(df$plot) dfG<-groupedData(mass ~ year|plot.f, data=df) dfG30<-dfG[dfG$depth == 30,] Simply, I have mass over time and I