| Title: | Reparameterized Regression Models |
|---|---|
| Description: | Provides estimation and data generation tools for several new regression models, including the gamma, beta, inverse gamma and beta prime distributions. These models can be parameterized based on the mean, median, mode, geometric mean and harmonic mean, as specified by the user. For details, see Bourguignon and Gallardo (2025a) <doi:10.1016/j.chemolab.2025.105382> and Bourguignon and Gallardo (2025b) <doi:10.1111/stan.70007>. |
| Authors: | Diego Gallardo [aut, cre], Marcelo Bourguignon [aut], Marcia Brandao [aut] |
| Maintainer: | Diego Gallardo <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 1.1 |
| Built: | 2026-05-11 05:51:21 UTC |
| Source: | https://github.com/cran/rregm |
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.
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")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")
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 |
log, log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE, probabilities are |
The parameterization for the reparameterized beta distribution is given by
where , and and are constant. The following cases are highlighted:
- param="AM": and represents the mean of the distribution.
- param="GM": and represents the geometric mean of the distribution.
- param="HM": and represents the harmonic mean of the distribution.
- param="MO": and and represents the mode of the distribution.
- param="MD": and and represents the median of the distribution.
Suppose the central tendency and the concentration parameter of satisfies the following functional relations
where is the logit function, and
are vectors of unknown regression coefficients which are assumed to be functionally independent,
and , with ,
and
and are observations on and known regressors, for .
Furthermore, we assume that the covariate matrices and
have rank and , respectively.
For this model, the Pearson's residuals are given by
where
whereas the modified Pearson's residuals are given by
where
with and denoting the digamma and trigamma functions, respectively.
Finally, the quantile residuals are given by
where denotes the inverse of the cumulative distribution function for the standard normal model and
is the incomplete beta function ratio, is the incomplete beta function,
is the beta function and
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 provides 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.
an object of class "rregm" is returned. The object returned for this 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. |
Diego Gallardo and Marcelo Bourguignon.
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.
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)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)
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.
fit.RBP(formula = formula(data), sigma.formula=~1, data, param="AM") dRBP(x, mu=1, sigma=1.5, param="AM", log=FALSE) pRBP(q, mu=1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE) qRBP(p, mu=1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE) rRBP(n, mu=1, sigma=1.5, param="AM")fit.RBP(formula = formula(data), sigma.formula=~1, data, param="AM") dRBP(x, mu=1, sigma=1.5, param="AM", log=FALSE) pRBP(q, mu=1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE) qRBP(p, mu=1, sigma=1.5, param="AM", lower.tail = TRUE, log.p = FALSE) rRBP(n, mu=1, sigma=1.5, param="AM")
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 |
log, log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE, probabilities are |
The parameterization for the reparameterized beta prime distribution is given by
where , , and
is a constant. The following cases are highlighted:
- param="AM": and represents the mean of the distribution.
- param="GM": and represents the geometric mean of the distribution.
- param="MD": and represents the median of the distribution.
- param="MO" or ="HM": and represents the mode or the harmonic mean of the distribution.
Suppose the central tendency and the concentration parameter of satisfies the following functional relations
where and
are vectors of unknown regression coefficients which are assumed to be functionally independent,
and , with ,
and
and are observations on and known regressors, for .
Furthermore, we assume that the covariate matrices and
have rank and , respectively.
For this model, the Pearson's residuals are given by
where
Note that the Pearson's residuals are well defined as long as , .
On the other hand, the modified Pearson's residuals are given by
where
with and denoting the digamma and trigamma functions, respectively.
Finally, the quantile residuals are given by
where denotes the inverse of the cumulative distribution function for the standard normal model and
is the incomplete beta function ratio, is the incomplete beta function,
is the beta function and
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 distribution with the specified
parameterization.
an object of class "rregm" is returned. The object returned for this 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. |
Diego Gallardo and Marcelo Bourguignon.
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.
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"))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"))
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.
fit.RGA(formula = formula(data), sigma.formula=~1, data, param="AM") dRGA(x, mu=1, sigma=1, param="AM", log=FALSE) pRGA(q, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) qRGA(p, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) rRGA(n, mu=1, sigma=1, param="AM")fit.RGA(formula = formula(data), sigma.formula=~1, data, param="AM") dRGA(x, mu=1, sigma=1, param="AM", log=FALSE) pRGA(q, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) qRGA(p, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) rRGA(n, mu=1, sigma=1, param="AM")
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 |
log, log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE, probabilities are |
The parameterization for the reparameterized gamma distribution is given by
where , , and
is a constant. The following cases are highlighted:
- param="AM": and represents the mean of the distribution.
- param="GM": and represents the geometric mean of the distribution.
- param="MD": and represents the median of the distribution.
- param="MO" or ="HM": and represents the mode or the harmonic mean of the distribution.
Suppose the central tendency and the concentration parameter of satisfies the following functional relations
where and
are vectors of unknown regression coefficients which are assumed to be functionally independent,
and , with ,
and
and are observations on and known regressors, for .
Furthermore, we assume that the covariate matrices and
have rank and , respectively.
For this model, the Pearson's residuals are given by
where
where .
On the other hand, the modified Pearson's residuals are given by
where
with and denoting the digamma and trigamma functions, respectively.
Finally, the quantile residuals are given by
where denotes the inverse of the cumulative distribution function for the standard normal model and
is the lower incomplete gamma
function and 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.
an object of class "rregm" is returned. The object returned for this 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. |
Diego Gallardo and Marcelo Bourguignon.
Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.
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"))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"))
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.
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")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")
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 |
log, log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE, probabilities are |
The parameterization for the reparameterized inverse gamma distribution is given by
where , and is a constant. The following cases are highlighted:
- param="AM": and represents the mean of the distribution.
- param="GM": and represents the geometric mean of the distribution.
- param="HM": and represents the harmonic mean of the distribution.
- param="MO": and represents the mode of the distribution.
- param="MD": and represents the median of the distribution.
Suppose the central tendency and the concentration parameter of satisfies the following functional relations
and
are vectors of unknown regression coefficients which are assumed to be functionally independent,
and , with ,
and
and are observations on and known regressors, for .
Furthermore, we assume that the covariate matrices and
have rank and , respectively.
For this model, the Pearson's residuals are given by
where
Note that the Pearson's residuals are well defined as long as , .
On the other hand, the modified Pearson's residuals are given by
where
with and denoting the digamma and trigamma functions, respectively.
Finally, the quantile residuals are given by
where denotes the inverse of the cumulative distribution function for the standard normal model and
is the lower incomplete gamma
function and 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 provides 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.
an object of class "rregm" is returned. The object returned for this 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 |
IG (the inverse gamma distribution). |
param |
The specified parameterization. |
mu.x |
design matrix for mu. |
sigma.x |
design matrix for sigma. |
Diego Gallardo and Marcelo Bourguignon.
Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.
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)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)
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.
fit.RLN(formula = formula(data), sigma.formula=~1, data, param="AM") dRLN(x, mu=1, sigma=1, param="AM", log=FALSE) pRLN(q, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) qRLN(p, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) rRLN(n, mu=1, sigma=1, param="AM")fit.RLN(formula = formula(data), sigma.formula=~1, data, param="AM") dRLN(x, mu=1, sigma=1, param="AM", log=FALSE) pRLN(q, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) qRLN(p, mu=1, sigma=1, param="AM", lower.tail = TRUE, log.p = FALSE) rRLN(n, mu=1, sigma=1, param="AM")
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 |
log, log.p
|
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE, probabilities are |
The parameterization for the reparameterized log-normal distribution is given by
where , , , and
is a constant. The following cases are highlighted:
- param="MO": and represents the mode or the harmonic mean of the distribution.
- param="HM": and represents the harmonic mean of the distribution.
- param="MD" or "GM": and represents the median or the geometric mean of the distribution.
- param="AM": and represents the mean of the distribution.
Suppose the central tendency and the concentration parameter of satisfies the following functional relations
where and
are vectors of unknown regression coefficients which are assumed to be functionally independent,
and , with ,
and
and are observations on and known regressors, for .
Furthermore, we assume that the covariate matrices and
have rank and , respectively.
For this model, the Pearson's residuals are given by
On the other hand, the modified Pearson's residuals are given by
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.
an object of class "rregm" is returned. The object returned for this 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. |
Diego Gallardo and Marcelo Bourguignon.
Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.
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"))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"))
Tools for a objects of the "rregm" class.
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 'rregm' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S3 method for class 'rregm' summary(object, ...)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 'rregm' print(x, digits = max(3L, getOption("digits") - 3L), ...) ## S3 method for class 'rregm' summary(object, ...)
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. |
Supported regression models are: - reparametrized beta - reparametrized gamma - reparametrized beta prime - reparametrized inverse gamma
A complete summary for the coefficients extracted from a "rregm" object.
Diego Gallardo and Marcelo Bourguignon.
Bourguignon, M., Gallardo, D.I. (2025) A general and unified class of gamma regression models. Chemometrics and Intelligent Laboratory Systems, 261, 105382.
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"))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"))