Learn R Programming

vasicekreg (version 1.1.0)

vasicekreg-package: Overview of the vasicekreg package

Description

The vasicekreg package provides distribution functions and GAMLSS families for Vasicek-type distributions on the unit interval. Three base families are available:

  • NVASIM: normal kernel with mean parameterization, where \(\mu=E(Y)\).

  • NVASIQ: normal kernel with quantile parameterization, where \(\mu=Q_Y(\tau)\) for a fixed \(\tau\in(0,1)\).

  • LVASIQ: logistic kernel with quantile parameterization, where \(\mu=Q_Y(\tau)\) for a fixed \(\tau\in(0,1)\).

For responses observed at the boundaries, the normal-kernel mean model is also available as:

  • ZANVASIM: point mass at zero and a continuous component on \((0,1)\).

  • OANVASIM: point mass at one and a continuous component on \((0,1)\).

  • ZOANVASIM: point masses at zero and one and a continuous component on \((0,1)\).

The parameter \(\sigma\in(0,1)\) controls dispersion in the continuous Vasicek component. The corresponding d, p, q, and r functions provide density or probability mass values, cumulative probabilities, quantiles, and random observations, respectively.

Arguments

Author

Josmar Mazucheli jmazucheli@gmail.com

Bruna Alves pg402900@uem.br

Details

bodyfat: Body fat dataset.

NVASIM: Normal-kernel mean parameterization and GAMLSS family. In regression models, covariates describe the conditional mean through \(\mu\).

NVASIQ: Normal-kernel quantile parameterization and GAMLSS family. For a fixed quantile level \(\tau\), covariates describe the conditional \(\tau\)-th quantile through \(\mu\).

LVASIQ: Logistic-kernel quantile parameterization and GAMLSS family. For a fixed quantile level \(\tau\), covariates describe the conditional \(\tau\)-th quantile through \(\mu\). A logistic-kernel mean-regression family is not provided because the mean has no closed-form expression and does not equal \(\mu\) under this parameterization.

ZANVASIM: Zero-adjusted normal-kernel mean family. Here \(\nu=P(Y=0)\), \(\mu=E(Y\mid Y>0)\), and the marginal mean is \(E(Y)=(1-\nu)\mu\).

OANVASIM: One-adjusted normal-kernel mean family. Here \(\nu=P(Y=1)\), \(\mu=E(Y\mid Y<1)\), and the marginal mean is \(E(Y)=\nu+(1-\nu)\mu\). The parameters \(\mu\) and \(\nu\) therefore have the same interpretations as their counterparts in the one-inflated beta family BEOI. The shape parameter \(\sigma\) is distribution-specific and should not be compared directly between these families.

ZOANVASIM: Zero-and-one-adjusted normal-kernel mean family. Here \(\nu=P(Y=0)\), \(\tau=P(Y=1\mid Y>0)\), and \(\mu=E(Y\mid 0<Y<1)\). Consequently, \(P(Y=1)=(1-\nu)\tau\) and \(E(Y)=(1-\nu)[\tau+(1-\tau)\mu]\).

The distribution functions dNVASIM, pNVASIM, qNVASIM, dNVASIQ, pNVASIQ, qNVASIQ, dLVASIQ, pLVASIQ, and qLVASIQ call compiled C++ routines through Rcpp. The boundary-adjusted distribution functions are implemented in R and reuse the compiled NVASIM functions for their continuous component. Parameter validation, the GAMLSS family definitions, and all log-likelihood derivatives are implemented in R. The mean and variance components of the LVASIQ() family object are obtained by numerical quadrature because these moments have no closed-form expressions.

For the distribution functions associated with NVASIQ and LVASIQ, tau is supplied as an argument. For GAMLSS fitting, NVASIQ() and LVASIQ() require tau to be defined as a scalar variable in the global environment. The same value must be retained when residuals or other post-fit quantities are computed. This fixed quantile level is distinct from the parameter tau in ZOANVASIM(), which represents the conditional probability at one among nonzero observations.

Examples

Run this code
# \donttest{
if (requireNamespace("betareg", quietly = TRUE)) {
    data("ReadingSkills", package = "betareg")
    ReadingSkills$dyslexia <- stats::relevel(
        factor(ReadingSkills$dyslexia), ref = "no"
    )

    control <- gamlss::gamlss.control(n.cyc = 200, trace = FALSE)

    ## In both models, mu = E(Y | Y < 1) and nu = P(Y = 1).
    fit_oanvasim <- gamlss::gamlss(
        accuracy1 ~ dyslexia * iq,
        sigma.formula = ~ dyslexia + iq,
        nu.formula = ~ 1,
        family = OANVASIM(),
        data = ReadingSkills,
        control = control
    )

    fit_beoi <- gamlss::gamlss(
        accuracy1 ~ dyslexia * iq,
        sigma.formula = ~ dyslexia + iq,
        nu.formula = ~ 1,
        family = gamlss.dist::BEOI(),
        data = ReadingSkills,
        control = control
    )

    n <- nrow(ReadingSkills)
    comparison <- data.frame(
        family = c("OANVASIM", "BEOI"),
        logLik = -c(
            fit_oanvasim$G.deviance,
            fit_beoi$G.deviance
        ) / 2,
        AIC = c(
            gamlss::GAIC(fit_oanvasim, k = 2),
            gamlss::GAIC(fit_beoi, k = 2)
        ),
        BIC = c(
            gamlss::GAIC(fit_oanvasim, k = log(n)),
            gamlss::GAIC(fit_beoi, k = log(n))
        )
    )
    comparison
}
# }

Run the code above in your browser using DataLab