r - Unable to get confidence intervals using broom for a gamlss model with a sigma.formula term -
i fitting gamlss model call:
model <- gamlss(formula = formula("y_variable ~ image_name + random(biological_source_name) - 1"), sigma.formula = formula("~ biological_source_name - 1"), family = "nbi", data = na.omit(data))
however error when trying confidence intervals using broom::confint_tidy
:
confint_tidy(model)
the message is:
error in usemethod("family") : no applicable method 'family' applied object of class "null" in addition: warning message: in vcov.gamlss(object, robust = robust) : additive terms exists in mu formula. standard errors linear terms maybe not appropriate
however different error when trying use broom::tidy
:
broom::tidy(model)
the message is:
error in data.frame(..., check.names = false) : arguments imply differing number of rows: 0, 73
when fit model without sigma.formula
term, able confidence intervals.
model_no_sigma <- gamlss(formula = formula("y_variable ~ image_name + random(biological_source_name) - 1"), family = "nbi", data = na.omit(data)) broom::tidy(model_no_sigma) # produce ci output
reproducible example
library("gamlss") example_data <- rbind( data.frame( y = rnbinom(200, mu = 10, size = 1), x = "var_1" ), data.frame( y = rnbinom(200, mu = 20, size = 10), x = "var_2" ) ) # no estimate sigma model_1 <- gamlss(formula = formula("y ~ x - 1"), data = example_data, family = "nbi") broom::tidy(model_1, conf.int = true) # include intercept term sigma model_2 <- gamlss(formula = formula("y ~ x - 1"), sigma.formula = formula("~ x"), data = example_data, family = "nbi") broom::tidy(model_2, conf.int = true) # remove intercept sigma model_3 <- gamlss(formula = formula("y ~ x - 1"), sigma.formula = formula("~ x - 1"), data = example_data, family = "nbi") broom::tidy(model_3, conf.int = true)
example output
Comments
Post a Comment