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
0 answers

warning: non-list contrasts argument ignored

I am running a gamm using the 'mgcv' package in R: additive.model.saturated <- gamm(log.titer ~ condition + Age_month_selective + Season.2 + s(capture.month, bs = "cc", k = 12) + …
margie
  • 21
  • 3
2
votes
1 answer

Multiple Random Slopes and Multiple Random Intercepts In lme with Nested Variables

I need to write a model in R by using nlme library with multiple random intercepts and slopes. What I need is: Random intercept for Participants, Random intercept for TargetID, Random slope to see how the effect of OrderofImages varies across…
Yesim
  • 193
  • 1
  • 1
  • 7
2
votes
0 answers

LMM model with nested design and random slopes (nlme package) cannot run with autocorrelation term

Despite many efforts, I cannot run a linear mixed model because of the autocorrelation term. In fact, I can't manage to code for both a nested design and random slopes within it. For example, let's imagine some monthly captures of wild rabbits in…
J.marine
  • 69
  • 1
  • 8
2
votes
1 answer

Plotting an nlme object in ggplot2

I calculated a linear-mixed model using the nlme package. I was evaluating a psychological treatment and used treatment condition and measurement point as predictors. I did post-hoc comparisons using the emmans package. So far so good, everything…
2
votes
0 answers

Singularity Error when using gls function in R

I am using the gls function from the nlme package in R to fit a linear model to data on skull shape across certain snake species (dependent variable) and habitat and diet (explanatory variables). I was able to successfully get results from this, but…
GregP
  • 21
  • 1
2
votes
2 answers

Nonlinear mixed effect models with self-starting function and purrr

I have used nlme to fit and compare nonlinear models in the past. I would now like to use it to fit models to data that are grouped by more than one identifier. It would be great if I could integrate dplyr, purrr, and nlme. One of the nice things…
Nazer
  • 3,654
  • 8
  • 33
  • 47
2
votes
1 answer

specify different random structures for subsets within the same mixed model?

I would like to do a meta-model using data from different experiments with different blocking structures. For this, I would need to specify the different blocking structure (random effects structure) for the data from each experiment within the same…
corn_bunting
  • 349
  • 1
  • 11
2
votes
0 answers

How to select self starting values for nlme growth curve?

I'm running a self-starting 3-parameter logistic model using nlme and would like clarification in how starting values should be chosen when there are covariates in the model. Create an example data frame: sampledf <- tibble( age =…
S.Bird
  • 102
  • 8
2
votes
0 answers

Why can I compute a mixed model with lme, but not with lmer?

I'm attempting to run a mixed model in R with the lme4 package. library(lme4) m1 <- lmer(rt2 ~ condition + rt1 + condition*rt1 + (1 | subj) , data = df) I get the following error message: "Error: number of levels of each grouping factor must be <…
denise
  • 21
  • 3
2
votes
1 answer

Model failure for nonlinear mixed-effects model from Pinhiero and Bates

I have been working through Mixed-Effects Models in S and S-Plus by Pinhiero and Bates and am discovering a lot of problems making the models in the book work. The latest is this, using a constant plus power function to model heteroscedastic…
llewmills
  • 2,959
  • 3
  • 31
  • 58
2
votes
1 answer

Trouble with achieving convergence in nonlinear mixed-effects model in Pinhiero and Bates book

I am working through Pinhiero and Bates' book Mixed Effects Models in S and S-Plus in R. I am having trouble getting a model in Chapter 8 (p. 387) to converge. library(nlme) fm1Wafer.nlmeR <- nlme(current ~ A + B * cos(4.5679 * voltage) + C *…
llewmills
  • 2,959
  • 3
  • 31
  • 58
2
votes
0 answers

Evaluating the score function at the MLEs for an lme model in nlme and R

As a sanity check for later goals, I am trying to understand how components of an lme object are related. I am trying to evaluate the score functions at the MLEs obtained from a lme object created using gamm to check that they are equal to zero.…
2
votes
0 answers

Multiple random effects without interaction in nlme::lme

Let consider this simple model consisting in two independent random effects: $$y_{ijk} = \mu + \delta1_i + \delta2_j + \epsilon_{i,j,k}$$ where \delta1_i and \delta2_j are independent random effect (i.e. \delta1_i \sim N(0,\sigma_1^2) iid,…
beuhbbb
  • 257
  • 3
  • 14
2
votes
0 answers

comparing mixed models in python

I'm trying to compare two models using R's nlme package import rpy2.robjects.robject as r >> politeness = pd.read_csv('http://www.bodowinter.com/tutorial/politeness_data.csv') >> mdl1=nlme.gls(Formula('frequency ~ 1'), data=politeness, method="ML",…
HappyPy
  • 9,839
  • 13
  • 46
  • 68
2
votes
2 answers

Estimating logsitic parameters and random effects with nlme

I have managed to fit logistic curves to fit growth models for 129 fish belonging to 3 groups. Unfortunately the parameters I got were not consistent and very often the models I tried have crashed. Therefore I've simulated a data set on which I've…
Max13
  • 21
  • 1