You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function pool ignores that there are different models for each parameter in gamlss (Generalized Additive Models for Location, Scale and Shape) objects such that it will average over the regression coefficients from different parameters that are modelled with the same covariates.
Libraries and data generation
# Libraries
library(gamlss)
library(mice)
# Data
group <- sample(c("A", "B"), size = 100, replace = TRUE)
biomarker <- rnorm(n = 100, mean = 0, sd = 1)
design.matrix.mu <- model.matrix(~ group + biomarker)
design.matrix.tau <- model.matrix(~ biomarker)
beta <- c(-1, 0.5, 1)
gamma <- c(1, 0.6)
sigma <- plogis(1)
mu <- plogis(design.matrix.mu%*%beta)
nu <- exp(design.matrix.tau%*%gamma)
outcome <- rBEINF(n = 100, mu = mu, sigma = sigma, nu = nu, tau = 0.1)
dataset <- data.frame(outcome, group, biomarker)
dataset[sample(1:100, size = 10), "biomarker"] <- NA
Fitting a gamlss model with formula for the mean (mu) and the probability of inflated zeros (nu)
fit <- gamlss(formula = outcome ~ group + biomarker,
nu.formula = ~ biomarker,
data = na.omit(dataset),
family = "BEINF")
## GAMLSS-RS iteration 1: Global Deviance = -53.5503
## GAMLSS-RS iteration 2: Global Deviance = -56.593
## GAMLSS-RS iteration 3: Global Deviance = -56.6955
## GAMLSS-RS iteration 4: Global Deviance = -56.7008
## GAMLSS-RS iteration 5: Global Deviance = -56.7012
summary(fit)
## ******************************************************************
## Family: c("BEINF", "Beta Inflated")
##
## Call: gamlss(formula = outcome ~ group + biomarker, nu.formula = ~biomarker,
## family = "BEINF", data = na.omit(dataset))
##
## Fitting method: RS()
##
## ------------------------------------------------------------------
## Mu link function: logit
## Mu Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.4053 0.4058 -3.463 0.000846 ***
## groupB 1.1891 0.4763 2.497 0.014517 *
## biomarker 1.0107 0.2567 3.937 0.000171 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------------------------------
## Sigma link function: logit
## Sigma Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.6505 0.2025 3.213 0.00187 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------------------------------
## Nu link function: log
## Nu Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.8971 0.2430 3.692 0.000397 ***
## biomarker 0.4460 0.2642 1.688 0.095138 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------------------------------
## Tau link function: log
## Tau Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.6027 0.7328 -3.552 0.000634 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------------------------------
## No. of observations in the fit: 90
## Degrees of Freedom for the fit: 7
## Residual Deg. of Freedom: 83
## at cycle: 5
##
## Global Deviance: -56.70123
## AIC: -42.70123
## SBC: -25.20256
## ******************************************************************
I am afraid I cannot solve this. gamlss fits a model for each moment of the distribution. From your mail I conclude that the tidy() function for gamlss objects only stores the model parameters for the model of the first moment.
I see two ways to go forward:
The royal solution: Adapt tidy() and glance() functions for gamlss object to include all model coefficients;
The quick way: Manually extract the fitted coefficients and their variances for each model, and use mice::pool.scalar() to combine them.
The function pool ignores that there are different models for each parameter in gamlss (Generalized Additive Models for Location, Scale and Shape) objects such that it will average over the regression coefficients from different parameters that are modelled with the same covariates.
Libraries and data generation
Fitting a gamlss model with formula for the mean (mu) and the probability of inflated zeros (nu)
Multiple imputation
Issue: pool ignores that there are two regression models for mu and tau resulting in only one set of coefficients
Session Info
The text was updated successfully, but these errors were encountered: