Title: | Estimation and Additional Tools for Quantile Generalized Beta Regression Model |
---|---|
Description: | Provide estimation and data generation tools for the quantile generalized beta regression model. For details, see Bourguignon, Gallardo and Saulo <arXiv:2110.04428> The package also provides tools to perform covariates selection. |
Authors: | Diego Gallardo [aut, cre], Marcelo Bourguignon [aut] |
Maintainer: | Diego Gallardo <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1 |
Built: | 2024-12-15 07:18:52 UTC |
Source: | CRAN |
Density, distribution function, quantile function and random generation for the generalized beta distribution.
dBE3(x, mu = 0.5, alpha = 1, beta = 1, tau = 0.5, log = FALSE) pBE3(q, mu = 0.5, alpha = 1, beta = 1, tau = 0.5, lower.tail = TRUE, log.p = FALSE) qBE3(p, mu = 0.5, alpha = 1, beta = 1, tau = 0.5) rBE3(n, mu = 0.5, alpha = 1, beta = 1, tau = 0.5)
dBE3(x, mu = 0.5, alpha = 1, beta = 1, tau = 0.5, log = FALSE) pBE3(q, mu = 0.5, alpha = 1, beta = 1, tau = 0.5, lower.tail = TRUE, log.p = FALSE) qBE3(p, mu = 0.5, alpha = 1, beta = 1, tau = 0.5) rBE3(n, mu = 0.5, alpha = 1, beta = 1, tau = 0.5)
x , q
|
vector of quantiles. |
p |
vector of probabilities. |
n |
number of observations. |
mu |
vector of |
alpha , beta
|
shape parameters of the distribution |
tau |
corresponding quantile of the distribution ( |
log , log.p
|
logical; if TRUE, probabilities |
lower.tail |
logical; if TRUE (default), probabilities are |
The probability density function for the generalized beta distribution is
where and
.
We consider the reparameterization in terms of the
-quantile of the distribution, say
, taking
with denoting the
-quantile of the usual beta distribution with shape parameters
and
.
The cumulative distribution function is given by
where is the incomplete beta funcion ratio,
is the incomplete beta function and
is the ordinary beta function.
The quantile of the distribution can be represented as
Random generation can be performed using the stochastic representation of the model. If and
, then
where
dBE3 gives the density, pBE3 gives the distribution function, qBE3 gives the quantile function, and rBE3 generates random deviates.
The length of the result is determined by n for rBE3, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
Diego Gallardo and Marcelo Bourguignon
Libby, D. L. and Novick, M. R. (1982). Multivariate generalized beta-distributions with applications to utility assessment. Journal of Educational Statistics, 7.
rBE3(20, mu=0.5, alpha=2, beta=1) dBE3(c(0.4,0.7), mu=0.5, alpha=2, beta=1) pBE3(c(0.4,0.7), mu=0.5, alpha=2, beta=1)
rBE3(20, mu=0.5, alpha=2, beta=1) dBE3(c(0.4,0.7), mu=0.5, alpha=2, beta=1) pBE3(c(0.4,0.7), mu=0.5, alpha=2, beta=1)
BE3.backward.crit implements the covariates selection based on backward and the Akaike's information criteria (AIC). BE3.backward.sign implements the covariates selection based on backward and significance of the covariates.
BE3.backward.crit(data, tau = 0.5, link.mu = "logit")
BE3.backward.crit(data, tau = 0.5, link.mu = "logit")
data |
a list containing the response vector ( |
tau |
the quantile of the distribution to be modelled ( |
link.mu |
link function to be used for |
A list containg the covariates to be included for modelling ,
and
, respectively.
Diego Gallardo and Marcelo Bourguignon.
##Simulating two covariates set.seed(2100) x1<-rnorm(200); x2<-rbinom(200, size=1, prob=0.5) ##Desing matrices: Z1 includes x1 and x2, ##Z2 includes only x1 and Z3 includes only x2 Z1=model.matrix(~x1+x2);Z2=model.matrix(~x1);Z3=model.matrix(~x2) ##Fixing parameters theta=c(1, 0.2, -0.5); nu=c(0.5,-0.2); eta=c(-0.5, 0.3); tau=0.4 mu=plogis(Z1%*%theta); alpha=exp(Z2%*%nu); beta=exp(Z3%*%eta) y=rBE3(200, mu, alpha, beta, tau=tau) data=list(y=y, Z1=Z1, Z2=Z2, Z3=Z3) BE3.backward.crit(data, tau = tau)
##Simulating two covariates set.seed(2100) x1<-rnorm(200); x2<-rbinom(200, size=1, prob=0.5) ##Desing matrices: Z1 includes x1 and x2, ##Z2 includes only x1 and Z3 includes only x2 Z1=model.matrix(~x1+x2);Z2=model.matrix(~x1);Z3=model.matrix(~x2) ##Fixing parameters theta=c(1, 0.2, -0.5); nu=c(0.5,-0.2); eta=c(-0.5, 0.3); tau=0.4 mu=plogis(Z1%*%theta); alpha=exp(Z2%*%nu); beta=exp(Z3%*%eta) y=rBE3(200, mu, alpha, beta, tau=tau) data=list(y=y, Z1=Z1, Z2=Z2, Z3=Z3) BE3.backward.crit(data, tau = tau)
Density, distribution function and quantile function for the Gumbel2 distribution.
dgumbel2(x, log=FALSE) pgumbel2(q) qgumbel2(p)
dgumbel2(x, log=FALSE) pgumbel2(q) qgumbel2(p)
x , q
|
Vector of quantiles. |
p |
Vector of probabilities. |
log |
logical; if TRUE, probabilities p are given as log(p). |
The cumulative distribution function for the Gumbel2 distribution is given by
dgumbel2 gives the density, pgumbel2 gives the distribution function and qgumbel2 gives the quantile function.
The length of the result is determined by the maximum of the lengths of the numerical arguments.
Diego Gallardo and Marcelo Bourguignon.
dgumbel2(c(4,10)) pgumbel2(c(4,10)) qgumbel2(c(0.1, 0.5))
dgumbel2(c(4,10)) pgumbel2(c(4,10)) qgumbel2(c(0.1, 0.5))
ML.BE3 computes the maximum likelihood estimates based on the maximum likelihood method.
ML.BE3(data, tau = 0.5, link.mu = "logit")
ML.BE3(data, tau = 0.5, link.mu = "logit")
data |
a list containing the response vector ( |
tau |
the quantile of the distribution to be modelled ( |
link.mu |
link function to be used for |
Covariates are included as ,
and
, where
,
and
, where
and
are the dimensions of
and
, respectively.
Initial values for
are used as the coefficients for the linear regresion in
using the elements of
as regressors. Initial values for the other coefficients are considered as zeros.
a list containing the following elements
estimate |
A matrix with the estimates |
logLik |
The maximum likelihood values attached by the estimates parameters |
Diego Gallardo and Marcelo Bourguignon.
Bourguignon, M., Gallardo, D.I., Saulo, H. (2023) A parametric quantile beta regression for modeling case fatality rates of COVID-19. Submitted.
##Simulating two covariates set.seed(2100) x1<-rnorm(200); x2<-rbinom(200, size=1, prob=0.5) ##Desing matrices: Z1 includes x1 and x2, ##Z2 includes only x1 and Z3 includes only x2 Z1=model.matrix(~x1+x2);Z2=model.matrix(~x1);Z3=model.matrix(~x2) ##Fixing parameters theta=c(1, 0.2, -0.5); nu=c(0.5,-0.2); eta=c(-0.5, 0.3); tau=0.4 mu=plogis(Z1%*%theta); alpha=exp(Z2%*%nu); beta=exp(Z3%*%eta) y=rBE3(200, mu, alpha, beta, tau=tau) data=list(y=y, Z1=Z1, Z2=Z2, Z3=Z3) ML.BE3(data, tau=tau)
##Simulating two covariates set.seed(2100) x1<-rnorm(200); x2<-rbinom(200, size=1, prob=0.5) ##Desing matrices: Z1 includes x1 and x2, ##Z2 includes only x1 and Z3 includes only x2 Z1=model.matrix(~x1+x2);Z2=model.matrix(~x1);Z3=model.matrix(~x2) ##Fixing parameters theta=c(1, 0.2, -0.5); nu=c(0.5,-0.2); eta=c(-0.5, 0.3); tau=0.4 mu=plogis(Z1%*%theta); alpha=exp(Z2%*%nu); beta=exp(Z3%*%eta) y=rBE3(200, mu, alpha, beta, tau=tau) data=list(y=y, Z1=Z1, Z2=Z2, Z3=Z3) ML.BE3(data, tau=tau)