0

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 <- nlme::lme(fixed = ..., data = ...., random = ..., corr = corAR1())

I also tried using correlation instead of corr.

However, I get error messages:

Error in corAR1() : could not find function "corAR1"

Error in varIdent(form = ~1 | Gender) : could not find function "varIdent"

I have tried deleting the global environment and loading everything fresh. I also reinstalled nlme and typed getAnywhere(corAR1) and getAnywhere(varIdent) as suggested in this post.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
Mika2019
  • 47
  • 9

1 Answers1

3

Do you call library(nlme) before running? And did you try including nlme::corAR1()/nlme::varIdent() inside the call itself ?

alebey
  • 58
  • 5
  • Thank you so much! Yes, I called it, but I didn't not include ``nlme::corAR1()/nlme::varIdent()`` inside the call. – Mika2019 Mar 04 '22 at 15:26
  • you still shouldn't need `nlme::varIdent` in the code if you have previously loaded the package with `library("nlme")` ... – Ben Bolker Mar 04 '22 at 19:46