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

Get a clean summary of nlme.lme() or lme4.lmer() in RPy

I am interfacing with the nlme and lme4 R functions via RPy, and I would like to get access to an output summary from my python console. I run the following code: test1=nlme.lme(r.formula('Pupil~CoI*Time'),…
TheChymera
  • 17,004
  • 14
  • 56
  • 86
5
votes
2 answers

lmer error: grouping factor must be < number of observations

I am attempting to run a mixed effect model on some data but struggling with one of the fixed effects, I think primarily due to it a factor?! Sample data: data4<-structure(list(code = structure(1:10, .Label = c("10888", "10889", "10890", "10891",…
Salmo salar
  • 517
  • 1
  • 5
  • 17
4
votes
1 answer

Tests for Variance Components - mixed model

See the following situation: Ok, based on this, I have fitted the following models above in R (however, I am not sure if these models are right): library(nlme) model1 <- lm(Y ~ Treatm * VarT, data = datarats) model2 <- lme(Y ~ Treatm * VarT, data =…
user55546
  • 37
  • 1
  • 15
4
votes
1 answer

Modeling longitudinal correlation correctly with nlme when there are missing outcomes (R)

I have longitudinal data in long format which look, for the first two subjects, like this: id X M Y 1 1 0 M1 2.53 2 1 0 M2 1.45 3 1 0 M3 1.17 4 1 0 M5 0.78 5 1 0 M7 -0.95 6 1 0 M9 -0.07 7 2 1 M1 -0.81 8 2 1 M2 -1.66 9 2 1 M3…
tomka
  • 2,516
  • 7
  • 31
  • 45
4
votes
1 answer

Getting estimated means after multiple imputation using the mitml, nlme & geepack R packages

I'm running multilevel multiple imputation through the package mitml (using the panimpute() function) and am fitting linear mixed models and marginal models through the packages nlme and geepack and the mitml:with() function. I can get the…
n00n
  • 41
  • 3
4
votes
1 answer

Nested random effects and related fixed effects

I have cross-national panel data and I'd like to know the impact of IV on a binary student-level outcome DV I'd like to include a nested random effect that takes into account that which school the student is in will affect the outcome, and that…
4
votes
1 answer

Algorithm name in nlminb's PORT routines?

I'm using gnls function of nlme package to fit a curve. When I try to know what optimizer it was using, I was directed to nlminb function documentation and it states: Unconstrained and box-constrained optimization using PORT routines. I don't know…
noobie2023
  • 721
  • 8
  • 25
4
votes
1 answer

How to select starting value for covariates in NLME

library(nlme) Loblolly$age2 <- as.factor(ifelse(Loblolly$age < 12.5, 0, 1)) Here I define a binary covariate that I'm interested in. model <- nlme(height ~ (R0) + 1, data = Loblolly, fixed = list(R0 ~ 1 + (age2)), …
Adrian
  • 9,229
  • 24
  • 74
  • 132
4
votes
0 answers

NLME Package documentation bug: anova.gls() and anova.lme() sums of squares

The documentation for nlme's functions anova.lme() and anova.gls() clearly states: "When only one fitted model object is present, a data frame with the sums of squares,..." is being returned. When running the example below, no sums of squares are…
Konn
  • 108
  • 6
4
votes
1 answer

covariance structure for multilevel modelling

I have a multilevel repeated measures dataset of around 300 patients each with up to 10 repeated measures predicting troponin rise. There are other variables in the dataset, but I haven't included them here. I am trying to use nlme to create a…
Annemarie
  • 123
  • 1
  • 8
4
votes
2 answers

R: fix model call in model using as.formula

I have a gls model in which I assign a formula (from another object) to the model: equation <- as.formula(aic.obj[row,'model']) > equation temp.avg ~ I(year - 1950) mod1 <- gls(equation, data = dat) > mod1 Generalized least squares fit by maximum…
theforestecologist
  • 4,667
  • 5
  • 54
  • 91
4
votes
1 answer

How does setting the opt argument for lmeControl change estimation?

I'm wondering if anyone knows how exactly setting the optimizer in lme() to opt='optim' changes parameter estimation. As in this example: ctrl <- lmeControl(opt='optim'); flow.lme <- lme(rate ~ nozzle, error= nozzle|operator, control=ctrl,…
arrrrRgh
  • 197
  • 3
  • 15
4
votes
1 answer

Repeated-Measures ANOVA: ezANOVA vs. aov vs. lme syntax

This question is both about syntax and semantics, thus please find a (yet unanswered) duplicate on Cross-Validated: https://stats.stackexchange.com/questions/113324/repeated-measures-anova-ezanova-vs-aov-vs-lme-syntax In the machine-learning domain,…
Chris
  • 721
  • 1
  • 10
  • 23
4
votes
1 answer

Better fits for a linear model

I am fitting some lines and I feel like I am telling R exactly how to fit them, but I feel like there is something (some factor or effect) I am unaware of that is preventing a good fit. My experimental unit is "plot" as in field plot, which I am…
Nazer
  • 3,654
  • 8
  • 33
  • 47
4
votes
2 answers

Print R-squared for all of the models fit with lmList

I used lmList to fit 480 relationships and I would like the R2 of each of these. Here is an example dataset and model which are pretty close to what it really looks like, except I have 480 eu (experimental units): eu mass day 11 .02 1 11 .03 …
Nazer
  • 3,654
  • 8
  • 33
  • 47
1 2
3
32 33