Questions tagged [lmer]

Function of the lme4 package for running linear mixed-effects regressions.

Function of the package for running linear mixed-effects regressions.

88 questions
4
votes
1 answer

random effects variance of intercept being zero

I am running a power analysis using a normal LMM in R. I have seven input parameters, two of which I do not need to test for (no. of years and no. of sites). The other 5 parameters are the intercept, slope and the random effects standard deviation…
user3628889
  • 271
  • 1
  • 5
  • 10
4
votes
1 answer

Why is rmvnorm() function returning "In sqrt(ev$values) : NaNs produced", what is this error and how can it be corrected or avoided?

I am working with financial/economic data in case you are wondering about the large size of some of the coefficients below... My general question has to do with the simulation of parameter coefficients output from a linear random effects model in R.…
DV Hughes
  • 305
  • 2
  • 5
  • 22
4
votes
1 answer

Error when trying to run lmer() in R

So here's my problem. I have a data set in R that I need to run a mixed effects model on. Here's the code: data <- read.csv("D:/blahblah.csv") analysis.data <- lmer(intdiff ~ stress_limit * word_position * follows + (1|speaker),…
Shakesbeery
  • 249
  • 1
  • 6
  • 18
3
votes
1 answer

dotplot_diag for cooks distance (lmer model) - subject value instead of index

I'm using the tools in the HLMdiag package to look at diagnostics for a model fitted by lmer. I have a question about the dotplot_diag function for plotting cooks distances. Here's an example of what I'm doing. mod <-…
msoftrain
  • 1,017
  • 8
  • 23
3
votes
1 answer

How to (quickly) extract t values from lmer model in lme4?

I am working with a script that calls lmer function of the lme4 package thousands of times (do not worry, relevant correction for multiple comparisons is performed later) and would like to save as much time during a single call as possible. I…
mmagnuski
  • 1,249
  • 1
  • 11
  • 23
3
votes
1 answer

predict() in lmer regression, but I need it only 2 categories

I am attempting to estimate a multilevel model. My code is: fullModel2 <- lmer(pharmexp_2001 ~ gdp_1000_gm + health_exp_per_cap_1000_gm + life_exp + labour_cost_1000_gm + (year_gm|lowerID), data=adat, REML=F) which results in the…
3
votes
3 answers

How to run a model for multiple variables(columns) in df with lmer

I have several variables(columns) in a df I want to run lmer (from lme4 package). Say I have a dataframe called df: par1 par2 resp1 resp2 plant1 rep1 3 8 plant2 rep2 5 2 ... I'm trying to write a function to do this, but having trouble…
Paul
  • 475
  • 8
  • 17
3
votes
2 answers

Why is there a dramatic difference between aov and lmer?

I have a mixed model and the data looks like this: > head(pce.ddply) subject Condition errorType errors 1 j202 G O 0.00000000 2 j202 G P 0.00000000 3 j203 G O 0.08333333 4 j203 …
user3166738
  • 31
  • 1
  • 2
3
votes
1 answer

anova() does not display p-value when used with lmerTest

I'm trying to use lmerTest to have p-values for my fixed effects. I have 4 different random intercepts, 3 crossed and one nested : test.reml <- lmerTest::lmer(y ~ s1 + min + cot + min:cot + ge + vis + dur + mo + nps + dist + st1 + st2 + di1 +…
3
votes
1 answer

How to modify slots lme4 >1.0

I have been using the code below to successfully modify the 'Zt', 'L', and 'A' slots of models fit using lme4 versions <1.0. I just updated to lme4 1.0-4 today and found that the model objects are different. Can anyone provide insight/guidance as to…
3
votes
3 answers

invalid grouping factor specification in lmer model

I am attempting to run a mixed effects model using the lmer function. My experiment included metabolic rates at different temperatures using some of the same individuals (some missing data). The structure of the textfile looks like this: >…
user2817123
  • 39
  • 1
  • 1
  • 2
2
votes
1 answer

output lmer summary information to word using ReporteRs

I am using the package ReporteRs in R to output the results of statistical tests, and plots, to Word 2010. I'm using lmer in the lme4 package to do some analysis, and I would like to output the results of summary(foo.lmer) to Word. I wish to capture…
Michelle
  • 1,281
  • 2
  • 16
  • 31
2
votes
2 answers

plot lmer result in faceted ggplot

I'm analysing some repeated measures drug trials data and I'm not sure how to plot the lmer results when using faceted ggplots. I have made an initial plot of the individual slopes from the master dataset, but I'm doing the lmer analyses separately…
Michelle
  • 1,281
  • 2
  • 16
  • 31
2
votes
1 answer

Non-linear random-effects regression with multiplication of coefficients in R

I have two regression models without random effects: one is OLS using lm, the other includes multiplication of coefficients using nle. I wish to add individual-level random effects to both. I've managed to do this for the OLS function using the lme4…
2
votes
1 answer

How to get a prediction interval for a lmer object?

I've surfed the web and haven't found a satisfactory answer for this. How would I generate a prediction interval for from a lmer object for each observation in the test dataset? train_ind <- sample(seq(1:nrow(iris)), size = nrow(iris)/2, replace =…
goldisfine
  • 4,742
  • 11
  • 59
  • 83