Learn R Programming

enrichwith (version 0.6)

enrich.betareg: Enrich objects of class betareg

Description

Enrich objects of class betareg with any or all of a set of auxiliary functions, the expected information at the maximum likelihood estimator, and the first term in the expansion of the bias of the maximum likelihood estimator.

Usage

# S3 method for betareg
enrich(object, with = "all", ...)

Value

The object object of class betareg

with extra components. get_enrichment_options.betareg()

returns the components and their descriptions.

Arguments

object

an object of class betareg

with

a character vector of options for the enrichment of object

...

extra arguments to be passed to the compute_* functions

Details

Enrichment is currently implemented only for models fitted with dist = "beta".

The auxiliary_functions component consists of any or all of the following functions:

  • score: the log-likelihood derivatives as a function of the model parameters and, optionally, a supplied response; see get_score_function.betareg

  • information: the expected or observed information as a function of the model parameters and, optionally, a supplied response; see get_information_function.betareg

  • bias: the first-order term in the expansion of the bias of the maximum likelihood estimator as a function of the model parameters; see get_bias_function.betareg

  • simulate: a simulate function for betareg objects that can simulate variates from the model at user-supplied parameter values for the regression parameters (default is the maximum likelihood estimates); see get_simulate_function.betareg

  • dmodel: computes beta densities under the fitted design at user-supplied responses and parameter values; see get_dmodel_function.betareg

  • pmodel: computes beta distribution functions under the fitted design at user-supplied responses and parameter values; see get_pmodel_function.betareg

  • qmodel: computes beta quantile functions under the fitted design at user-supplied probabilities and parameter values; see get_qmodel_function.betareg

  • Pmat: the matrices \(P_t\) as a function of the model parameters

  • Qmat: the matrices \(Q_t\) as a function of the model parameters

Examples

Run this code

if (FALSE) {
if (require("betareg")) {

   data("GasolineYield", package = "betareg")
   gy <- betareg(yield ~ batch + temp, data = GasolineYield)

   # Get a function that evaluates the expected information for gy at supplied parameter values
   gy_info <- get_information_function(gy)
.   # compare standard errors with what `summary` returns
   all.equal(sqrt(diag(solve(gy_info())))[1:11],
             coef(summary(gy))$mean[, 2], check.attributes = FALSE)
.   # evaluating at different parameter values
   gy_info(rep(1, length = 12))

   # Get a function that evaluates the first-order bias of gy at supplied parameter values
   gy_bias <- get_bias_function(gy)
   # compare with internal betareg implementation of bias correction
   gy_bc <- update(gy, type = "BC")
   all.equal(gy_bias(coef(gy)), gy_bc$bias, check.attributes = FALSE)

 }
}

Run the code above in your browser using DataLab