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
4
votes
1 answer

Tricks for fitting data in nlme?

When I fit data in nlme, I never succeed on the first try, and after nlme(fit.model) I am accustomed to seeing things such as: Error in nlme.formula(model = mass ~ SSbgf(day, w.max, t.e, t.m), random = list( : step halving factor reduced below…
Nazer
  • 3,654
  • 8
  • 33
  • 47
3
votes
2 answers

Getting Generalized Least Squares Means for fixed effects in nlme or lme4

Least Squares Means with their standard errors for aov object can be obtained with model.tables function: npk.aov <- aov(yield ~ block + N*P*K, npk) model.tables(npk.aov, "means", se = TRUE) I wonder how to get the generalized least squares means…
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
3
votes
2 answers

How to set phi per group using nlme in R?

When specifying a value as phi using fixed = TRUE, how can I set a fixed value for each Subject (e. g. value = 0.7 for Subject 1, value = 0.5 for Subject 2 etc.)? library(nlme) mod <- gls(rate ~ pressure, data = Dialyzer, corr…
erc
  • 10,113
  • 11
  • 57
  • 88
3
votes
1 answer

reference category in varIdent function (nlme package) depends on data order

I found that function varIdent has an undesired behavior which is dependent on data order. In detail, the reference category depends on data order, see the next example set.seed(123) library(tidyverse) library(nlme) #> #> Attaching package:…
Nicolas Molano
  • 693
  • 4
  • 15
3
votes
1 answer

Issues predicting with `nlme::gls`quadratic model fitted with `poly(..., 2)`

I have fitted a quadratic model with a variance structure that allows different variance levels per level of a factor, and I’m having trouble predicting on a new data set with 2 entries only. Here’s a reproducible…
Ceres
  • 163
  • 7
3
votes
1 answer

Heterocesdastic model of mixed effects via lmer function

I am adjusting a mixed effects model which, due to the observed heteroscedasticity, it was necessary to include an effect to accommodate it. Therefore, using the lme function of the nlme package, this was easy to be solved, see the code…
user55546
  • 37
  • 1
  • 15
3
votes
1 answer

Instability of nonlinear mixed effects (using nlme package) in R

I am attempting to build a nonlinear mixed effects model for COVID-19 data that fits a bell curve to daily case numbers from different countries (random effects being at the country level). The data table is too large to include in the post but here…
bob
  • 610
  • 5
  • 23
3
votes
0 answers

Syntax for diagonal variance-covariance matrix for non-linear mixed effects model in nlme

I am analysing routinely collected substance use data during the first 12 months' of treatment in a large sample of outpatients attending drug and alcohol treatment services. I am interested in whether differing levels of methamphetamine use (no…
llewmills
  • 2,959
  • 3
  • 31
  • 58
3
votes
1 answer

Heteroscedastic residuals plot not matching plot shown in Pinhiero and Bates

I am having trouble making a plot of standarised residuals versus a covariate match a plot shown in Pinhiero and Bates Mixed-Effects Models in S and S-Plus. The model being plotted is a general formulation of a nonlinear mixed-effects model,…
llewmills
  • 2,959
  • 3
  • 31
  • 58
3
votes
1 answer

Trouble with Convergence in Non-Linear Mixed-Effects Model from Pinheiro and Bates

My ongoing problems (see here and here) making the nonlinear mixed effects models in Chapter 8 of Pinheiro and Bates converge continue. This time with the Quinidine dataset (p. 385). Once again this is an iterative model-building exercise. I am…
llewmills
  • 2,959
  • 3
  • 31
  • 58
3
votes
1 answer

Extracting confidence intervals from lme model

I have to make some transformations on the confidence intervals of multiple large models made with the lme() function from the nlme package. I'm using the intervals() function to get the intervals, however it is not possible to turn it into a…
3
votes
1 answer

Error message in nlme example present in R but not in S

I am working through Mixed Effects Models in S and S-Plus in R but some of the code does not produce the results in-text. In Chapter 6 one of the examples fails to converge with the code supplied. The example is a non-linear mixed effects model…
llewmills
  • 2,959
  • 3
  • 31
  • 58
3
votes
1 answer

R: HUGE memory requirement applying variance structure to gls in nlme package

I created a model using the gls function of the nlme package in R. I then attempted to add fixed variance structure to the model using the weights argument. However, I get an error about memory allocation that just seems, well, extreme. Error in…
theforestecologist
  • 4,667
  • 5
  • 54
  • 91
3
votes
1 answer

User-Defined Function for lme model fits: error

I am beginning to write a function that builds linear mixed models with nlme. I am encountering an error: Error in eval(expr, envir, enclos) : object 'value' not found, which I believe is due to R not knowing where to find the data frame variables…
3
votes
1 answer

syntax of pdBlocked to specify covariance matrix in mixed-effects model nlme

I have a mixed-effects model and I want to drop some of my correlations in my random-effects covariance matrix to reduce my dof. To do this I think I should use pdBlocked but can't get the correct syntax to get specifically what I want. Example…
user63230
  • 4,095
  • 21
  • 43