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
41
votes
2 answers

Linear mixed model with crossed repeated effects and AR1 covariance structure, in R

I have within-subject physiological data from participants (part), who have all looked at stimuli (reading newspapers) on three rounds (round), which each have five papers (paper), and within each there are variable number of visits (visit) in the…
RandomMonitor
  • 439
  • 1
  • 8
  • 16
31
votes
4 answers

Error in na.fail.default: missing values in object - but no missing values

I am trying to run a lme model with these…
InverniE
  • 598
  • 1
  • 7
  • 21
23
votes
2 answers

How to compare a model with no random effects to a model with a random effect using lme4?

I can use gls() from the nlme package to build mod1 with no random effects. I can then compare mod1 using AIC to mod2 built using lme() which does include a random effect. mod1 = gls(response ~ fixed1 + fixed2, method="REML", data) mod2 =…
It Figures
  • 403
  • 1
  • 3
  • 11
19
votes
2 answers

How to obtain Hessian from nlme call

library(nlme) fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc), data = Loblolly, fixed = Asym + R0 + lrc ~ 1, random = Asym ~ 1, start = c(Asym = -10311111, R0 = 8.5^4, lrc = 0.01), verbose…
Adrian
  • 9,229
  • 24
  • 74
  • 132
9
votes
1 answer

Fitting the same models in nlme and lme4

The data are from here library(nlme) dat0 <- read.table("aids.dat2",head=T) dat1 <- dat0[dat0$day<=90, ] # use only first 90-day data dat2 <- dat1[!apply(is.na(dat1),1,any),] # remove missing data # Next, let's treat the data as longitudinal…
Adrian
  • 9,229
  • 24
  • 74
  • 132
9
votes
1 answer

Solving error message "step halving factor reduced below minimum in NLS step": adjusting nlsTols not working

I am trying to fit a logistic growth curve to some data using the gnls function. Data: structure(list(Nest = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 16L, 10L, 4L, 5L, 7L, 12L,…
Andrew
  • 516
  • 1
  • 6
  • 17
8
votes
2 answers

non linear regression with random effect and lsoda

I am facing a problem I do not manage to solve. I would like to use nlme or nlmODE to perform a non linear regression with random effect using as a model the solution of a second order differential equation with fixed coefficients (a damped…
denis
  • 5,580
  • 1
  • 13
  • 40
8
votes
1 answer

Are random effect variables automatically taken as factors in lmer (or lme) in R?

I understand that having a continuous or numeric variable as a random effect in a mixed effects model doesn't make much sense (e.g., see here). But what I'm wondering is if lme4::lmer or nlme::lme in R purposefully prevent you from doing…
theforestecologist
  • 4,667
  • 5
  • 54
  • 91
8
votes
2 answers

package car unable to load, wrong version of nlme

When I try to load the 'car' package I get this error: library(car) Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : namespace 'nlme' 3.1-122 is already loaded, but >= 3.1.123 is required Error: package or…
Jon Sjöberg
  • 159
  • 1
  • 7
8
votes
1 answer

Allowing correlation parameters in gls to depend on grouping factor

Below there's a MWE of the issue I'm encountering. I'm using the Orthodont dataset from the nlme package which consists of 4 measurements for 27 children (16 girls, 11 boys). To model the correlation I'm using an unstructured covariance structure by…
johansteen
  • 318
  • 1
  • 9
8
votes
2 answers

Extracting coefficients and their standard error for each unit in an lme model fit

How could I extract coefficients (b0 and b1) with their respectively standard errors for each experimental unit (plot )in a linear mixed model such as this one: Better fits for a linear model with this same dataset(df), and for the fitted model…
Juanchi
  • 1,147
  • 2
  • 18
  • 36
8
votes
1 answer

How to fit two random effects separately in lme?

I'm doing Linear mixed-effects model fit by REML in nlme package. And these are codes that work for me: # Linear mixed-effects model fit by REML (intercept and not slope) x <- lme (DV ~ IV1 + IV2 + IV1*IV2, data=a.frame,…
user3288202
  • 313
  • 1
  • 4
  • 14
7
votes
1 answer

`nlme` with crossed random effects

I am trying to fit a crossed non-linear random effect model as the linear random effect models as mentioned in this question and in this mailing list post using the nlme package. Though, I get an error regardless of what I try. Here is an…
7
votes
1 answer

Plotting a list of non linear regressions with ggplot

As an output plot of the non-linear regression analysis from this link https://stats.stackexchange.com/questions/209087/non-linear-regression-mixed-model With this dataset: zz <-(" iso temp diam Itiquira 22 5.0 Itiquira 22 4.7 Itiquira …
Juanchi
  • 1,147
  • 2
  • 18
  • 36
7
votes
1 answer

How to specify different random effects in nlme vs. lme4?

I want to specify different random effects in a model using nlme::lme (data at the bottom). The random effects are: 1) intercept and position varies over subject; 2) intercept varies over comparison. This is straightforward using lme4::lmer:…
Mark Heckmann
  • 10,943
  • 4
  • 56
  • 88
1
2 3
32 33