Learn R Programming

BCSreg (version 1.1.1)

BCSreg-methods: Extract Information From a Box-Cox Symmetric Regression Fit

Description

Methods for "BCSreg" objects.

Usage

# S3 method for BCSreg
model.frame(formula, ...)

# S3 method for BCSreg model.matrix(object, model = c("mu", "sigma", "alpha"), ...)

# S3 method for BCSreg coef(object, model = c("mu", "sigma", "alpha", "full"), ...)

# S3 method for BCSreg vcov(object, model = c("mu", "sigma", "alpha", "full"), ...)

# S3 method for BCSreg logLik(object, ...)

# S3 method for ugrpl AIC(object, ..., k = 2)

Value

  • model.frame returns a data.frame containing the variables required by formula and any additional arguments provided via ....

  • model.matrix returns the design matrix used in the regression structure, as specified by the model argument.

  • coef returns a numeric vector of estimated regression coefficients, based on the model argument. If parm = "full", it returns a list with the components "mu" and "sigma", each containing the corresponding coefficient estimates. If the model is zero-adjusted, it will also have a "alpha" component with the estimates of the associated regression coefficients.

  • vcov returns the asymptotic covariance matrix of the regression coefficients, based on the model argument.

  • logLik returns the log-likelihood value of the fitted model.

  • AIC returns a numeric value representing the Akaike Information Criterion (AIC), Bayesian Information Criterion, or another criterion, depending on k.

Arguments

formula

a model formula or terms object or an R object.

...

further arguments passed to or from other methods.

object

an object of class "BCSreg", a result of a call to BCSreg.

model

a character indicating which regression structure should be used. It can be "mu" for the scale regression structure, "sigma" for the relative dispersion regression structure, or "full" (when applicable) for both regression structures.

k

numeric, the penalty per parameter to be used; the default k = 2 is the classical Akaike information criteria (AIC).

Author

Francisco F. de Queiroz <felipeq@ime.usp.br>

Rodrigo M. R. de Medeiros <rodrigo.matheus@ufrn.br>

References

Ferrari, S. L. P., and Fumes, G. (2017). Box-Cox symmetric distributions and applications to nutritional data. AStA Advances in Statistical Analysis, 101, 321---344.

Medeiros, R. M. R., and Queiroz, F. F. (2025). Flexible modeling of nonnegative continuous data: Box-Cox symmetric regression and its zero-adjusted extension.

Examples

Run this code
## Data set: renewables2015 (for description, run ?renewables2015)
plot(ecdf(renewables2015$renew_elec_output), cex = 0.3, main = "Empirical CDF")
abline(h = mean(renewables2015$renew_elec_output == 0), col = "grey", lty = 3)
text(1250, 0.155, paste0("prop. of zeros: ~0.12"), col = "blue")

plot(renew_elec_output ~ adj_sav_edu, renewables2015, pch = 16,
    xlab = "Education expenditure (percent of GNI)",
    ylab = "Renewable electricity output (in TWh)")
plot(renew_elec_output ~ agri_land, renewables2015, pch = 16,
    xlab = "Matural logarithm of total agricultural land area",
    ylab = "Renewable electricity output (in TWh)")

 ## Fit a zero-adjusted Box-Cox normal regression
 fit <- BCSreg(renew_elec_output ~ adj_sav_edu + agri_land |
                 adj_sav_edu + agri_land |
                 adj_sav_edu + agri_land, renewables2015)

 ## coef
 coef(fit)                  # regression coefficients of the scale submodel
 coef(fit, model = "sigma") # regression coefficients of the relative dispersion submodel
 coef(fit, model = "alpha") # regression coefficients of the zero-adjustment submodel
 coef(fit, model = "full")  # all regression coefficients

 ## vcov
 vcov(fit)                  # covariance matrix for the scale submodel coefficients
 vcov(fit, model = "sigma") # covariance matrix for the relative dispersion submodel coefficients
 vcov(fit, model = "alpha") # covariance matrix for the zero-adjustment submodel coefficients
 vcov(fit, model = "full")  # full covariance matrix of the model (including the skewness parameter)

 ## Log-likelihood value
 logLik(fit)

 ## AIC and BIC
 AIC(fit)
 AIC(fit, k = log(fit$nobs))

 ## Model matrices
 model.matrix(fit)                  # design matrix for the scale submodel
 model.matrix(fit, model = "sigma") # design matrix for the relative dispersion submodel
 model.matrix(fit, model = "alpha") # design matrix for the zero-adjustment submodel

Run the code above in your browser using DataLab