age <- c(17,17,18,18,19,19,17,17,18,18,19,19)
language <- c("eng","eng","eng","eng","eng","eng","spa","spa","spa","spa","spa","spa")
prop <- c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.2, 0.3, 0.4, 0.3, 0.6, 0.6)
df <- data.frame(age = age, language = as.factor(language), prop = prop)
mod <- gamlss(prop ~ pvc(age, by = language, lambda=10000), sigma.fo = prop ~ pvc(age, by = language), data = df)
nd <- expand_grid(age = c(17,18,19), language = c("eng", "spa"))
pred <- predict(mod, newdata = nd, type = "response", data = df)
# Error in l$beta : $ operator is invalid for atomic vectors
# In addition: Warning messages:
# 1: In model.matrix.default(~fac - 1, contrast = "") :
# non-list contrasts argument ignored
# 2: In model.matrix.default(~fac - 1, contrast = "") :
# non-list contrasts argument ignored
# 3: In model.matrix.default(~fac - 1, contrast = "") :
# non-list contrasts argument ignored
When fitting a gamlss model with
pvc(), thepredictmethod doesn't work.Minimal reprex: