Type: | Package |
Title: | Bayesian Gamma Regression: Joint Mean and Shape Modeling |
Version: | 0.1.0 |
Date: | 2020-01-24 |
Author: | Arturo Camargo Lozano [aut, cre], Edilberto Cepeda Cuervo [aut] |
Maintainer: | Arturo Camargo Lozano <bacamargol@unal.edu.co> |
Description: | Adjust the Gamma regression models from a Bayesian perspective described by Cepeda and Urdinola (2012) <doi:10.1080/03610918.2011.600500>, modeling the parameters of mean and shape and using different link functions for the parameter associated to the mean. And calculates different adjustment statistics such as the Akaike information criterion and Bayesian information criterion. |
Depends: | R (≥ 3.1.1), mvtnorm |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
NeedsCompilation: | no |
Packaged: | 2020-01-25 01:32:05 UTC; ARTURO |
Repository: | CRAN |
Date/Publication: | 2020-02-06 10:50:17 UTC |
URL: | https://www.r-project.org |
Bayesian Gamma Regression: Joint Mean and Shape Modeling
Description
Function to do Bayesian Gamma Regression: Joint Mean and Shape Modeling
Usage
Bayesiangammareg(Y, X, Z, nsim, bpri, Bpri, gpri, Gpri, burn, jump,
graph1, graph2, meanlink = "log")
Arguments
Y |
object of class matrix, with the dependent variable. |
X |
object of class matrix, with the variables for modeling the mean. |
Z |
object of class matrix, with the variables for modeling the shape. |
nsim |
a number that indicate the number of iterations. |
bpri |
a vector with the initial values of beta. |
Bpri |
a matrix with the initial values of the variance of beta. |
gpri |
a vector with the initial values of gamma. |
Gpri |
a matrix with the initial values of the variance of gamma. |
burn |
a proportion that indicate the number of iterations to be burn at the beginning of the chain. |
jump |
a number that indicate the distance between samples of the autocorrelated the chain, to be excluded from the final chain. |
graph1 |
if it is TRUE present the graph of the chains without jump and burn. |
graph2 |
if it is TRUE present the graph of the chains with jump and burn. |
meanlink |
represent the link function, logarithm or identity. |
Details
The Bayesian Gamma regression allows the joint modeling of the mean and the shape of a gamma distributed variable, using a Bayesian estimation algorithm proposed by Cepeda-Cuervo (2001).
Value
object of class bayesiangammareg with:
coefficients |
object of class matrix with the estimated coefficients of beta and gamma. |
desv |
object of class matrix with the estimated desviations of beta and gamma. |
interv |
object of class matrix with the estimated confidence intervals of beta and gamma. |
fitted.values |
object of class matrix with the fitted values of y. |
residuals |
object of class matrix with the residuals of the regression. |
beta.mcmc |
object of class matrix with the complete chains for beta. |
gamma.mcmc |
object of class matrix with the complete chains for gamma. |
beta.mcmc.short |
object of class matrix with the chains for beta after the burned process. |
gamma.mcmc.short |
object of class matrix with the chains for gamma after the burned process. |
call |
Call. |
Author(s)
Arturo Camargo Lozano bacamargol@unal.edu.co, Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro. 2. Cepeda-Cuervo E. and Gamerman D. (2005). Bayesian Methodology for modeling parameters in the two-parameter exponential family. Estadistica 57, 93 105.
Examples
X1 <- rep(1,50)
X2 <- runif(50,0,30)
X3 <- runif(50,0,20)
X4 <- runif(50,10,20)
mui <- 15 + 3*X2 + 2*X3
alphai <- exp(3 + 0.15*X2 + 0.15*X4)
Y <- rgamma(50,shape=alphai,scale=mui/alphai)
X <- cbind(X1,X2,X3)
Z <- cbind(X1,X2,X4)
bpri <- c(1,1,1)
Bpri <- diag(10^(3),nrow=ncol(X),ncol=ncol(X))
gpri <- c(0,0,0)
Gpri <- diag(10^(3),nrow=ncol(Z),ncol=ncol(Z))
burn <- 0
jump <- 1
nsim <- 300
graph1=FALSE
graph2=FALSE
Bayesiangammareg(Y,X,Z,nsim,bpri,Bpri,gpri,Gpri,burn,jump,graph1,graph2,"ide")
Bayesian Gamma Regression with link Identity for the Model of Mean.
Description
Function to do Bayesian Gamma Regression link Identity: Joint Mean and Shape modeling with Identity link for Mean.
Usage
GammaIdentity(Y, X, Z, nsim, bpri, Bpri, gpri, Gpri, burn, jump, graph1, graph2)
Arguments
Y |
Object of class matrix, with the dependent variable. |
X |
Object of class matrix, with the variables for modeling the mean. |
Z |
Object of class matrix, with the variables for modeling the shape. |
nsim |
a number that indicate the number of iterations. |
bpri |
a vector with the initial values of beta. |
Bpri |
a matrix with the initial values of the variance of beta. |
gpri |
a vector with the initial values of gamma. |
Gpri |
a matrix with the initial values of the variance of gamma. |
burn |
a proportion that indicate the number of iterations to be burn at the beginning of the chain. |
jump |
a number that indicate the distance between samples of the autocorrelated the chain, to be excluded from the final chain. |
graph1 |
if it is TRUE present the graph of the chains without jump and burn. |
graph2 |
if it is TRUE present the graph of the chains with jump and burn. |
Value
object of class bayesiangammareg
with the following:
Bestimado |
object of class matrix with the estimated coefficients of beta |
Gammaest |
object of class matrix with the estimated coefficients of gamma |
X |
object of class matrix, with the variables for modelling the mean |
Z |
object of class matrix, with the variables for modelling the precision |
DesvBeta |
object of class matrix with the estimated desviations of beta |
DesvGamma |
object of class matrix with the estimated desviations of gamma |
B |
object of class matrix with the B values |
G |
object of class matrix with the G values |
yestimado |
object of class matrix with the fitted values of y |
residuals |
object of class matrix with the residuals of the regression |
phi |
object of class matrix with the precision terms of the regression |
variance |
object of class matrix with the variance terms of the regression |
beta.mcmc |
object of class matrix with the complete chains for beta |
gamma.mcmc |
object of class matrix with the complete chains for gamma |
beta.mcmc.auto |
object of class matrix with the chains for beta after the burned process |
gamma.mcmc.auto |
object of class matrix with the chains for gamma after the burned process |
Author(s)
Arturo Camargo Lozano bacamargol@unal.edu.co, Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro. 2. Cepeda-Cuervo E. and Gamerman D. (2005). Bayesian Methodology for modeling parameters in the two-parameter exponential family. Estadistica 57, 93 105. 3. Cepeda Cuervo E. and Gamerman D. (2001). Bayesian Modeling of Variance Heterogeneity in Normal Regression Models. Brazilian Journal of Probability and Statistics. 14, 207-221.
Examples
X1 <- rep(1,50)
X2 <- runif(50,0,30)
X3 <- runif(50,0,20)
X4 <- runif(50,10,20)
mui <- 15 + 3*X2 + 2*X3
alphai <- exp(3 + 0.15*X2 + 0.15*X4)
Y <- rgamma(50,shape=alphai,scale=mui/alphai)
X <- cbind(X1,X2,X3)
Z <- cbind(X1,X2,X4)
bpri <- c(1,1,1)
Bpri <- diag(10^(3),nrow=ncol(X),ncol=ncol(X))
gpri <- c(0,0,0)
Gpri <- diag(10^(3),nrow=ncol(Z),ncol=ncol(Z))
burn <- 0
jump <- 1
nsim <- 300
graph1=FALSE
graph2=FALSE
Bayesiangammareg(Y,X,Z,nsim,bpri,Bpri,gpri,Gpri,burn,jump,graph1,graph2,"ide")
Bayesian Gamma Regression with logarithm link for Model of Mean.
Description
Function to do Bayesian Gamma Regression: Joint Mean and Shape modeling with Log link for Mean.
Usage
GammaLog(Y, X, Z, nsim, bpri, Bpri, gpri, Gpri, burn, jump,
graph1, graph2)
Arguments
Y |
object of class matrix, with the dependent variable. |
X |
object of class matrix, with the variables for modelling the mean. |
Z |
object of class matrix, with the variables for modelling the shape. |
nsim |
a number that indicate the number of iterations. |
bpri |
a vector with the initial values of beta. |
Bpri |
a matrix with the initial values of the variance of beta. |
gpri |
a vector with the initial values of gamma. |
Gpri |
a matrix with the initial values of the variance of gamma. |
burn |
a proportion that indicate the number of iterations to be burn at the beginning of the chain. |
jump |
a number that indicate the distance between samples of the autocorrelated the chain, to be excluded from the final chain. |
graph1 |
if it is TRUE present the graph of the chains without jump and burn. |
graph2 |
if it is TRUE present the graph of the chains with jump and burn. |
Value
object of class bayesiangammareg
with the following:
Bestimado |
object of class matrix with the estimated coefficients of beta |
Gammaest |
object of class matrix with the estimated coefficients of gamma |
X |
object of class matrix, with the variables for modelling the mean |
Z |
object of class matrix, with the variables for modelling the precision |
DesvBeta |
object of class matrix with the estimated desviations of beta |
DesvGamma |
object of class matrix with the estimated desviations of gamma |
B |
object of class matrix with the B values |
G |
object of class matrix with the G values |
yestimado |
object of class matrix with the fitted values of y |
residuals |
object of class matrix with the residuals of the regression |
phi |
object of class matrix with the precision terms of the regression |
variance |
object of class matrix with the variance terms of the regression |
beta.mcmc |
object of class matrix with the complete chains for beta |
gamma.mcmc |
object of class matrix with the complete chains for gamma |
beta.mcmc.auto |
object of class matrix with the chains for beta after the burned process |
gamma.mcmc.auto |
object of class matrix with the chains for gamma after the burned process |
Author(s)
Arturo Camargo Lozano bacamargol@unal.edu.co, Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro. 2. Cepeda Cuervo E. and Gamerman D. (2005). Bayesian Methodology for modeling parameters in the two parameter exponential family. Estadistica 57, 93 105. 3. Cepeda Cuervo E. and Gamerman D. (2001). Bayesian Modeling of Variance Heterogeneity in Normal Regression Models. Brazilian Journal of Probability and Statistics. 14, 207-221.
Examples
X1 <- rep(1,50)
X2 <- runif(50,0,30)
X3 <- runif(50,0,20)
X4 <- runif(50,10,20)
mui<-exp(1 + 0.14*X2 + 0.05*X3)
alphai<-exp(0.1 + 0.01*X2 + 0.03*X4)
Y <- rgamma(50,shape=alphai,scale=mui/alphai)
X <- cbind(X1,X2,X3)
Z <- cbind(X1,X2,X4)
bpri <- c(1,1,1)
Bpri <- diag(10^(3),nrow=ncol(X),ncol=ncol(X))
gpri <- c(0,0,0)
Gpri <- diag(10^(3),nrow=ncol(Z),ncol=ncol(Z))
burn <- 0
jump <- 1
nsim <- 300
graph1=FALSE
graph2=FALSE
Bayesiangammareg(Y,X,Z,nsim,bpri,Bpri,gpri,Gpri,burn,jump,graph1,graph2,"log")
Criteria for Comparison the Bayesian Gamma Regression.
Description
Performs the comparison criterias for the Bayesian Gamma regression
Usage
criteria(X, gammaresiduals)
Arguments
X |
object of class matrix, with the independent variable for the mean. |
gammaresiduals |
object of class bayesiangammareg, with the residuals of the Bayesian Gamma regression, that can be calculated by the function gammaresiduals |
Details
This function calculate the residuals of a Bayesian Gamma regression.
Value
deviance |
the deviance criteria |
AIC |
the AIC criteria |
BIC |
the BIC criteria |
Author(s)
Arturo Camargo Lozano bacamargol@unal.edu.co, Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro. 2. Cepeda-Cuervo E. and Gamerman D. (2005). Bayesian Methodology for modeling parameters in the two-parameter exponential family. Estadistica 57, 93 105. 3. Espinheira, P. L., Ferrari, S. L., and Cribari-Neto, F. On beta regression residuals. Journal of Applied Statistics 4. Cepeda-Cuervo E., Corrales, M., Cifuentes, M. V., and Zarate, H. (2016). On Gamma Regression Residuals.
Residuals of the Gamma Regression
Description
This function calculates the Gamma regression residuals
Usage
gammaresiduals(Y, X, model)
Arguments
Y |
object of class matrix, with the dependent variable. |
X |
object of class matrix, with the independent variable. |
model |
object of class Bayesiangammareg. |
Value
rabs |
Pearson absolute residuals |
rp |
Pearson residuals |
rd |
deviance residuals |
rast |
Asteric residuals |
Author(s)
Arturo Camargo Lozano bacamargol@unal.edu.co, Edilberto Cepeda Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro. 2. Cepeda-Cuervo E. and Gamerman D. (2005). Bayesian Methodology for modeling parameters in the two-parameter exponential family. Estadistica 57, 93 105. 3. Cepeda Cuervo E., Corrales, M., Cifuentes, M. V., and Zarate, H. (2016). On Gamma Regression Residuals.
Print the Bayesian Gamma Regression
Description
Print the Bayesian Gamma Regression for Joint modeling of Mean and Shape
Usage
## S3 method for class 'Bayesiangammareg'
print(x,...)
Arguments
x |
object of class Bayesiangammareg |
... |
not used. |
Value
print the Bayesian Gamma regression
Author(s)
Arturo Camargo Lozano bacamargol@unal.edu.co, Edilberto Cepeda Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro.
Print the Summary of the Bayesian Gamma Regression
Description
Print the summary Bayesian Gamma regression for Joint modeling of Mean and Shape parameters
Usage
## S3 method for class 'summary.Bayesiangammareg'
print(x, ...)
Arguments
x |
object of class Bayesiangammareg |
... |
not used. |
Value
Print the summary Bayesian Gamma Regression for Joint modeling of Mean and Shape parameters
Author(s)
Arturo Camargo bacamargol@unal.edu.co, Edilberto Cepeda-Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro.
Print the Bayesian Gamma Regression
Description
Summarized the Bayesian Gamma Regression for joint modeling of mean and variance
Usage
## S3 method for class 'Bayesiangammareg'
summary(object, ...)
Arguments
object |
an object of class Bayesiangammareg |
... |
not used. |
Value
call |
Call |
coefficients |
Coefficients |
deviance |
deviance |
AIC |
AIC |
BIC |
BIC |
Author(s)
Brayan Arturo Camargo bacamargol@unal.edu.co, Edilberto Cepeda Cuervo ecepedac@unal.edu.co
References
1. Cepeda-Cuervo E. (2001) Modelagem da variabilidade em modelos lineares generalizados. Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro. 2. Cepeda-Cuervo E. and Gamerman D. (2005). Bayesian Methodology for modeling parameters in the two-parameter exponential family. Estadistica 57, 93 105. 3. Cepeda Cuervo E. and Gamerman D. (2001). Bayesian Modeling of Variance Heterogeneity in Normal Regression Models. Brazilian Journal of Probability and Statistics. 14, 207-221.