Package 'rregm'

Title: Reparameterized Regression Models
Description: Provides estimation and data generation tools for several new regression models, including the gamma, beta, inverse gamma, beta prime, log-normal and log-logistic distributions. These models can be parameterized based on the mean, median, mode, geometric mean and harmonic mean, except for the log-logistic model which is based on alternative parametrizations. For details, see Bourguignon and Gallardo (2025a) <doi:10.1016/j.chemolab.2025.105382> and Bourguignon and Gallardo (2025b) <doi:10.1111/stan.70007>. The package also implements higher-order likelihood inference through Skovgaard-adjusted likelihood ratio statistics and predictive shrinkage estimators reparameterized beta regression models.
Authors: Diego Gallardo [aut, cre], Marcelo Bourguignon [aut], Marcia Brandao [aut], Tiago Magalhaes [ctb], Rafael Izbicki [ctb]
Maintainer: Diego Gallardo <[email protected]>
License: GPL (>= 2)
Version: 1.3
Built: 2026-07-22 01:12:00 UTC
Source: https://github.com/cran/rregm

Help Index


Tools for a reparameterized beta regression model

Description

A set of functions related to the reparameterized beta regression model based on different measures of central tendency: mean, median, mode, geometric mean or harmonic mean.

Usage

BEAM(mu.link = "logit", sigma.link = "log") 
BEGM(mu.link = "logit", sigma.link = "log") 
BEHM(mu.link = "logit", sigma.link = "log") 
BEMD(mu.link = "logit", sigma.link = "log") 
BEMO(mu.link = "logit", sigma.link = "log") 
dBEAM(x, mu = 0.5, sigma = 1, log = FALSE) 
dBEGM(x, mu = 0.5, sigma = 1, log = FALSE) 
dBEHM(x, mu = 0.5, sigma = 1, log = FALSE) 
dBEMD(x, mu = 0.5, sigma = 1, log = FALSE) 
dBEMO(x, mu = 0.5, sigma = 1, log = FALSE) 
dRBE(x, mu=0.5, sigma=1, param="AM", log=FALSE)
fit.RBE(formula = formula(data), sigma.formula=~1, data, param="AM")
pBEAM(q, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pBEGM(q, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pBEHM(q, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pBEMD(q, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pBEMO(q, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE)
pRBE(q, mu=0.5, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) 
qBEAM(p, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qBEGM(p, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qBEHM(p, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qBEMD(p, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qBEMO(p, mu = 0.5, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qRBE(p, mu=0.5, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE)
rBEAM(n, mu = 0.5, sigma = 1) 
rBEGM(n, mu = 0.5, sigma = 1) 
rBEHM(n, mu = 0.5, sigma = 1) 
rBEMD(n, mu = 0.5, sigma = 1) 
rBEMO(n, mu = 0.5, sigma = 1) 
rRBE(n, mu=0.5, sigma=1, param="AM")

Arguments

mu.link

the mu link function with default logit

sigma.link

the sigma link function with default log

mu, sigma

vector of parameter values

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

sigma.formula

a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~x1+x2.

param

parameterization used for the model. "AM" for mean, "MD" for median, "MO" for mode, "GM" for geometric mean, and "HM" for harmonic mean.

x, q

vector of quantiles

p

vector of probabilities

n

number of observations. If length(n)>1\mbox{length}(n) > 1, the length is taken to be the number required.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE, probabilities are P(Xx)P(X \leq x) otherwise, P(X>x)P(X>x).

Details

The parameterization for the reparameterized beta distribution is given by

f(x;μ,σ)=xμσ+τ11(1x)(1μ)σ+τ2τ11B(μσ+τ1,(1μ)σ+τ2τ1),0<x<1,f(x; \mu, \sigma) = \frac{x^{\mu\,\sigma + \tau_1-1}(1 - x)^{(1-\mu)\sigma + \tau_2-\tau_1-1}}{B(\mu\,\sigma + \tau_1, (1-\mu)\sigma + \tau_2-\tau_1)}, \quad 0 < x < 1,

where 0<μ<10 < \mu < 1, σ>0\sigma > 0 and τ1\tau_1 and τ2\tau_2 are constant. The following cases are highlighted:

- param="AM": τ1=τ2=0\tau_1=\tau_2=0 and μ\mu represents the mean of the distribution.

- param="GM": τ1=τ2=1/2\tau_1=\tau_2=1/2 and μ\mu represents the geometric mean of the distribution.

- param="HM": τ1=τ2=1\tau_1=\tau_2=1 and μ\mu represents the harmonic mean of the distribution.

- param="MO": τ1=1\tau_1=1 and τ2=2\tau_2=2 and μ\mu represents the mode of the distribution.

- param="MD": τ1=1/2\tau_1=1/2 and τ2=0\tau_2=0 and μ\mu represents the median of the distribution.

Suppose the central tendency and the concentration parameter of YiY_i satisfies the following functional relations

logit(μi)=xiξandlog(σi)=η2i=ziν,\mbox{logit}(\mu_i) = \mathbf{x}^\top_i\bm{\xi} \quad \textrm{and} \quad \log(\sigma_i) = \eta_{2i} = \mathbf{z}^\top_i\bm{\nu},

where logit(u)=log(u/(1u))\mbox{logit}(u)=\log(u/(1-u)) is the logit function, ξ=(ξ1,,ξp)\bm{\xi} = (\xi_1, \ldots, \xi_p)^\top and ν=(ν1,,νq)\bm{\nu} = (\nu_1, \ldots, \nu_q)^\top are vectors of unknown regression coefficients which are assumed to be functionally independent, ξRp\bm{\xi} \in \mathbb{R}^p and νRq\bm{\nu} \in \mathbb{R}^q, with p+q<np + q < n, and xi=(xi1,,xip)\mathbf{x}_i = (x_{i1}, \ldots, x_{ip})^\top and zi=(zi1,,ziq)\mathbf{z}_i = (z_{i1}, \ldots, z_{iq})^\top are observations on pp and qq known regressors, for i=1,,ni = 1, \ldots, n. Furthermore, we assume that the covariate matrices X=(x1,,xn)\mathbf{X} = (\mathbf{x}_1, \ldots, \mathbf{x}_n)^\top and Z=(z1,,zn)\mathbf{Z} = (\mathbf{z}_1, \ldots, \mathbf{z}_n)^\top have rank pp and qq, respectively.

For this model, the Pearson's residuals are given by

ri=yimisi,i=1,,n,r_i=\frac{y_i-m_i}{s_i}, \quad i=1,\ldots,n,

where

mi=μiσi+τ1σi+τ2andsi=(μiσi+τ1)((1μi)σi+τ2τ1)(σi+τ2)2(σi+τ2+1).m_i=\frac{\mu_i \sigma_i+\tau_1}{\sigma_i+\tau_2} \quad \mbox{and} \quad s_i=\sqrt{\frac{(\mu_i \sigma_i+\tau_1)((1-\mu_i)\sigma_i+\tau_2-\tau_1)}{(\sigma_i+\tau_2)^2(\sigma_i+\tau_2+1)}}.

whereas the modified Pearson's residuals are given by

ri=logit(yi)misi,i=1,,n,r_i^*=\frac{\mbox{logit}(y_i)-m_i^*}{s_i^*}, \quad i=1,\ldots,n,

where

mi=ψ(μiσi+τ1)ψ((1μi)σi+τ2τ1)andsi=ψ(μiσi+τ1)+ψ((1μi)σi+τ2τ1),m_i^*=\psi(\mu_i \sigma_i+\tau_1)-\psi((1-\mu_i)\sigma_i+\tau_2-\tau_1) \quad \mbox{and} \quad s_i^*=\sqrt{\psi'(\mu_i \sigma_i+\tau_1)+\psi'((1-\mu_i)\sigma_i+\tau_2-\tau_1)},

with ψ()\psi(\cdot) and ψ()\psi'(\cdot) denoting the digamma and trigamma functions, respectively. Finally, the quantile residuals are given by

riq=Φ1(Iyi(μiσi+τ1,(1μi)σi+τ2τ1)),i=1,,n,r_i^q=\Phi^{-1}\left(I_{y_i}(\mu_i \sigma_i+\tau_1,(1-\mu_i)\sigma_i+\tau_2-\tau_1)\right), \quad i=1,\ldots,n,

where Φ1()\Phi^{-1}(\cdot) denotes the inverse of the cumulative distribution function for the standard normal model and Iy(α,β)=Bx(α,β)/B(α,β)I_y(\alpha,\beta)=B_x(\alpha, \beta)/B(\alpha, \beta) is the incomplete beta function ratio, Bx(α,β)=0xωα1(1ω)β1dωB_x(\alpha, \beta) = \int_{0}^{x}\omega^{\alpha-1}(1-\omega)^{\beta-1}\textrm{d} \omega is the incomplete beta function, B(α,β)=Γ(α)Γ(β)/Γ(α+β)B(\alpha, \beta) = \Gamma(\alpha)\Gamma(\beta)/\Gamma(\alpha + \beta) is the beta function and Γ(α)=0ωα1eωdω\Gamma(\alpha) = \int_{0}^{\infty}\omega^{\alpha-1}\textrm{e}^{-\omega}\textrm{d} \omega is the gamma function. dRBE gives the density, pRBE gives the distribution function, qRBE gives the quantile function, and rRBE generates random deviates from the beta distribution with the specified parameterization. In addition, dBEXX, pBEXX, qBEXX and rBEXX also provide the equivalent functions for a specified parameterization for XX: AM (mean), GM (geometric mean), HM (harmonic mean), MD (median) and MO (mode). For instance, dBEAM gives the density for the beta model parameterized in the mean, pBEGM gives the distribution function for the beta model parameterized in the geometric mean and so on. Finally, the functions BEAM, BEGM, BEHM, BEMD and BEMO also provide a framework to fit models with gamlss.

Value

an object of class "rregm" is returned. The object returned for these functions is a list containing the following components:

estimate

A matrix containing the estimates and standard errors.

logLik

the log-likelihood function evaluated at the corresponding estimators.

AIC

the Akaike information criterion.

BIC

the Bayesian information criterion.

tau1, tau2

values for tau1 and tau2, depending on the considered parameterization.

pearson.res

Pearson's residuals.

mod.pearson.res

modified Pearson's residuals.

quant.res

quantile residuals.

convergence

logical. If convergence was attained.

dist

BE (the beta distribution).

param

The specified parameterization.

mu.x

design matrix for mu.

sigma.x

design matrix for sigma.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified parameterization of the beta distribution: A flexible and robust beta regression model. Statistica Neerlandica, 79(2), e70007.

See Also

fit.RBE, fit.RGA, fit.RBP, fit.RIG, fit.RLL

Examples

set.seed(2100)
n=100; x1=rnorm(max(n)) ##drawing covariates, the same for mu and sigma
mu=plogis(0.5-0.4*x1); sigma=exp(-0.1+0.05*x1)
y=rRBE(n, mu, sigma, param="MD") ## model parameterized in the median
data=list(y=y, x1=x1)
aux.RBE=fit.RBE(y~x1, sigma.formula=~x1, data=data, param="MD")
summary(aux.RBE)
qqnorm(res(aux.RBE, type="mod.pearson"))
#The beta model parameterized in the median also can be fitted using gamlss
#gamlss(y~x1, sigma.formula=~x1, data=data, family=BEMD)

Skovgaard's adjustment and predictive measures for a reparameterized beta regression model

Description

A set of functions related to Skovgaard's adjustment for the reparameterized beta regression model based on different measures of central tendency: mean, median, mode, geometric mean or harmonic mean.

Usage

RBE.skovgaard(formula, data, reduced.fo=~1, phi.test=NULL, param="AM")
RBE.predictive(formula, data, reduced.fo=~1, phi.test=NULL, train=0.7, param="AM")

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

reduced.fo

a formula object for fitting the reduced model for μ\mu, reduced.fo=~1 by default.

param

parameterization used for the model. "AM" for mean, "MD" for median, "MO" for mode, "GM" for geometric mean, and "HM" for harmonic mean.

phi.test

value to include for ϕ\phi in the null hypothesis. phi.test=NULL represents no hypothesis for ϕ\phi.

train

train proportion of observations used for model training. (0.7 by default)

Details

The function RBE.skovgaard() performs likelihood ratio inference in reparameterized beta (RB) regression models by computing the standard likelihood ratio statistic together with two adjusted versions based on Skovgaard's higher-order asymptotic approximation. These adjusted statistics are designed to improve the finite-sample performance of likelihood ratio tests by reducing the size distortions commonly observed when the sample size is small or moderate.

The user specifies a full model through formula and a reduced model through reduced.fo. The function then fits both models and returns the standard likelihood ratio statistic (SLR) as well as the two adjusted statistics (SLR1 and SLR2), together with their corresponding chi-squared p-values.

The function RBE.predictive() implements likelihood-based shrinkage estimators for RB regression models. The data are randomly divided into training and test sets according to the proportion specified in train. Model fitting is performed using the training sample and predictive performance is evaluated on the test sample.

Five competing estimators are considered:

  • MLE: maximum likelihood estimator;

  • US: classical uniform shrinkage estimator;

  • US1: shrinkage estimator based on the first Skovgaard-adjusted likelihood ratio statistic;

  • US2: shrinkage estimator based on the second Skovgaard-adjusted likelihood ratio statistic;

  • GAIC: variable selection based on the generalized Akaike information criterion.

Predictive performance is summarized through the mean squared error (MSE), mean absolute error (MAE), and logarithmic score (LS). Lower values of MSE and MAE indicate better predictive accuracy, whereas larger values of LS indicate better probabilistic predictions.

Both functions support all currently available parameterizations of the RB distribution implemented in rregm, namely the arithmetic mean ("AM"), geometric mean ("GM"), harmonic mean ("HM"), mode ("MO"), and median ("MD") parameterizations.

The methods implemented in these functions are based on higher-order likelihood theory and likelihood-based shrinkage methodology, providing tools for both improved finite-sample inference and enhanced predictive performance in RB regression models.

Value

Both functions return an object of class "LRskov".

For RBE.skovgaard(), the returned object contains likelihood ratio statistics and associated p-values.

For RBE.predictive(), the returned object contains out-of-sample prediction measures (MSE, MAE, and LS) for the competing estimators, together with information on the training/test split and fitted model specification.

Author(s)

Diego Gallardo, Tiago Magalhaes and Rafael Izbicki.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified parameterization of the beta distribution: A flexible and robust beta regression model. Statistica Neerlandica, 79(2), e70007.

Examples

set.seed(123)
n <- 100
x1 <- runif(n)
x2 <- runif(n)
x3 <- runif(n)
mu <- plogis(-1 + 2*x1 - x2)
y <- rBEGM(n, mu = mu, sigma = 15)
dat <- data.frame(y, x1, x2, x3)
## Adjusted LR test
RBE.skovgaard(y ~ x1 + x2 + x3, data = dat, reduced.fo = ~ x1 + x2, param = "GM")

## Predictive shrinkage
set.seed(123)
RBE.predictive(y ~ x1 + x2 + x3, data = dat, train = 0.8, param = "GM")

Tools for a reparameterized beta prime regression model

Description

A set of functions related to the reparameterized beta prime regression model based on different measures of central tendency: mean, median, mode, geometric mean or harmonic mean.

Usage

BPAM(mu.link = "log", sigma.link = "log") 
BPGM(mu.link = "log", sigma.link = "log") 
BPHM(mu.link = "log", sigma.link = "log") 
BPMD(mu.link = "log", sigma.link = "log") 
BPMO(mu.link = "log", sigma.link = "log") 
dBPAM(x, mu = 1, sigma = 1.5, log = FALSE) 
dBPGM(x, mu = 1, sigma = 1.5, log = FALSE) 
dBPHM(x, mu = 1, sigma = 1.5, log = FALSE) 
dBPMD(x, mu = 1, sigma = 1.5, log = FALSE) 
dBPMO(x, mu = 1, sigma = 1.5, log = FALSE) 
dRBP(x, mu=1, sigma=1.5, param="AM", log=FALSE)
fit.RBP(formula = formula(data), sigma.formula=~1, data, param="AM")
pBPAM(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
pBPGM(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
pBPHM(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
pBPMD(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
pBPMO(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE)
pRBP(q, mu = 1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE) 
qBPAM(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qBPGM(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qBPHM(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qBPMD(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qBPMO(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qRBP(p, mu = 1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE)
rBPAM(n, mu = 1, sigma = 1.5) 
rBPGM(n, mu = 1, sigma = 1.5) 
rBPHM(n, mu = 1, sigma = 1.5) 
rBPMD(n, mu = 1, sigma = 1.5) 
rBPMO(n, mu = 1, sigma = 1.5) 
rRBP(n, mu = 1, sigma=1.5, param="AM")

Arguments

mu.link

the mu link function with default log

sigma.link

the sigma link function with default log

mu, sigma

vector of parameter values

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

sigma.formula

a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~x1+x2.

param

parameterization used for the model. "AM" for mean, "MD" for median, "MO" for mode, "GM" for geometric mean, and "HM" for harmonic mean.

x, q

vector of quantiles

p

vector of probabilities

n

number of observations. If length(n)>1\mbox{length}(n) > 1, the length is taken to be the number required.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE, probabilities are P(Xx)P(X \leq x) otherwise, P(X>x)P(X>x).

Details

The parameterization for the reparameterized beta prime distribution is given by

f(x;μ,σ)=xμσ+τ11(1+x)(σ(1+μ)+τ1τ2+1)B(μσ+τ1,στ2+1),x>0,f(x; \mu, \sigma) = \frac{x^{\mu\,\sigma + \tau_1 -1}(1 + x)^{-(\sigma(1+\mu) + \tau_1-\tau_2+1)}}{B(\mu\,\sigma + \tau_1, \sigma - \tau_2 + 1)}, \quad x>0,

where δ=δ(σ)=(σ(σ+4)+σ)/2\delta=\delta(\sigma)=(\sqrt{\sigma(\sigma+4)}+\sigma)/2, 0<μ<10 < \mu < 1, σ>0\sigma > 0 and τ\tau is a constant. The following cases are highlighted:

- param="AM": τ=0\tau=0 and μ\mu represents the mean of the distribution.

- param="GM": τ=1/2\tau=1/2 and μ\mu represents the geometric mean of the distribution.

- param="MD": τ=1/3\tau=1/3 and μ\mu represents the median of the distribution.

- param="MO" or ="HM": τ=1\tau=1 and μ\mu represents the mode or the harmonic mean of the distribution.

Suppose the central tendency and the concentration parameter of YiY_i satisfies the following functional relations

log(μi)=xiξandlog(σi)=η2i=ziν,\log(\mu_i) = \mathbf{x}^\top_i\bm{\xi} \quad \textrm{and} \quad \log(\sigma_i) = \eta_{2i} = \mathbf{z}^\top_i\bm{\nu},

where ξ=(ξ1,,ξp)\bm{\xi} = (\xi_1, \ldots, \xi_p)^\top and ν=(ν1,,νq)\bm{\nu} = (\nu_1, \ldots, \nu_q)^\top are vectors of unknown regression coefficients which are assumed to be functionally independent, ξRp\bm{\xi} \in \mathbb{R}^p and νRq\bm{\nu} \in \mathbb{R}^q, with p+q<np + q < n, and xi=(xi1,,xip)\mathbf{x}_i = (x_{i1}, \ldots, x_{ip})^\top and zi=(zi1,,ziq)\mathbf{z}_i = (z_{i1}, \ldots, z_{iq})^\top are observations on pp and qq known regressors, for i=1,,ni = 1, \ldots, n. Furthermore, we assume that the covariate matrices X=(x1,,xn)\mathbf{X} = (\mathbf{x}_1, \ldots, \mathbf{x}_n)^\top and Z=(z1,,zn)\mathbf{Z} = (\mathbf{z}_1, \ldots, \mathbf{z}_n)^\top have rank pp and qq, respectively.

For this model, the Pearson's residuals are given by

ri=yimisi,i=1,,n,r_i=\frac{y_i-m_i}{s_i}, \quad i=1,\ldots,n,

where

mi=μiσi+τ1σiτ2+1andsi=(μiσi+τ1)((1+μi)σi+τ1τ2+1)(σi+τ1)(σiτ2)1/2.m_i=\frac{\mu_i \sigma_i+\tau_1}{\sigma_i-\tau_2+1} \quad \mbox{and} \quad s_i=\frac{(\mu_i \sigma_i+\tau_1)((1+\mu_i)\sigma_i+\tau_1-\tau_2+1)}{(\sigma_i+\tau-1)}(\sigma_i-\tau_2)^{-1/2}.

Note that the Pearson's residuals are well defined as long as σiτ2>1\sigma_i-\tau_2>1, i=1,,n\forall i=1,\ldots,n. On the other hand, the modified Pearson's residuals are given by

ri=logit(yi)misi,i=1,,n,r_i^*=\frac{\mbox{logit}(y_i)-m_i^*}{s_i^*}, \quad i=1,\ldots,n,

where

mi=ψ(μiσi+τ1)ψ((1+μi)σi+τ1τ2+1)andsi=ψ(μiσi+τ1)ψ((1+μi)σi+τ1τ2+1),m_i^*=\psi(\mu_i \sigma_i+\tau_1)-\psi((1+\mu_i)\sigma_i+\tau_1-\tau_2+1) \quad \mbox{and} \quad s_i^*=\sqrt{\psi'(\mu_i \sigma_i+\tau_1)-\psi'((1+\mu_i)\sigma_i+\tau_1-\tau_2+1)},

with ψ()\psi(\cdot) and ψ()\psi'(\cdot) denoting the digamma and trigamma functions, respectively. Finally, the quantile residuals are given by

riq=Φ1(Iyi1+yi(μiσi+τ1,(1+μi)σi+τ1τ2+1)),i=1,,n,r_i^q=\Phi^{-1}\left(I_{\frac{y_i}{1+y_i}}(\mu_i \sigma_i+\tau_1,(1+\mu_i)\sigma_i+\tau_1-\tau_2+1)\right), \quad i=1,\ldots,n,

where Φ1()\Phi^{-1}(\cdot) denotes the inverse of the cumulative distribution function for the standard normal model and Iy(α,β)=Bx(α,β)/B(α,β)I_y(\alpha,\beta)=B_x(\alpha, \beta)/B(\alpha, \beta) is the incomplete beta function ratio, Bx(α,β)=0xωα1(1ω)β1dωB_x(\alpha, \beta) = \int_{0}^{x}\omega^{\alpha-1}(1-\omega)^{\beta-1}\textrm{d} \omega is the incomplete beta function, B(α,β)=Γ(α)Γ(β)/Γ(α+β)B(\alpha, \beta) = \Gamma(\alpha)\Gamma(\beta)/\Gamma(\alpha + \beta) is the beta function and Γ(α)=0ωα1eωdω\Gamma(\alpha) = \int_{0}^{\infty}\omega^{\alpha-1}\textrm{e}^{-\omega}\textrm{d} \omega is the gamma function. dRBP gives the density, pRBP gives the distribution function, qRBP gives the quantile function, and rRBP generates random deviates from the beta prime distribution with the specified parameterization.

Value

an object of class "rregm" is returned. The object returned for these functions is a list containing the following components:

estimate

A matrix containing the estimates and standard errors.

logLik

the log-likelihood function evaluated at the corresponding estimators.

AIC

the Akaike information criterion.

BIC

the Bayesian information criterion.

tau1, tau2

values for tau1 and tau2, depending on the considered parameterization.

pearson.res

Pearson's residuals.

mod.pearson.res

modified Pearson's residuals.

quant.res

quantile residuals.

convergence

logical. If convergence was attained.

dist

BP (the beta prime distribution).

param

The specified parameterization.

mu.x

design matrix for mu.

sigma.x

design matrix for sigma.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified parameterization of the beta distribution: A flexible and robust beta regression model. Statistica Neerlandica, 79(2), e70007.

See Also

fit.RBE, fit.RGA, fit.RIG, fit.RLN, fit.RLL

Examples

set.seed(2100)
n=100; x1=rnorm(max(n)) ##drawing covariates, the same for mu and sigma
mu=exp(0.5-0.4*x1); sigma=exp(-0.1+0.05*x1)
y=rRBP(n, mu, sigma, param="MD") ## model parameterized in the median
data=list(y=y, x1=x1)
aux.RBP=fit.RBP(y~x1, sigma.formula=~x1, data=data, param="MD")
summary(aux.RBP)
qqnorm(res(aux.RBP, type="mod.pearson"))
#The beta prime model parameterized in the median also can be fitted using gamlss
#gamlss(y~x1, sigma.formula=~x1, data=data, family=BPMD)

Tools for a reparameterized gamma regression model

Description

A set of functions related to the reparameterized gamma regression model based on different measures of central tendency: mean, median, mode, geometric mean or harmonic mean.

Usage

GAM(mu.link = "log", sigma.link = "log") 
GGM(mu.link = "log", sigma.link = "log") 
GHM(mu.link = "log", sigma.link = "log") 
GMD(mu.link = "log", sigma.link = "log") 
GMO(mu.link = "log", sigma.link = "log") 
dGAM(x, mu = 1, sigma = 1, log = FALSE) 
dGGM(x, mu = 1, sigma = 1, log = FALSE) 
dGHM(x, mu = 1, sigma = 1, log = FALSE) 
dGMD(x, mu = 1, sigma = 1, log = FALSE) 
dGMO(x, mu = 1, sigma = 1, log = FALSE) 
dRGA(x, mu=1, sigma=1, param="AM", log=FALSE)
fit.RGA(formula = formula(data), sigma.formula=~1, data, param="AM")
pGAM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pGGM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pGHM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pGMD(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pGMO(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
pRGA(q, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) 
qGAM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qGGM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qGHM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qGMD(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qGMO(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qRGA(p, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE)
rGAM(n, mu = 1, sigma = 1) 
rGGM(n, mu = 1, sigma = 1) 
rGHM(n, mu = 1, sigma = 1) 
rGMD(n, mu = 1, sigma = 1) 
rGMO(n, mu = 1, sigma = 1) 
rRGA(n, mu=1, sigma=1, param="AM")

Arguments

mu.link

the mu link function with default log

sigma.link

the sigma link function with default log

mu, sigma

vector of parameter values

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

sigma.formula

a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~x1+x2.

param

parameterization used for the model. "AM" for mean, "MD" for median, "MO" for mode, "GM" for geometric mean, and "HM" for harmonic mean.

x, q

vector of quantiles

p

vector of probabilities

n

number of observations. If length(n)>1\mbox{length}(n) > 1, the length is taken to be the number required.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE, probabilities are P(Xx)P(X \leq x) otherwise, P(X>x)P(X>x).

Details

The parameterization for the reparameterized gamma distribution is given by

f(x;μ,σ)=(δ/μ)δ+τΓ(δ+τ)xδ+τ1eδx/μ,y>0,f(x; \mu, \sigma) = \frac{(\delta/\mu)^{\delta + \tau}}{\Gamma(\delta + \tau)}x^{\delta+\tau-1}\textrm{e}^{-\delta x/\mu}, \quad y > 0,

where δ=δ(σ)=(σ(σ+4)+σ)/2\delta=\delta(\sigma)=(\sqrt{\sigma(\sigma+4)}+\sigma)/2, μ>0\mu>0, σ>0\sigma > 0 and τ\tau is a constant. The following cases are highlighted:

- param="AM": τ=0\tau=0 and μ\mu represents the mean of the distribution.

- param="GM": τ=1/2\tau=1/2 and μ\mu represents the geometric mean of the distribution.

- param="MD": τ=1/3\tau=1/3 and μ\mu represents the median of the distribution.

- param="MO" or ="HM": τ=1\tau=1 and μ\mu represents the mode or the harmonic mean of the distribution.

Suppose the central tendency and the concentration parameter of YiY_i satisfies the following functional relations

log(μi)=xiξandlog(σi)=η2i=ziν,\log(\mu_i) = \mathbf{x}^\top_i\bm{\xi} \quad \textrm{and} \quad \log(\sigma_i) = \eta_{2i} = \mathbf{z}^\top_i\bm{\nu},

where ξ=(ξ1,,ξp)\bm{\xi} = (\xi_1, \ldots, \xi_p)^\top and ν=(ν1,,νq)\bm{\nu} = (\nu_1, \ldots, \nu_q)^\top are vectors of unknown regression coefficients which are assumed to be functionally independent, ξRp\bm{\xi} \in \mathbb{R}^p and νRq\bm{\nu} \in \mathbb{R}^q, with p+q<np + q < n, and xi=(xi1,,xip)\mathbf{x}_i = (x_{i1}, \ldots, x_{ip})^\top and zi=(zi1,,ziq)\mathbf{z}_i = (z_{i1}, \ldots, z_{iq})^\top are observations on pp and qq known regressors, for i=1,,ni = 1, \ldots, n. Furthermore, we assume that the covariate matrices X=(x1,,xn)\mathbf{X} = (\mathbf{x}_1, \ldots, \mathbf{x}_n)^\top and Z=(z1,,zn)\mathbf{Z} = (\mathbf{z}_1, \ldots, \mathbf{z}_n)^\top have rank pp and qq, respectively.

For this model, the Pearson's residuals are given by

ri=yimisi,i=1,,n,r_i=\frac{y_i-m_i}{s_i}, \quad i=1,\ldots,n,

where

mi=μi(1+τk(σi,τ))andsi=μk(σi,τ)τ+k(σi,τ),m_i=\mu_i\left(1+\frac{\tau}{k(\sigma_i,\tau)}\right) \quad \mbox{and} \quad s_i=\frac{\mu}{k(\sigma_i,\tau)}\sqrt{\tau+k(\sigma_i,\tau)},

where k(σi,τ)=(σi(σi+4τ)+σi)/2k(\sigma_i,\tau)=(\sqrt{\sigma_i(\sigma_i+4\tau)}+\sigma_i)/2. On the other hand, the modified Pearson's residuals are given by

ri=log(yi)misi,i=1,,n,r_i^*=\frac{\log(y_i)-m_i^*}{s_i^*}, \quad i=1,\ldots,n,

where

mi=ψ(τ+k(σi,τ))+logμilogk(σi,τ))andsi=ψ(τ+k(σi,τ)),m_i^*=\psi(\tau+k(\sigma_i,\tau))+\log \mu_i-\log k(\sigma_i,\tau)) \quad \mbox{and} \quad s_i^*=\sqrt{\psi'(\tau+k(\sigma_i,\tau))},

with ψ()\psi(\cdot) and ψ()\psi'(\cdot) denoting the digamma and trigamma functions, respectively. Finally, the quantile residuals are given by

riq=Φ1(γ(τ+k(σi,τ),k(σi,τ)yi/μiΓ(τ+k(σi,τ))),i=1,,n,r_i^q=\Phi^{-1}\left(\frac{\gamma(\tau+k(\sigma_i,\tau),k(\sigma_i,\tau) y_i/ \mu_i}{\Gamma(\tau+k(\sigma_i,\tau))}\right), \quad i=1,\ldots,n,

where Φ1()\Phi^{-1}(\cdot) denotes the inverse of the cumulative distribution function for the standard normal model and γ(a,z)=0zta1etdt\gamma(a,z) = \int_{0}^{z}t^{a-1}\textrm{e}^{-t}\textrm{d}t is the lower incomplete gamma function and Γ(α)=0ωα1eωdω\Gamma(\alpha) = \int_{0}^{\infty}\omega^{\alpha-1}\textrm{e}^{-\omega}\textrm{d} \omega is the gamma function. dRGA gives the density, pRGA gives the distribution function, qRGA gives the quantile function, and rRGA generates random deviates from the gamma distribution with the specified parameterization.

Value

an object of class "rregm" is returned. The object returned for these functions is a list containing the following components:

estimate

A matrix containing the estimates and standard errors.

logLik

the log-likelihood function evaluated at the corresponding estimators.

AIC

the Akaike information criterion.

BIC

the Bayesian information criterion.

tau1, tau2

values for tau1 and tau2, depending on the considered parameterization.

pearson.res

Pearson's residuals.

mod.pearson.res

modified Pearson's residuals.

quant.res

quantile residuals.

convergence

logical. If convergence was attained.

dist

GA (the gamma distribution).

param

The specified parameterization.

mu.x

design matrix for mu.

sigma.x

design matrix for sigma.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.

See Also

fit.RBE, fit.RBP, fit.RIG, fit.RLN, fit.RLL

Examples

set.seed(2100)
n=100; x1=rnorm(max(n)) ##drawing covariates, the same for mu and sigma
mu=exp(0.5-0.4*x1); sigma=exp(-0.1+0.05*x1)
y=rRGA(n, mu, sigma, param="MD") ## model parameterized in the median
data=list(y=y, x1=x1)
aux.RGA=fit.RGA(y~x1, sigma.formula=~x1, data=data, param="MD")
summary(aux.RGA)
qqnorm(res(aux.RGA, type="mod.pearson"))
#The gamma parameterized in the median also can be fitted using gamlss
#gamlss(y~x1, sigma.formula=~x1, data=data, family=GMD)

Tools for a reparameterized inverse gamma regression model

Description

A set of functions related to the reparameterized inverse gamma regression model based on different measures of central tendency: mean, median, mode, geometric mean or harmonic mean.

Usage

IGAM(mu.link = "log", sigma.link = "log") 
IGGM(mu.link = "log", sigma.link = "log") 
IGHM(mu.link = "log", sigma.link = "log") 
IGMD(mu.link = "log", sigma.link = "log") 
IGMO(mu.link = "log", sigma.link = "logshiftto1") 
dIGAM(x, mu = 1, sigma = 1, log = FALSE) 
dIGGM(x, mu = 1, sigma = 1, log = FALSE) 
dIGHM(x, mu = 1, sigma = 1, log = FALSE) 
dIGMD(x, mu = 1, sigma = 1, log = FALSE) 
dIGMO(x, mu = 1, sigma = 1.5, log = FALSE) 
dRIG(x, mu=1, sigma=1.5, param="AM", log=FALSE)
fit.RIG(formula = formula(data), sigma.formula=~1, data, param="AM")
pIGAM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pIGGM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pIGHM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pIGMD(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pIGMO(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE)
pRIG(q, mu=1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE) 
qIGAM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qIGGM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qIGHM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qIGMD(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qIGMO(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qRIG(p, mu=1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE)
rIGAM(n, mu = 1, sigma = 1) 
rIGGM(n, mu = 1, sigma = 1) 
rIGHM(n, mu = 1, sigma = 1) 
rIGMD(n, mu = 1, sigma = 1) 
rIGMO(n, mu = 1, sigma = 1.5) 
rRIG(n, mu=1, sigma=1.5, param="AM")

Arguments

mu.link

the mu link function with default log

sigma.link

the sigma link function with default log

mu, sigma

vector of parameter values

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

sigma.formula

a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~x1+x2.

param

parameterization used for the model. "AM" for mean, "MD" for median, "MO" for mode, "GM" for geometric mean, and "HM" for harmonic mean.

x, q

vector of quantiles

p

vector of probabilities

n

number of observations. If length(n)>1\mbox{length}(n) > 1, the length is taken to be the number required.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE, probabilities are P(Xx)P(X \leq x) otherwise, P(X>x)P(X>x).

Details

The parameterization for the reparameterized inverse gamma distribution is given by

f(y;μ,σ)=(σμ)σ+τΓ(σ+τ)yστ1eσμy,y>0,f(y; \mu, \sigma) = \frac{(\sigma \mu)^{\sigma + \tau}}{\Gamma(\sigma + \tau)}y^{-\sigma - \tau-1}\textrm{e}^{-\frac{\sigma \mu}{y}}, \quad y > 0,

where 0<μ<10 < \mu < 1, σ>0\sigma > 0 and τ\tau is a constant. The following cases are highlighted:

- param="AM": τ=1\tau=1 and μ\mu represents the mean of the distribution.

- param="GM": τ=1/2\tau=1/2 and μ\mu represents the geometric mean of the distribution.

- param="HM": τ=0\tau=0 and μ\mu represents the harmonic mean of the distribution.

- param="MO": τ=1\tau=-1 and μ\mu represents the mode of the distribution.

- param="MD": τ=1/3\tau=1/3 and μ\mu represents the median of the distribution.

Suppose the central tendency and the concentration parameter of YiY_i satisfies the following functional relations

log(μi)=xiξandlog(σi)=η2i=ziν,\log(\mu_i) = \mathbf{x}^\top_i\bm{\xi} \quad \textrm{and} \quad \log(\sigma_i) = \eta_{2i} = \mathbf{z}^\top_i\bm{\nu},

ξ=(ξ1,,ξp)\bm{\xi} = (\xi_1, \ldots, \xi_p)^\top and ν=(ν1,,νq)\bm{\nu} = (\nu_1, \ldots, \nu_q)^\top are vectors of unknown regression coefficients which are assumed to be functionally independent, ξRp\bm{\xi} \in \mathbb{R}^p and νRq\bm{\nu} \in \mathbb{R}^q, with p+q<np + q < n, and xi=(xi1,,xip)\mathbf{x}_i = (x_{i1}, \ldots, x_{ip})^\top and zi=(zi1,,ziq)\mathbf{z}_i = (z_{i1}, \ldots, z_{iq})^\top are observations on pp and qq known regressors, for i=1,,ni = 1, \ldots, n. Furthermore, we assume that the covariate matrices X=(x1,,xn)\mathbf{X} = (\mathbf{x}_1, \ldots, \mathbf{x}_n)^\top and Z=(z1,,zn)\mathbf{Z} = (\mathbf{z}_1, \ldots, \mathbf{z}_n)^\top have rank pp and qq, respectively.

For this model, the Pearson's residuals are given by

ri=yimisi,i=1,,n,r_i=\frac{y_i-m_i}{s_i}, \quad i=1,\ldots,n,

where

mi=μiσiσi+τ2andsi=μiσi(σi+τ1)(σi+τ2)1/2.m_i=\frac{\mu_i \sigma_i}{\sigma_i+\tau_2} \quad \mbox{and} \quad s_i=\frac{\mu_i \sigma_i}{(\sigma_i+\tau-1)}(\sigma_i+\tau-2)^{-1/2}.

Note that the Pearson's residuals are well defined as long as σi+τ>2\sigma_i+\tau>2, i=1,,n\forall i=1,\ldots,n. On the other hand, the modified Pearson's residuals are given by

ri=log(yi)misi,i=1,,n,r_i^*=\frac{-\log(y_i)-m_i^*}{s_i^*}, \quad i=1,\ldots,n,

where

mi=ψ(σi+τ)log(μiσi)andsi=ψ(σi+τ),m_i^*=\psi(\sigma_i+\tau)-\log(\mu_i \sigma_i) \quad \mbox{and} \quad s_i^*=\sqrt{\psi'(\sigma_i+\tau)},

with ψ()\psi(\cdot) and ψ()\psi'(\cdot) denoting the digamma and trigamma functions, respectively. Finally, the quantile residuals are given by

riq=Φ1(γ(σi+τ,μiσi/yi)Γ(σi+τ)),i=1,,n,r_i^q=\Phi^{-1}\left(\frac{\gamma(\sigma_i+\tau,\mu_i \sigma_i/y_i)}{\Gamma(\sigma_i+\tau)}\right), \quad i=1,\ldots,n,

where Φ1()\Phi^{-1}(\cdot) denotes the inverse of the cumulative distribution function for the standard normal model and γ(a,z)=0zta1etdt\gamma(a,z) = \int_{0}^{z}t^{a-1}\textrm{e}^{-t}\textrm{d}t is the lower incomplete gamma function and Γ(α)=0ωα1eωdω\Gamma(\alpha) = \int_{0}^{\infty}\omega^{\alpha-1}\textrm{e}^{-\omega}\textrm{d} \omega is the gamma function. dRIG gives the density, pRIG gives the distribution function, qRIG gives the quantile function, and rRIG generates random deviates from the inverse gamma distribution with the specified parameterization. In addition, dIGXX, pIGXX, qIGXX and rIGXX also provide the equivalent functions for a specified parameterization for XX: AM (mean), GM (geometric mean), HM (harmonic mean), MD (median) and MO (mode). For instance, dIGAM gives the density for the inverse gamma model parameterized in the mean, pIGGM gives the distribution function for the inverse gamma model parameterized in the geometric mean and so on. Finally, the functions IGAM, IGGM, IGHM, IGMD and IGMO also provide a framework to fit models with gamlss.

Value

an object of class "rregm" is returned. The object returned for these functions is a list containing the following components:

estimate

A matrix containing the estimates and standard errors.

logLik

the log-likelihood function evaluated at the corresponding estimators.

AIC

the Akaike information criterion.

BIC

the Bayesian information criterion.

tau

values for tau, depending on the considered parameterization.

pearson.res

Pearson's residuals.

mod.pearson.res

modified Pearson's residuals.

quant.res

quantile residuals.

convergence

logical. If convergence was attained.

dist

IG (the inverse gamma distribution).

param

The specified parameterization.

mu.x

design matrix for mu.

sigma.x

design matrix for sigma.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.

See Also

fit.RBE, fit.RGA, fit.RBP, fit.RLN, fit.RLL

Examples

set.seed(2100)
n=100; x1=rnorm(max(n)) ##drawing covariates, the same for mu and sigma
mu=exp(0.5-0.4*x1); sigma=exp(-0.1+0.05*x1)
y=rRIG(n, mu, sigma, param="MD") ## model parameterized in the median
data=list(y=y, x1=x1)
aux.RIG=fit.RIG(y~x1, sigma.formula=~x1, data=data, param="MD")
summary(aux.RIG)
qqnorm(res(aux.RIG, type="mod.pearson"))
#The inverse gamma model parameterized in the median also can be fitted using gamlss
#gamlss(y~x1, sigma.formula=~x1, data=data, family=IGMD)

Tools for a reparameterized log-logistic regression model

Description

A set of functions related to the reparameterized log-logistic regression model based on different parameterizations1: standard (LL), proportional odds (LL2), mean (LL3), harmonic mean (LL4), mode (LL5) and quantile (LL6).

Usage

LL(mu.link = "log", sigma.link = "log") 
LL2(mu.link = "log", sigma.link = "log") 
LL3(mu.link = "log", sigma.link = "logshiftto1") 
LL4(mu.link = "log", sigma.link = "logshiftto1") 
LL5(mu.link = "log", sigma.link = "logshiftto1") 
dLL(x, mu = 1, sigma = 1, log = FALSE)
dLL2(x, mu = 1, sigma = 1, log = FALSE)
dLL3(x, mu = 1, sigma = 1.5, log = FALSE)
dLL4(x, mu = 1, sigma = 1.5, log = FALSE)
dLL5(x, mu = 1, sigma = 1.5, log = FALSE)
dLL6(x, mu = 1, sigma = 1.5, nu=0.5, log = FALSE)
dRLL(x, mu=1, sigma=1.5, nu=0.5, param="LL", log=FALSE)
fit.RLL(formula = formula(data), sigma.formula = ~1, data, param = "LL", nu=0.5)
pLL(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pLL2(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pLL3(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
pLL4(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
pLL5(q, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
pLL6(q, mu = 1, sigma = 1.5, nu=0.5, lower.tail = TRUE, log.p = FALSE) 
pRLL(q, mu=1, sigma=1.5, nu=0.5, param="LL", lower.tail = TRUE, log.p = FALSE) 
qLL(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qLL2(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qLL3(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qLL4(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qLL5(p, mu = 1, sigma = 1.5, lower.tail = TRUE, log.p = FALSE) 
qLL6(p, mu = 1, sigma = 1.5, nu=0.5, lower.tail = TRUE, log.p = FALSE) 
qRLL(p, mu=1, sigma=1.5, nu=0.5, param="LL", log.p = FALSE)
rLL(n, mu = 1, sigma = 1) 
rLL2(n, mu = 1, sigma = 1) 
rLL3(n, mu = 1, sigma = 1.5) 
rLL4(n, mu = 1, sigma = 1.5) 
rLL5(n, mu = 1, sigma = 1.5) 
rLL6(n, mu = 1, sigma = 1.5, nu=0.5) 
rRLL(n, mu=1, sigma=1.5, nu=0.5, param="LL")

Arguments

mu.link

the mu link function with default log.

sigma.link

the sigma link function with default log for parameterizations1 LL, LL2 and LL6 and logshiftto1 for parameterizations1 LL3, LL4 and LL5.

mu, sigma

vector of parameter values

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

sigma.formula

a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~x1+x2.

param

parameterization used for the model. "LL" for standard, "LL2" for proportional odds, "LL3" for mean, "LL4" for harmonic mean, "LL5" for mode and "LL6" for quantile.

x, q

vector of quantiles

p

vector of probabilities

n

number of observations. If length(n)>1\mbox{length}(n) > 1, the length is taken to be the number required.

nu

quantile modeled (only for LL6 parametrization).

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE, probabilities are P(Xx)P(X \leq x) otherwise, P(X>x)P(X>x).

Details

The parameterization for the log-logistic distribution is given by

f(y;ρ,λ)=ρλ(t/λ)ρ1[1+(t/λ)ρ]2,y,λ,ρ>0.f(y; \rho,\lambda)=\frac{\rho}{\lambda}\frac{(t/\lambda)^{\rho-1}}{[1+(t/\lambda)^\rho]^2}, \quad y, \lambda, \rho >0.

The LL2–LL6 parameterizations1 corresponds to the following cases (ψ=π/ρ\psi=\pi/\rho):

- "LL2": σ=ρ\sigma=\rho and μ=λα\mu=\lambda^{-\alpha} (proportional odds).

- "LL3": σ=ρ\sigma=\rho and μ=ψλ/sin(ψ)\mu=\psi\lambda/\sin(\psi) represents the mean of the distribution.

- "LL4": σ=ρ\sigma=\rho and μ=λ/[ψsin(ψ)]\mu=\lambda/[\psi\sin(\psi)] represents the harmonic mean of the distribution.

- "LL5": σ=ρ\sigma=\rho and μ=λ(ρ1ρ+1)1/ρ\mu=\lambda\left(\frac{\rho-1}{\rho+1}\right)^{1/\rho} represents the mode of the distribution.

- "LL6": σ=ρ\sigma=\rho and μ=λ(ν1ν)1/ρ\mu=\lambda\left(\frac{\nu}{1-\nu}\right)^{1/\rho} represents the ν\nu-th quantile of the distribution.

For the LL, LL2 and LL6 parameterizations1, suppose the parameters μ\mu and σ\sigma satisfies the following functional relations

log(μi)=xiξandlog(σi)=η2i=ziν,\log(\mu_i) = \mathbf{x}^\top_i\bm{\xi} \quad \textrm{and} \quad \log(\sigma_i) = \eta_{2i} = \mathbf{z}^\top_i\bm{\nu},

where ξ=(ξ1,,ξp)\bm{\xi} = (\xi_1, \ldots, \xi_p)^\top and ν=(ν1,,νq)\bm{\nu} = (\nu_1, \ldots, \nu_q)^\top are vectors of unknown regression coefficients which are assumed to be functionally independent, ξRp\bm{\xi} \in \mathbb{R}^p and νRq\bm{\nu} \in \mathbb{R}^q, with p+q<np + q < n, and xi=(xi1,,xip)\mathbf{x}_i = (x_{i1}, \ldots, x_{ip})^\top and zi=(zi1,,ziq)\mathbf{z}_i = (z_{i1}, \ldots, z_{iq})^\top are observations on pp and qq known regressors, for i=1,,ni = 1, \ldots, n. Furthermore, we assume that the covariate matrices X=(x1,,xn)\mathbf{X} = (\mathbf{x}_1, \ldots, \mathbf{x}_n)^\top and Z=(z1,,zn)\mathbf{Z} = (\mathbf{z}_1, \ldots, \mathbf{z}_n)^\top have rank pp and qq, respectively.

For the LL3, LL4 and LL5 parameterizations1, suppose σ\sigma satisfies the following functional relations

log(σi1)=η2i=ziν,\log(\sigma_i-1) = \eta_{2i} = \mathbf{z}^\top_i\bm{\nu},

For this model, the Pearson's residuals are given by

ri=yimyi(vi),i=1,,n,r_i=\frac{y_i-m_{y_i}}{\sqrt(v_i)}, \quad i=1,\ldots,n,

where myi=lambdai(pi/sigmai)/sin(pi/sigmai)m_{y_i}=lambda_i*(pi/sigma_i)/sin(pi/sigma_i) and vi=(2lambdai2(pi/sigmai)/sin(2pi/sigmai)myi2)v_i=(2*lambda_i^2*(pi/sigma_i)/sin(2*pi/sigma_i)-m_{y_i}^2). On the other hand, the modified Pearson's residuals are given by

ri=yiλi(Vi),i=1,,n,r_i^*=\frac{y_i-\lambda_i}{\sqrt(V_i)}, \quad i=1,\ldots,n,

where Vi=pi/[sqrt(3)sigmai]V_i=pi/[sqrt(3)*sigma_i]. dRLL gives the density, pRLL gives the distribution function, qRLL gives the quantile function, and rRLL generates random deviates from the log-logistic distribution with the specified parameterization.

Value

an object of class "rregm" is returned. The object returned for these functions is a list containing the following components:

estimate

A matrix containing the estimates and standard errors.

logLik

the log-likelihood function evaluated at the corresponding estimators.

AIC

the Akaike information criterion.

BIC

the Bayesian information criterion.

pearson.res

Pearson's residuals.

mod.pearson.res

modified Pearson's residuals.

quant.res

quantile residuals.

convergence

logical. If convergence was attained.

dist

LL (the log-logistic distribution).

param

The specified parameterization.

mu.x

design matrix for mu.

sigma.x

design matrix for sigma.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.

See Also

fit.RBE, fit.RGA, fit.RBP, fit.RIG, fit.RLL

Examples

set.seed(2100)
n=100; x1=rnorm(max(n)) ##drawing covariates, the same for mu and sigma
mu=exp(0.5-0.4*x1); sigma=exp(-0.1+0.05*x1)
y=rRLL(n, mu, sigma, param="LL2") ## model parameterized in the median
data=list(y=y, x1=x1)
aux.RLL=fit.RLL(y~x1, sigma.formula=~x1, data=data, param="LL2")
summary(aux.RLL)
qqnorm(res(aux.RLL, type="mod.pearson"))
#The log-logistic model with this parameterization also can be fitted using gamlss
#gamlss(y~x1, sigma.formula=~x1, data=data, family=LL2)

Tools for a reparameterized log-normal regression model

Description

A set of functions related to the reparameterized log-normal regression model based on different measures of central tendency: mean, median, mode, geometric mean or harmonic mean.

Usage

LNAM(mu.link = "log", sigma.link = "log") 
LNGM(mu.link = "log", sigma.link = "log") 
LNHM(mu.link = "log", sigma.link = "log") 
LNMD(mu.link = "log", sigma.link = "log") 
LNMO(mu.link = "log", sigma.link = "log") 
dLNAM(x, mu = 1, sigma = 1, log = FALSE) 
dLNGM(x, mu = 1, sigma = 1, log = FALSE) 
dLNHM(x, mu = 1, sigma = 1, log = FALSE) 
dLNMD(x, mu = 1, sigma = 1, log = FALSE) 
dLNMO(x, mu = 1, sigma = 1, log = FALSE) 
dRLN(x, mu=1, sigma=1, param="AM", log=FALSE)
fit.RLN(formula = formula(data), sigma.formula=~1, data, param="AM")
pLNAM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pLNGM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pLNHM(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pLNMD(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
pLNMO(q, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE)
pRLN(q, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) 
qLNAM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qLNGM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qLNHM(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qLNMD(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qLNMO(p, mu = 1, sigma = 1, lower.tail = TRUE, log.p = FALSE) 
qRLN(p, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE)
rLNAM(n, mu = 1, sigma = 1) 
rLNGM(n, mu = 1, sigma = 1) 
rLNHM(n, mu = 1, sigma = 1) 
rLNMD(n, mu = 1, sigma = 1) 
rLNMO(n, mu = 1, sigma = 1) 
rRLN(n, mu=1, sigma=1, param="AM")

Arguments

mu.link

the mu link function with default logit

sigma.link

the sigma link function with default log

mu, sigma

vector of parameter values

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under ‘Details’.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which lm is called.

sigma.formula

a formula object for fitting a model to the sigma parameter, as in the formula above, e.g. sigma.formula=~x1+x2.

param

parameterization used for the model. "AM" for mean, "MD" for median, "MO" for mode, "GM" for geometric mean, and "HM" for harmonic mean.

x, q

vector of quantiles

p

vector of probabilities

n

number of observations. If length(n)>1\mbox{length}(n) > 1, the length is taken to be the number required.

log, log.p

logical; if TRUE, probabilities p are given as log(p).

lower.tail

logical; if TRUE, probabilities are P(Xx)P(X \leq x) otherwise, P(X>x)P(X>x).

Details

The parameterization for the reparameterized log-normal distribution is given by

f(x;μ,σ)=1xϕ2πexp ⁣[(lnxθ)22ϕ2],y>0,f(x; \mu, \sigma) = \dfrac{1}{x\,\phi\sqrt{2\pi}} \exp\!\left[-\dfrac{(\ln x - \theta)^2}{2\phi^2}\right], \quad y > 0,

where θ=log(μ)τϕ\theta=\log(\mu)-\tau \phi, ϕ=σ\phi=\sqrt{\sigma}, μ>0\mu > 0, σ>0\sigma > 0 and τ\tau is a constant. The following cases are highlighted:

- param="MO": τ=1\tau=-1 and μ\mu represents the mode of the distribution.

- param="HM": τ=1/2\tau=-1/2 and μ\mu represents the harmonic mean of the distribution.

- param="MD" or "GM": τ=0\tau=0 and μ\mu represents the median or the geometric mean of the distribution.

- param="AM": τ=1/2\tau=1/2 and μ\mu represents the mean of the distribution.

Suppose the central tendency and the concentration parameter of YiY_i satisfies the following functional relations

log(μi)=xiξandlog(σi)=η2i=ziν,\log(\mu_i) = \mathbf{x}^\top_i\bm{\xi} \quad \textrm{and} \quad \log(\sigma_i) = \eta_{2i} = \mathbf{z}^\top_i\bm{\nu},

where ξ=(ξ1,,ξp)\bm{\xi} = (\xi_1, \ldots, \xi_p)^\top and ν=(ν1,,νq)\bm{\nu} = (\nu_1, \ldots, \nu_q)^\top are vectors of unknown regression coefficients which are assumed to be functionally independent, ξRp\bm{\xi} \in \mathbb{R}^p and νRq\bm{\nu} \in \mathbb{R}^q, with p+q<np + q < n, and xi=(xi1,,xip)\mathbf{x}_i = (x_{i1}, \ldots, x_{ip})^\top and zi=(zi1,,ziq)\mathbf{z}_i = (z_{i1}, \ldots, z_{iq})^\top are observations on pp and qq known regressors, for i=1,,ni = 1, \ldots, n. Furthermore, we assume that the covariate matrices X=(x1,,xn)\mathbf{X} = (\mathbf{x}_1, \ldots, \mathbf{x}_n)^\top and Z=(z1,,zn)\mathbf{Z} = (\mathbf{z}_1, \ldots, \mathbf{z}_n)^\top have rank pp and qq, respectively.

For this model, the Pearson's residuals are given by

ri=yiexp(θi+ϕi2/2)((exp(ϕi2)1)exp(2θi+ϕi2)),i=1,,n.r_i=\frac{y_i-exp(\theta_i+\phi_i^2/2)}{\sqrt((\exp(\phi_i^2)-1)\exp(2*\theta_i+\phi_i^2))}, \quad i=1,\ldots,n.

On the other hand, the modified Pearson's residuals are given by

ri=log(yi)θiϕi,i=1,,n,r_i^*=\frac{\log(y_i)-\theta_i}{\phi_i}, \quad i=1,\ldots,n,

which coincide with the quantile residuals. dRLN gives the density, pRLN gives the distribution function, qRLN gives the quantile function, and rRLN generates random deviates from the log-normal distribution with the specified parameterization.

Value

an object of class "rregm" is returned. The object returned for these functions is a list containing the following components:

estimate

A matrix containing the estimates and standard errors.

logLik

the log-likelihood function evaluated at the corresponding estimators.

AIC

the Akaike information criterion.

BIC

the Bayesian information criterion.

tau1, tau2

values for tau1 and tau2, depending on the considered parameterization.

pearson.res

Pearson's residuals.

mod.pearson.res

modified Pearson's residuals.

quant.res

quantile residuals.

convergence

logical. If convergence was attained.

dist

LN (the log-normal distribution).

param

The specified parameterization.

mu.x

design matrix for mu.

sigma.x

design matrix for sigma.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.

See Also

fit.RBE, fit.RGA, fit.RBP, fit.RIG, fit.RLL

Examples

set.seed(2100)
n=100; x1=rnorm(max(n)) ##drawing covariates, the same for mu and sigma
mu=exp(0.5-0.4*x1); sigma=exp(-0.1+0.05*x1)
y=rRLN(n, mu, sigma, param="MD") ## model parameterized in the median
data=list(y=y, x1=x1)
aux.RLN=fit.RLN(y~x1, sigma.formula=~x1, data=data, param="MD")
summary(aux.RLN)
qqnorm(res(aux.RLN, type="mod.pearson"))
#The log-normal model parameterized in the median also can be fitted using gamlss
#gamlss(y~x1, sigma.formula=~x1, data=data, family=LNMD)

Print a summary for a object of the "rregm" class.

Description

Tools for a objects of the "rregm" class.

Usage

res(object, type="pearson")
## S3 method for class 'rregm'
AIC(object, ..., k=2)
## S3 method for class 'rregm'
BIC(object, ...)
## S3 method for class 'rregm'
coef(object, ...)
## S3 method for class 'rregm'
logLik(object, ...)
## S3 method for class 'LRskov'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'rregm'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'rregm'
summary(object, ...)

Arguments

x, object

an object of the "rregm" class.

type

type of residuals to be presented: pearson (default), mod.pearson or quantile.

digits

minimal number of significant digits

k

numeric, the penalty per parameter to be used; the default k = 2 is the classical AIC.

...

for extra arguments.

Details

Supported regression models are: - reparametrized beta - reparametrized gamma - reparametrized beta prime - reparametrized inverse gamma - reparametrized log-normal

Value

A complete summary for the coefficients extracted from a "rregm" or "LRskov" object.

Author(s)

Diego Gallardo and Marcelo Bourguignon.

References

Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.

Examples

set.seed(2100)
n=100; x1=rnorm(max(n)) ##drawing covariates, the same for mu and sigma
mu=exp(0.5-0.4*x1); sigma=exp(-0.1+0.05*x1)
y=rRGA(n, mu, sigma, param="MD") ## model parameterized in the median
data=list(y=y, x1=x1)
aux.RGA=fit.RGA(y~x1, sigma.formula=~x1, data=data, param="MD")
summary(aux.RGA)
qqnorm(res(aux.RGA, type="mod.pearson"))