Questions tagged [nlme]

An R package for fitting Non-Linear Mixed Effects statistical models.

An package for fitting Non-Linear Mixed Effects statistical models ().

Repositories

Books

Other resources

Related tags

494 questions
2
votes
1 answer

How to get two random effects crossed with one nested in the other in nlme?

My nonlinear mixed-effects model regresses body mass (bm) on age. I would like consider that brood is nested within year, but as a brood can only occur in one of the seven years that are in the dataset, the random effects of year and brood should be…
2
votes
0 answers

Overriding the marginality constraint in dredge from Mumln R-package

Quick question - is there any possible way of overriding the "marginality constraint" that is imposed by default using dredge in the MuMln R-package? I am wanting to force dredge to consider all possible regression subsets, irrespective of whether…
TJC
  • 41
  • 4
2
votes
1 answer

ggplot2 plot two data sets into one picture

this must be a FAQ, but I can't find an exactly similar example in the other answers (feel free to close this if you can point a similar Q&A). I'm still a newbie with ggplot2 and can't seem to wrap my head around it quite so easily. I have 2…
2
votes
1 answer

Plotting individual confidence intervals for the coefficients in the lmList fit

I'm trying to solve an exercise from Pinheiro and Bates book (Mixed-Effects Models in S and S-PLUS) using R. It uses data Pixel from nlme package. The exercise says: Use lmList to fit a separate quadratic model in day for each Dog. Plot the…
Marija T.
  • 53
  • 1
  • 7
2
votes
1 answer

Random-effects on demeand data

Folks, I'm trying to fit a model in R using lme() from the {nlme} package with many fixed effects and additional random effects (gotta be {nlme} since I also want to include an AR(1) correlation matrix later on). However, the model is terribly slow…
Chris
  • 1,479
  • 2
  • 15
  • 19
2
votes
0 answers

How do I code a Mixed effects model for abalone growth in Aquaculture nutrition with nested individuals

I am a biologist working in aquaculture nutrition research and until recently I haven't paid much attention to the power of statistics. The usual method of analysis had been to run ANOVA on final weights of animals given various treatments and boom,…
MorgsMidae
  • 21
  • 1
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
2 answers

Plotting predicted values from a lme model (with polynomials) in R

I am using linear mixed-effect model (run with the lme() function in the nlme package in R) that has one fixed effect, and one random intercept term (to account for different groups). The model is a cubic polynomial model specified as so (following…
jjulip
  • 1,093
  • 4
  • 16
  • 24
2
votes
0 answers

How can I specify 'unstructured' in lme function?

I'm trying to fit a mixed model in R. Actually I have a Stata code and want to do the same thing using R. The Stata code is xtmixed laz c.x1##i.j4alloc_n c.x2##i.j4alloc_n ||childuid:age_m, cov(uns) var I can't find how to specify 'unstructured'…
user67275
  • 1
  • 9
  • 38
  • 64
2
votes
2 answers

How to use substitute() to loop lme functions from nlme package?

I am trying to use lme function from nlme package inside a lapply loop. This works for lmer function from lme4 package, but produces an error message for lme. How can I loop lme functions similarly to the lmer function in the example…
Mikko
  • 7,530
  • 8
  • 55
  • 92
2
votes
1 answer

How to plot a binary mixed effect model for visual presentation

I am trying to plot the result of a binary mixed effect model for visual representation in a paper. I use lme to fit the mixed model: M2 <- lme(Pass ~ zone.time + length + Fat, random =~ 1 | Year) Pass = binary 1/0 zone.time, length & Fat =…
Salmo salar
  • 517
  • 1
  • 5
  • 17
2
votes
1 answer

How to code contrasts in lme4 or nlme?

I am looking for the most efficient way to run contrasts in R when using lme4. I have been working with a stats consultant that I really trust and she has given me the following code. I have contrasts between 6 treatments and I run these contrasts…
Nazer
  • 3,654
  • 8
  • 33
  • 47
2
votes
2 answers

standard error of outcome in lm and lme

I have the following linear models library(nlme) fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) fm2.lm <- lm(distance ~ age + Sex,data = Orthodont) How can I obtain the standard error of distance with age and Sex?
ECII
  • 10,297
  • 18
  • 80
  • 121
2
votes
1 answer

lme makes Rstudio crash and pc nonresponsive after increasing memory limit

I am working with a data set of 205 observations and 2 explanatory variables : site (two levels) and strain ( 21 levels ). I am trying to fit a mixed model to the data when strain is the fixed variable. the experiment is not balanced ( i.e. there…
ImanJ
  • 23
  • 5
2
votes
1 answer

mixed effect model with repeated measures

I am trying to develop a mixed effects model on a data set with repeated measures. Met is measured on a series of randomly selected days on 24 samples submitted to 3 treatments (Treat, with levels c, uc and ga). The levels of Met change due to…
thijs van den bergh
  • 608
  • 1
  • 9
  • 17