BayesianbetaregEst: Bayesian beta regression

Description Usage Arguments Details Value Author(s) References Examples

View source: R/BayesianbetaregEst.R

Description

Performs the Bayesian Beta Regression for joint modelling of mean and precision

Usage

1
BayesianbetaregEst(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 precision

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

Details

The bayesian beta regression allow the joint modelling of mean and precision of a beta distributed variable, as is proposed in Cepeda (2001), with logit link for the mean and logarithmic for the precision.

Value

object of class bayesbetareg 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

residuales

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)

Daniel Jaimes dajaimesc@unal.edu.co, Margarita Marin mmarinj@unal.edu.co, Javier Rojas jarojasag@unal.edu.co, Hugo Andres Gutierrez Rojas hugogutierrez@usantotomas.edu.co, Martha Corrales martha.corrales@usa.edu.co, Maria Fernanda Zarate mfzaratej@unal.edu.co, Ricardo Duplat rrduplatd@unal.edu.co, Luis Villaraga lfvillarragap@unal.edu.co, Edilberto Cepeda-Cuervo ecepedac@unal.edu.co

References

1. Cepeda C. 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.Cepeda, E. C. and Gamerman D. (2005). Bayesian Methodology for modeling parameters in the two-parameter exponential family. Estadistica 57, 93 105. // 3.Cepeda, E. and Garrido, L. (2011). Bayesian beta regression models: joint mean and precision modeling. Universidad Nacional // 4.Cepeda, E. and Migon, H. and Garrido, L. and Achcar, J. (2012) Generalized Linear models with random effects in the two parameter exponential family. Journal of Statistical Computation and Simulation. 1, 1 13.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Modelation of the gini coeficient with multiples variables

library(betareg)
data(ReadingSkills)


Y <- as.matrix(ReadingSkills[,1])
n <- length(Y)
X1 <- as.matrix(ReadingSkills[,2])
for(i in 1:length(X1)){
  X1 <- replace(X1,X1=="yes",1)
  X1 <- replace(X1,X1=="no",0)
}
X0 <- rep(1, times=n)
X1 <- as.numeric(X1)
X2 <- as.matrix(ReadingSkills[,3])
X3 <- X1*X2
X <- cbind(X0,X1,X2,X3)
Z0 <-  X0 
Z <- cbind(X0,X1)

burn <- 0.3
jump <- 3
nsim <- 400

bpri <- c(0,0,0,0)
Bpri <- diag(100,nrow=ncol(X),ncol=ncol(X))
gpri <- c(0,0)
Gpri <- diag(10,nrow=ncol(Z),ncol=ncol(Z))

re<-Bayesianbetareg(Y,X,Z,nsim,bpri,Bpri,gpri,Gpri,0.3,3,graph1=FALSE,graph2=FALSE)
summary(re)

Example output

Loading required package: mvtnorm
Loading required package: betareg
 
            ################################################################
            ###                  Bayesian Beta Regression                ###
            ################################################################ 

 Call: 
Bayesianbetareg(Y = Y, X = X, Z = Z, nsim = nsim, bpri = bpri, 
    Bpri = Bpri, gpri = gpri, Gpri = Gpri, burn = 0.3, jump = 3, 
    graph1 = FALSE, graph2 = FALSE)

         Estimate Est.Error L.CredIntv U.CredIntv
beta.X0    2.0329    0.1649     1.7344      2.328
beta.X1   -1.6395    0.1772    -1.9858     -1.334
beta.      0.5332    0.1503     0.3332      0.840
beta.     -0.5921    0.1515    -0.9130     -0.378
gamma.X0   2.0438    0.1414     1.7368      2.215
gamma.X1   1.4817    0.4665     0.5980      2.147

 Deviance: 
[1] 211.8043

 AIC: 
[1] 219.8043

 BIC: 
[1] 226.9411

Bayesianbetareg documentation built on May 30, 2017, 2:35 a.m.