Skip to content

predict with pvc not working #15

Description

@alvinwmtan

When fitting a gamlss model with pvc(), the predict method doesn't work.

Minimal reprex:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions