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

Collinearity between intercept and slopes that vary by time coding - linear mixed effects model

I'm currently trying to run a linear mixed effects model to estimate how stress changes as a function of time (over 6 timepoints). I've noticed that when the intercepts and slopes of stress trajectories are extracted for each individual in my…
M_Oxford
  • 361
  • 4
  • 11
0
votes
1 answer

Error in MEEM(object, conLin, control$niterEM) : Singularity in backsolve at level 0, block 1... Linear mixed model, nlme, R

m1 =lme(fixed=Hour~Age*Ethnicity*GHUsedFlag*Disability, random=~Age|Id, data=mydf) In my model I am checking multi level interactions. Age- numeric repeated measure, Ethnicity- character factor, GHUsedFlag- logical, Disability- Character- factor…
Ahmed
  • 3
  • 3
0
votes
1 answer

Why isn't my mixed model loop working? (RStudio, Crossover design)

I can't figure out why my loop isn't working. I have a database (36rows x 51columns, its name is "Seleccio") consisting of 3 factors (first 3 columns: Animal (12 animals), Diet (3 diets) and Period (3 periods)) and 48 variables (many clinical…
Miquel
  • 3
  • 2
0
votes
1 answer

How can I load custom functions into foreach loop in R?

I am trying to run gls models with a specific spatial correlation structure that comes from modifying the nlme package/ building new functions in the global environment from this post (the answer from this post that creates new functions which…
Leo Ohyama
  • 887
  • 1
  • 9
  • 26
0
votes
0 answers

How to calculate non-linear least squares for a custom function in R?

I am trying to run non-linear least squares using a custom function following this example The data set has a x, predictor y, and groups (a/b). I've only worked with MLLs code previously. I'm having a hard time wrapping my head around how to invoke…
0
votes
0 answers

Error in "as.data.frame.default(x[[i]], optional = TRUE): cannot coerce class ‘"function"’ to a data.frame" when using the gamlss function (or lme())

I am trying to fit a one-inflated Beta regression mixed model using the gamlss package using the following code: # Minimal reproducible example: efficiency <- rbeta(n = 85, shape1 = 2, shape2 = 2, ncp = 2) # My actual variable contains several…
Fanfoué
  • 165
  • 11
0
votes
0 answers

Error in coef.lme(m4) : could not find function "coef.lme" with nlme package loaded

I have the nlme package loaded, however, while ?coef.lme gives me the description of the function. But then coef.lme(m4) Error in coef.lme(m4) : could not find function "coef.lme"
Agus camacho
  • 868
  • 2
  • 9
  • 24
0
votes
1 answer

Why the intercept and line of a lme model goes so far below the original data

I have a mixed model with three factors: one categorical and two continuous. When trying to plot the fitted lines over the original data, it passes much far below. Why would that happen? Here is the model output: Linear mixed-effects model fit by…
Agus camacho
  • 868
  • 2
  • 9
  • 24
0
votes
0 answers

probing 3-way interactions involving binary variables using nlme or lme4

I am running a 3-way interaction which includes a binary variable (race) and 2 continuous variables (age and dep) covarying on sex, SES, and drug_use. See code below m1 <- lme(Anx ~ sex + SES + drug_use + race + age + dep + race:age + age:dep +…
D. Fowler
  • 601
  • 3
  • 7
0
votes
0 answers

gls with ARMA terms: not working for one combination of terms

I am using the gls function from nlme to fit models with various ARMA terms. I would like to compare multiple different models to see which of the ARMA terms provides the best model. My general model is as follows: fit <- gls(y ~ x, data =…
Will
  • 81
  • 5
0
votes
0 answers

How can i have the COMPLETE Outtput of the summary-function of an intercept onlymodel (gls-function) in R?

right now I'm computing a multilevel Model in RStudio and would like to store my outputs. But I can't find any working solution for this. I used already the sink-function. The problem is that the sink function just stores the first of three outputs…
chris_uibk
  • 21
  • 5
0
votes
1 answer

Obtaining random-effects matrices from a mixed model

In my below code, I was wondering how I can obtain the equivalent of out and Ts from an lme() object in the library(nlme)? dat <- read.csv("https://raw.githubusercontent.com/rnorouzian/v/main/mv.l.csv") library(lme4) x <- lmer(value ~0 + name+ (1|…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
0
votes
0 answers

anova() does not work properly with lme objects after updating - do I miss something?

I had a code that worked fine so far. I want to test things with gls, lme and gamm (from packages nlme and mgcv), and I compared different models with anova(). However, I needed another package, that did not work with my R version (which was almost…
Maki
  • 109
  • 13
0
votes
1 answer

Shortening the formula syntax of a regression model

I was wondering if the syntax of the regression model below could be made more concise (shorter) than it currently is? dat <- read.csv('https://raw.githubusercontent.com/rnorouzian/v/main/bv1.csv') library(nlme) model <- lme(achieve ~ 0 + D1 + D2+…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
0
votes
1 answer

Replace x-axis from a mixed-model plot

In my plot below, I was wondering if I could put grade as x-axis? multivariate <- read.csv('https://raw.githubusercontent.com/hkil/m/master/bv.csv') library(nlme) library(effects) # for plot m2 <- lme(var ~ 0 + d_math + d_hyp + d_math:I(grade-2) +…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72