Type: | Package |
Title: | Classic Gamma Regression: Joint Modeling of Mean and Shape Parameters |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
Version: | 3.0.1 |
Date: | 2020-07-01 |
Author: | Martha Corrales and Edilberto Cepeda-Cuervo, with the colaboration of Margarita Marin, Maria Fernanda Zarate, Ricardo Duplat and Campo Elias Pardo. |
Maintainer: | Martha Corrales <martha.corrales@usa.edu.co> |
Depends: | R (≥ 4.0.0) |
Description: | Performs Gamma regression, where both mean and shape parameters follows lineal regression structures. |
Encoding: | UTF-8 |
Packaged: | 2023-12-14 15:57:23 UTC; hornik |
NeedsCompilation: | no |
Repository: | CRAN |
Date/Publication: | 2023-12-14 16:06:23 UTC |
classic gamma regression: joint modeling of mean and shape parameters
Description
Classic gamma regression package
Details
Package: | Gammareg |
Type: | Package |
Version: | 1.1 |
Date: | 2014-01-23 |
License: | GPL-2 |
LazyLoad: | yes |
Author(s)
Martha Corrales and Edilberto Cepeda-Cuervo with the colaboration of Maria Fernanda Zarate, Ricardo Duplat and Campo Elias Pardo.
Gammareg
Description
Function to do Classic Gamma Regression: joint mean and shape modeling
Usage
Gammareg(formula1,formula2,meanlink)
Arguments
formula1 |
object of class matrix, with the dependent variable. |
formula2 |
object of class matrix, with the variables for modelling the mean. |
meanlink |
links for the mean. The default links is the link log. The link identity is also allowed as admisible value. |
Details
The classic gamma regression allow the joint modelling of mean and shape parameters of a gamma distributed variable, as is proposed in Cepeda (2001), using the Fisher Socring algorithm, with two differentes link for the mean: log and identity, and log link for the shape.
Value
object of class bayesbetareg with:
coefficients |
object of class matrix with the estimated coefficients of beta and gamma. |
desvB |
object of class matrix with the estimated covariances of beta. |
desvG |
object of class matrix with the estimated covariances of gamma. |
interv |
object of class matrix with the estimated confidence intervals of beta and gamma. |
AIC |
the AIC criteria. |
iteration |
numbers of iterations to convergence. |
convergence |
value of convergence obtained. |
call |
Call. |
Author(s)
Martha Corrales martha.corrales@usa.edu.co Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo, E. (2001). Modelagem da variabilidade em modelos lineares generalizados. Unpublished Ph.D. tesis. Instituto de Matemáticas. Universidade Federal do Río do Janeiro. //http://www.docentes.unal.edu.co/ecepedac/docs/MODELAGEM20DA20VARIABILIDADE.pdf. http://www.bdigital.unal.edu.co/9394/. 2. McCullagh, P. and Nelder, N.A. (1989). Generalized Linear Models. Second Edition. Chapman and Hall.
Examples
#
num.killed <- c(7,59,115,149,178,229,5,43,76,4,57,83,6,57,84)
size.sam <- c(1,2,3,3,3,3,rep(1,9))*100
insecticide <- c(4,5,8,10,15,20,2,5,10,2,5,10,2,5,10)
insecticide.2 <- insecticide^2
synergist <- c(rep(0,6),rep(3.9,3),rep(19.5,3),rep(39,3))
par(mfrow=c(2,2))
plot(density(num.killed/size.sam),main="")
boxplot(num.killed/size.sam)
plot(insecticide,num.killed/size.sam)
plot(synergist,num.killed/size.sam)
mean.for <- (num.killed/size.sam) ~ insecticide + insecticide.2
dis.for <- ~ synergist + insecticide
res=Gammareg(mean.for,dis.for,meanlink="ide")
summary(glm((num.killed/size.sam) ~ insecticide + insecticide.2,family=Gamma("log")))
summary(res)
# Simulation Example
X1 <- rep(1,500)
X2 <- runif(500,0,30)
X3 <- runif(500,0,15)
X4 <- runif(500,10,20)
mui <- 15 + 2*X2 + 3*X3
alphai <- exp(0.2 + 0.1*X2 + 0.3*X4)
Y <- rgamma(500,shape=alphai,scale=mui/alphai)
X <- cbind(X1,X2,X3)
Z <- cbind(X1,X2,X4)
formula.mean= Y~X2+X3
formula.shape= ~X2+X4
a=Gammareg(formula.mean,formula.shape,meanlink="ide")
summary(a)
Classic gamma regression. Log link for the mean
Description
Performs the Classic Gamma Regression for joint modeling of mean and shape parameters.
Usage
gammahetero1(formula1, formula2)
Arguments
formula1 |
object of class formula. It describes yi and xi for the mean equation of the gamma regression. |
formula2 |
object of class formula. It describes zi for the shape equation of the gamma regression. |
Details
The classic gamma regression allow the joint modeling of mean and shape parameters of a gamma distributed variable, as is proposed in Cepeda (2001), using the Fisher Scoring algorithm, with log link for the mean and log link for the shape.
Value
object of class Gammareg
with the following:
X |
object of class matrix, with the variables for modelling the mean. |
Z |
object of class matrix, with the variables for modelling the shape. |
beta |
object of class matrix with the estimated coefficients of beta. |
gamma |
object of class matrix with the estimated coefficients of gamma. |
ICB |
object of class matrix with the estimated confidence intervals of beta. |
ICG |
object of class matrix with the estimated confidence intervals of gamma. |
CovarianceMatrixbeta |
object of class matrix with the estimated covariances of beta. |
CovarianceMatrixgamma |
object of class matrix with the estimated covariances of gamma. |
AIC |
the AIC criteria. |
iteration |
numbers of iterations to convergence. |
convergence |
value of convergence obtained. |
Author(s)
Martha Corrales martha.corrales@usa.edu.co Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo, E. (2001). Modelagem da variabilidade em modelos lineares generalizados. Unpublished Ph.D. tesis. Instituto de Matemáticas. Universidade Federal do Río do Janeiro. //http://www.docentes.unal.edu.co/ecepedac/docs/MODELAGEM20DA20VARIABILIDADE.pdf. http://www.bdigital.unal.edu.co/9394/. 2. McCullagh, P. and Nelder, N.A. (1989). Generalized Linear Models. Second Edition. Chapman and Hall.
Examples
# Simulation Example
X1 <- rep(1,500)
X2 <- log(runif(500,0,30))
X3 <- log(runif(500,0,15))
X4 <- log(runif(500,10,20))
mui <- exp(-5 + 0.2*X2 - 0.03*X3)
alphai <- exp(0.2 + 0.1*X2 + 0.3*X4)
Y <- rgamma(500,shape=alphai,scale=mui/alphai)
X <- cbind(X1,X2,X3)
Z <- cbind(X1,X2,X4)
formula.mean= Y~X2+X3
formula.shape= ~X2+X4
a=gammahetero1(formula.mean,formula.shape)
a
Classic gamma regression. Identity link for the mean
Description
Performs the Classic Gamma Regression for joint modeling of mean and shape parameters.
Usage
gammahetero2(formula1, formula2)
Arguments
formula1 |
object of class formula. It describes yi and xi for the mean equation of the gamma regression. |
formula2 |
object of class formula. It describes zi for the shape equation of the gamma regression. |
Details
The classic gamma regression allow the joint modeling of mean and shape parameters of a gamma distributed variable, as is proposed in Cepeda (2001), using the Fisher Scoring algorithm, with log link for the mean and log link for the shape.
Value
object of class Gammareg
with the following:
X |
object of class matrix, with the variables for modelling the mean. |
Z |
object of class matrix, with the variables for modelling the shape. |
beta |
object of class matrix with the estimated coefficients of beta. |
gamma |
object of class matrix with the estimated coefficients of gamma. |
ICB |
object of class matrix with the estimated confidence intervals of beta. |
ICG |
object of class matrix with the estimated confidence intervals of gamma. |
CovarianceMatrixbeta |
object of class matrix with the estimated covariances of beta. |
CovarianceMatrixgamma |
object of class matrix with the estimated covariances of gamma. |
AIC |
the AIC criteria |
iteration |
numbers of iterations to convergence |
convergence |
value of convergence obtained |
Author(s)
Martha Corrales martha.corrales@usa.edu.co Edilberto Cepeda-Cuervo ecepedac@unal.edu.co,
References
1. Cepeda-Cuervo, E. (2001). Modelagem da variabilidade em modelos lineares generalizados. Unpublished Ph.D. tesis. Instituto de Matemáticas. Universidade Federal do Río do Janeiro. //http://www.docentes.unal.edu.co/ecepedac/docs/MODELAGEM20DA20VARIABILIDADE.pdf. http://www.bdigital.unal.edu.co/9394/. 2. McCullagh, P. and Nelder, N.A. (1989). Generalized Linear Models. Second Edition. Chapman and Hall.
Examples
# Simulation Example
X1 <- rep(1,500)
X2 <- runif(500,0,30)
X3 <- runif(500,0,15)
X4 <- runif(500,10,20)
mui <- 15 + 2*X2 + 3*X3
alphai <- exp(0.2 + 0.1*X2 + 0.3*X4)
Y <- rgamma(500,shape=alphai,scale=mui/alphai)
X <- cbind(X1,X2,X3)
Z <- cbind(X1,X2,X4)
formula.mean= Y~X2+X3
formula.shape= ~X2+X4
a=gammahetero2(formula.mean,formula.shape)
a
print the Classic gamma regression
Description
Print the Classic Gamma Regression for joint modeling of mean and shape parameters.
Usage
## S3 method for class 'Gammareg'
print(x,...)
Arguments
x |
object of class Gammareg |
... |
not used. |
Value
print the Classic gamma regression
Author(s)
Martha Corrales martha.corrales@usa.edu.co Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo, E. (2001). Modelagem da variabilidade em modelos lineares generalizados. Unpublished Ph.D. tesis. Instituto de Matemáticas. Universidade Federal do Río do Janeiro. //http://www.docentes.unal.edu.co/ecepedac/docs/MODELAGEM20DA20VARIABILIDADE.pdf. http://www.bdigital.unal.edu.co/9394/. 2. McCullagh, P. and Nelder, N.A. (1989). Generalized Linear Models. Second Edition. Chapman and Hall.
print the summary of the Classic gamma regression
Description
Print the summary Classic Gamma Regression for joint modelling of mean and shape parameters.
Usage
## S3 method for class 'summary.Gammareg'
print(x, ...)
Arguments
x |
object of class Gammareg |
... |
not used. |
Value
Print the summary Classic Gamma Regression for joint modelling of mean and shape parameters.
Author(s)
Martha Corrales martha.corrales@usa.edu.co Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001). Modelagem da variabilidade em modelos lineares generalizados. Unpublished Ph.D. tesis. Instituto de Matemáticas. Universidade Federal do Río do Janeiro. //http://www.docentes.unal.edu.co/ecepedac/docs/MODELAGEM20DA20VARIABILIDADE.pdf. http://www.bdigital.unal.edu.co/9394/. 2. McCullagh, P. and Nelder, N.A. (1989). Generalized Linear Models. Second Edition. Chapman and Hall.
Print the Classic gamma regression
Description
Summarized the Classic gamma regression for joint modelling of mean and shape parameters.
Usage
## S3 method for class 'Gammareg'
summary(object, ...)
Arguments
object |
an object of class Gammareg |
... |
not used. |
Value
call |
Call |
coefficients |
Coefficients |
covB |
object of class matrix with the estimated covariances of beta. |
covG |
object of class matrix with the estimated covariances of gamma. |
AIC |
AIC |
iteration |
number of iterations |
convergence |
convergence obtained |
Author(s)
Martha Corrales martha.corrales@usa.edu.co Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo, E. (2001). Modelagem da variabilidade em modelos lineares generalizados. Unpublished Ph.D. tesis. Instituto de Matemáticas. Universidade Federal do Río do Janeiro. //http://www.docentes.unal.edu.co/ecepedac/docs/MODELAGEM20DA20VARIABILIDADE.pdf. http://www.bdigital.unal.edu.co/9394/. 2. McCullagh, P. and Nelder, N.A. (1989). Generalized Linear Models. Second Edition. Chapman and Hall.