The data in the following example are from here
library(tidyverse)
library(lme4)
dat <- read.table("aids.dat2",head=T) %>%
filter(day <= 90) %>%
mutate(log10copy = log10(lgcopy)) %>%
na.omit()
> head(dat)
patid day cd4 lgcopy cd8 log10copy
2 11542 2 159.84 4.361728 619.38 0.6396586
3 11542 7 210.60 3.531479 666.90 0.5479566
4 11542 16 204.12 2.977724 635.04 0.4738844
5 11542 29 172.48 2.643453 407.68 0.4221716
6 11542 57 270.94 2.113943 755.78 0.3250933
8 11960 2 324.72 3.380211 856.08 0.5289438
Running the following code gives me the error: Error in eval(expr, envir, enclos) : object 'log10copy' not found, but log10copy is clearly one of the columns in my data set?
lme4.fit <- lme4::nlmer(log10copy ~ exp(p1-b1*day) + exp(p2-b2*day + 1) +
(1|p1) + (1|b1) + (1|p2) + (1|b2), data = dat)
I want to fit a model with 4 fixed effects on p1, b1, p2, b2 and 4 random effects on the same set of parameters.
nlmershould be a 3-part formula of the formresp ~ Nonlin ~ fixed + random. Also what are p1, p2, b1, b2? They are not in your example data. - neilfws