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
1
vote
1 answer

nlme::gls() R code on Applied Longitudinal Analysis, 2nd Edition website needs some tweaks

My question is fairly straightforward. When I run the code below, copied directly from the "Applied Longitudinal Analysis" website, here: https://content.sph.harvard.edu/fitzmaur/ala2e/ (It's Chapter 5, Section 5.7), library(foreign) ds <-…
1
vote
0 answers

Correcting for spatial autocorrelation (GLS, nlme package)

I am trying to account for spatial autocorrelation using the gls function in the nlme package using the following code: sp2 <- gls(final$formula, data = BITS_B, correlation = corLin(form = ~ Mid.Y + Mid.X, nugget = TRUE)) But I keep getting the…
1
vote
1 answer

Repeated Measures ANOVA with blocking factor using nlme

I would like to make sure this is correct even though I think it is similar to other versions on stackoverflow but not exactly the same. Exp Design: Blocks - north fields and south fields Treatments - reference, treat_1, treat_2 Time as months - 3,…
Bill Perry
  • 463
  • 1
  • 5
  • 13
1
vote
1 answer

R and multiple time series and Error in model.frame.default: variable lengths differ

I am new to R and I am using it to analyse time series data (I am also new to this). I have quarterly data for 15 years and I am interested in exploring the interplay between drinking and smoking rates in young people - treating smoking as the…
Francesca
  • 63
  • 1
  • 7
1
vote
2 answers

Getting Error in parse(text = paste("~", paste(nVal, collapse = "/"))) : :2:0: unexpected end of input when running nlme package in R

I'm attempting to use the nlme package to fit the Generalized beta of the 2nd kind distribution to simulated health cost data. Running the following code on a test dataset: Package installation (if necessary) install.packages("withr", dependencies =…
RobertF
  • 824
  • 2
  • 14
  • 40
1
vote
0 answers

lapply does not work with gls + piecewiseSEM objects

I am trying to get lapply to run models (more specifically path models from the piecewiseSEM package). These path models use separate models (from the nlme package) and then are combine to build the final path model. I've had to utilize some custom…
Leo Ohyama
  • 887
  • 1
  • 9
  • 26
1
vote
0 answers

Clustering with nonlinear mixed effect modeling

I want to optimally find the clusters and assignment of each subject into the correct cohort in the nonlinear mixed effect framework. I came to know a package in R which is lcmm that calls this type of modeling a latent class mixture model. They…
1
vote
1 answer

Error with plotting augPred for nlme (nonlinear mixed effects): replacement has [X] rows, data has [Y]

I am having a problem using augPred after I have created an nlme object.  My data is 529 rows long with no NA's, and is grouped with this function: RSize.gD.100 <- groupedData(area ~ size | ID, data = RSize) Under the grouping factor “ID”, this is a…
Ben
  • 11
  • 1
1
vote
0 answers

Generalized Additive Mixed Effect models (GAMM) with large datasets (>1 million rows)

I have a large dataset that I'd like to fit generalized additive mixed effects models to. By large, I mean >5 million rows of data. I've tried fitting this with both GAM and GAMM in the mgcv package with the following specifications: m1 <-…
Thomas Moore
  • 192
  • 1
  • 12
1
vote
0 answers

error calculating simple slopes using reghelper package

I am trying to calculate simple slopes involving a 3-way interaction (apoe4:time:sleep_eff_10). See below library(nlme) m1 <- lme(EF ~ sex_recoded + race_recoded + educ_year_centered + BMI_masterfile_centered + apoe4 + sleep_meds + CVD +…
D. Fowler
  • 601
  • 3
  • 7
1
vote
0 answers

How to write code for Level 2 data for Multilevel Modeling using nlme package

I am struggling with how to describe level 2 data in my Multilevel Model in R. I am using the nlme package. I have longitudinal data with repeated measures. I have repeated observations for every subject across many days. The Goal: Level 1 would be…
1
vote
0 answers

Spatiotemporal mixed-effects in R: Too large groups in correlation structure

I am trying to fit a mixed-effect model with a spatiotemporal correlation structure using lme {nlme}. The data comprises 37936 lon (x) + lat (y) grid-cells (18968 male + 18968 female) with density (kde), above/below long-term average rainfall…
Sands
  • 25
  • 5
1
vote
2 answers

combine two plots into one plot in a mixed-model plot

In my plot below, d_math and d_hyp are each {0,1} variables. Given this fact, in my plot below, I was wondering if we can combine the two plots into one, just like in the desired plot further below? ps. I'm open to any R packages. multivariate <-…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
1
vote
1 answer

lmList() in ‘nlme’ does not accept weights as an argument

I do not understand why lmList() from the R package ‘nlme’ does not recognize the weights argument to estimate WLS models by groups. Here is my sample data: obs cusip DLogPrice DQSize error.var 1 2 000361AH8 0.657 -1150000 …
Grillo
  • 75
  • 6
1
vote
0 answers

why does nlme not find .x when I try to use map?

I am trying to create a nested tibble with columns containing models. I succeeded in creating a column with the nlsList models. I am failing at creating a column with the corresponding nlme's. Even when I extract one nlsList element and try to use…