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
0 answers

nlme: different degrees of freedom between groups

I have a time series dataset I'm analyzing using a linear mixed effects model in the nlme package in R. I suspect there is a significant interaction between herbivory (dmg; light, moderate, severe, very severe) and aspect (linearized), which I would…
0
votes
1 answer

No applicable method for 'lme' applied to an object of class "character"

I get the following error: Error in UseMethod("lme") : no applicable method for 'lme' applied to an object of class "character" when running my code: outcome = "Score" exposures_fixed = c("Age", "Sex","BMI") coefficients = c() for (k in…
Sari Katish
  • 180
  • 7
0
votes
1 answer

Probing interactions in nlme using the "interactions" package in R

I am running a linear mixed effects models using the "nlme" package looking at stress and lifestyle as predictors of change in cognition over 4 years in a longitudinal dataset. All variables in the model are continuous variables. I am able to create…
0
votes
1 answer

How does lm() work when one axis is logarithmic?

I've tried fitting a linear equation to data with a logarithmic y axis a couple different ways. I seem to get the correct line and equation when I use stat_poly_line and stat_poly_eq. (See example with…
Vistho
  • 15
  • 4
0
votes
0 answers

Trouble installing nlme package

I need to install nlme as it is a dependency for the MSstats package I need. I currently run on R version 4.2.0. When I try to install with Bioc manager I get the following: > BiocManager::install("MSstats") 'getOption("repos")' replaces…
0
votes
1 answer

Is there a way to create a quadratic regression with random effect with lme() function in R?

I tried to create a graph in R to describe a quadratic term with a random effect. I used the function lme() with a random effect which included random slope and intercept: diversity = c(0.69, 1.54, 0.84, 1.48, 1.71, 1.80, 2.09, 1.63, 2.40, 2.20,…
0
votes
0 answers

Sample or population beta weights in R's lm() and lme()?

A journal is asking whether I report sample or population beta weights for my regressions. I am using the lm() function in base R and the lme() function from the nlme-package. Which kind of beta weight do they give? I was not able to find any…
mkks
  • 23
  • 4
0
votes
1 answer

How to specify contrasts in lme to test hypotheses with interactions

I have a generalized mixed model that has 2 factors (fac1 (2 levels), fac2 (3 levels)) and 4 continuous variables (x1,x2,x3,x4) as fixed effects and a continuous response. I am interested in answering: are the main effects x1-x4 (slopes)…
JmO
  • 572
  • 1
  • 4
  • 20
0
votes
1 answer

R : regression line interrupted in ggplot while a continuous line is expected

I created a multilevel regression model with nlme package and now I would like to illustrate the regression line obtained for some patients (unfortunately I cannot use geom_smooth with nlme). So using the model I obtained the following predicted…
David
  • 111
  • 6
0
votes
1 answer

GLS / GLM nested design with autocorrelation over time

Still fairly new to GLM and a bit confused about how to establish my model. About my project: I sampled the microbiome (and measured a diversity index value = Shannon) from the root system of a sample of 9 trees (=tree1_cat). In each tree I sampled…
mfbeuq
  • 13
  • 4
0
votes
1 answer

lme can't find functions to set correlation / covariance structure and weights

I'm currently trying to fit a multivariate mixed model. I'm trying to include weights and a covariance structure like so: model <- nlme::lme(fixed = ..., data = ...., random = ..., weights = varIdent(form = ~ 1 | Gender)) or model <-…
Mika2019
  • 47
  • 9
0
votes
2 answers

Use lme() within the dplyr pipe

Question Hello, I would like to use the function lme() from the nlme package inside the pipe. Data library(tidyverse) library(nlme) df <- tribble( ~id_pat, ~diff, 1, -15, 2, NA, 3, -25.2, 4, 46.2, 1,…
T. Walter
  • 81
  • 1
  • 6
0
votes
2 answers

Looping/sapply through nlme function

I am trying to execute a loop with mixed-model effects with response variable changing. I came from here and here. I should say that I have tried sthg creating a function and then sapply or lapply (wihtout success) I provide a small dataset (really…
0
votes
0 answers

lme in R: Error in eval(predvars, data, env) : object not found

I want to sort the matrix where all the summary statistics are stored by p-value. Code library(nlme) # Sort the matrix where all the summary statistics are stored by p-value for (i in 1:nrow(p)){ p.a.sort <- sort(rep(r$Class, nrow(p[i,]))) …
melolili
  • 1,237
  • 6
  • 16
0
votes
0 answers

R NLME: invalid type (list) for variable 'p'

I want to sort the matrix where all the summary statistics are stored by p-value. My code is raising invalid type (list) for variable 'p' error. Code for (i in 1:nrow(p)){ p.a.sort <- sort(rep(r$Class, nrow(p[i,]))) p.b.sort <-…
melolili
  • 1,237
  • 6
  • 16