mixed-models

rank deficiency warning mixed model lmer

无人久伴 提交于 2019-12-05 02:55:57
问题 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")

How to report with APA style a Bayesian Linear (Mixed) Models using rstanarm?

守給你的承諾、 提交于 2019-12-05 02:27:59
问题 I'm currently struggling with how to report, following APA-6 recommendations, the output of rstanarm::stan_lmer() . First, I'll fit a mixed model within the frequentist approach, then will try to do the same using the bayesian framework. Here's the reproducible code to get the data: library(tidyverse) library(neuropsychology) library(rstanarm) library(lmerTest) df <- neuropsychology::personality %>% select(Study_Level, Sex, Negative_Affect) %>% mutate(Study_Level=as.factor(Study_Level),

multinomial mixed logit model mlogit r-package

北城余情 提交于 2019-12-04 23:52:52
问题 I discovered the mlogit -package for multinomial logit models in search of estimating a multinomial mixed logit model. After reading the excellent vignette I discovered that I could not apply my data on any of the described examples. I now write in hope of help with my problem and created a minimal example to illustrate my situation. The Problem is as follows: There are words with the consonant 'Q' somewhere. Now an experiment was conducted with people who were tasked to listen to these words

Prediction with lme4 on new levels

﹥>﹥吖頭↗ 提交于 2019-12-04 21:09:05
问题 I'm trying to fit a mixed effects model and then use that model to generate estimates on a new dataset that may have different levels. I expected that the estimates on a new dataset would use the mean value of the estimated parameters, but that doesn't seem to be the case. Here's a minimum working example: library(lme4) d = data.frame(x = rep(1:10, times = 3), y = NA, grp = rep(1:3, each = 10)) d$y[d$grp == 1] = 1:10 + rnorm(10) d$y[d$grp == 2] = 1:10 * 1.5 + rnorm(10) d$y[d$grp == 3] = 1:10

lme4::glmer vs. Stata's melogit command

社会主义新天地 提交于 2019-12-04 19:36:42
问题 Lately I have been trying to fit a lot of random effects models to relatively big datasets. Let’s say about 50,000 people (or more) observed at up to 25 time points. With such a large sample size, we include a lot of predictors that we’re adjusting for – maybe 50 or so fixed effects. I’m fitting the model to a binary outcome using lme4::glmer in R, with random intercepts for each subject. I can't go into specifics on the data, but the basic format of the glmer command I used was: fit <- glmer

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

Dredge with the global model failing to converge

主宰稳场 提交于 2019-12-04 02:52:42
问题 I am trying to run gamm models with multiple variable combinations in dredge (MuMIn) framework, with a cutoff based TRUE/FALSE correlation matrix as subset. Problem is, my full model is quite complex with random effects, >20 predictor variables including 3 fixed effects, and therefore won't converge. My predictors are highly correlated, as mentioned I included a TRUE/FALSE correlation matrix as subset. Due a low correlation cutoff I expect very few combinations and not really interested in

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