r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.39k stars 759 forks source link

Where is my mistake #2082

Closed mezerji1365 closed 5 years ago

mezerji1365 commented 5 years ago

I run these two function (fit1, fit2), but in second function (fit2) with add some random effects, I have below error: Error in na.fail.default(list(W.var = c(0.0754261472487817, 0.0754261472487817, : missing values in object

Where is my mistake? data and two function are in the follow:

######################################################################## n <- 100 # number of subjects K <- 8 # number of measurements per subject t_max <- 5 # maximum follow-up time

DF <- data.frame(id = rep(seq_len(n), each = K), time = c(replicate(n, c(0, sort(runif(K - 1, 0, t_max))))), sex = rep(gl(2, n/2, labels = c("male", "female")), each = K))

fit1 = gamlss(y~sex+time, sigma.formula=~1, nu.formula=~sex family=ZABS(mu.link="identity",sigma.link = "identity",nu.link = "logit"), method=CG(), data=DF)

fit2 = gamlss(y~sex+time+re(random=~1|id, method="REML"), sigma.formula=~1, nu.formula=~sex+re(random=~1|id, method="REML"), family=ZABS(mu.link="identity",sigma.link = "identity",nu.link = "logit"), method=CG(), data=DF)

jimhester commented 5 years ago

This sort of question is a better fit for https://community.rstudio.com. Do you mind asking it over there? (You might want to read https://www.tidyverse.org/help/ first to maximise your chances of getting a good answer)

lock[bot] commented 4 years ago

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/