Bayesiantreg {Bayesiantreg} | R Documentation |

## Bayesiantreg

### Description

Function to do Bayesian t Regression: joint mean and variance modeling and estimation of the degrees of freedom

### Usage

```
Bayesiantreg(y, x, z, nsim, bini, bpri, Bpri, gini, gpri,Gpri, glini, glpri,
type, apriori, propuesta, Maxi=NULL,
lambda = NULL, p = NULL, burn, jump, graph1 = TRUE, graph2 = TRUE,
graph3 = TRUE)
```

### 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. |

`bini` |
a vector with the initial values of beta. |

`bpri` |
a vector with the values of the mean of the prior of beta. |

`Bpri` |
a matrix with the values of the variance of the prior of beta. |

`gini` |
a vector with the initial values of gamma. |

`gpri` |
a vector with the values of the mean of the prior of gamma. |

`Gpri` |
a matrix with the values of the variance of the prior of gamma. |

`glini` |
a vector with the initial value of the degrees of freedom. |

`glpri` |
a vector with the value of the the prior of the degrees of freedom. |

`type` |
a vector that can take the value "D" if the prior for the degrees of freedom considered as discrete or "C" if it is continuous. |

`apriori` |
when type is "D", it is a vector that can take the values of "poi" for a Poisson prior or "unif" for a uniform prior. When type is "C", it is a vector that can take the values of "exp" for the exponential prior, "unif" for the uniform prior or "J2" for the Jeffrey's prior. |

`propuesta` |
when type is "D", it is a vector that can take the values of "poi" for a Poisson proposal, "unif" for a uniform proposal or by default the proposal made by Marin and Cepeda (_). When type is "C", it is a vector that can take the values of "exp" for the exponential proposal, "unif" for the uniform proposal, "J2" for the Jeffrey's proposal or by default the proposal made by Marin and Cepeda (_). |

`Maxi` |
a number indicating the maximum value for the uniform prior an the uniforme proposal. |

`lambda` |
a number indicating the mean parameter value for the Poisson prior an the Poisson proposal. |

`p` |
a number indicating the parameter value for the Jeffrey's prior an the Jeffrey's proposal. |

`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. |

`graph3` |
if it is TRUE present the graph of the standardized residuals, the the standardized residuals against the lineal predictor, the pseudo deviance residuals and the pseudo deviance residuals against the lineal predictor. |

### Details

The bayesian t regression allows the joint modelling of mean and variance and the estimation of the degrees of freedom of a t distributed variable, as is proposed in Marin and Cepeda (_), with identical link for the mean and logarithmic for the variance, and differents discrete and continuous aproach for the degrees of freedom.

### Value

object of class bayesbetareg with:

`coefficients` |
object of class matrix with the estimated coefficients of beta, gamma and degrees of freedom. |

`interv` |
object of class matrix with the estimated confidence intervals of beta, gamma and the degrees of freedom. |

`fitted.values` |
object of class matrix with the fitted values of y. |

`residuals` |
object of class matrix with the residuals of the regression. |

`residualsstd` |
object of class matrix with the standardized residuals of the regression. |

`residualsdev` |
object of class matrix with the pseudo deviance residuals 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. |

`gl.mcmc` |
object of class matrix with the complete chains for the degrees of freedom. |

`beta.mcmc.burn` |
object of class matrix with the chains for beta after the burned process. |

`gamma.mcmc.burn` |
object of class matrix with the chains for gamma after the burned process. |

`gl.mcmc.burn` |
object of class matrix with the chains for the degreees of freedom after the burned process. |

`loglik` |
the logaritmic of the liklihood of the model. |

`AIC` |
AIC of the model. |

`BIC` |
BIC of the model. |

`DIC` |
BIC of the model. |

`PseudoDeviance` |
Pseudo deviance criteria of the model as is proposed by Marin and Cepeda (_). |

`arb` |
acceptance percentage for beta. |

`arg` |
acceptance percentage for gamma. |

`argl` |
acceptance percentage for the degrees of freedom. |

`call` |
Call. |

### Author(s)

Margarita Marin mmarinj@unal.edu.co, Edilberto Cepeda-Cuervo ecepedac@unal.edu.co

2. Cepeda-Cuervo E. (2001). Modelagem da variabilidade em modelos lineares generalizados. Unpublished Ph.D. tesis. Instituto de Matematicas. Universidade Federal do Rio do Janeiro.

3. Cepeda C., E. and Gamerman D. (2001). Bayesian Modeling of Variance Heterogeneity in Normal Regression Models. Brazilian Journal of Probability and Statistics. 14, 207-221

### References

1. Marin and Cepeda-Cuervo (_). A Bayesian regression model for the non-standardized t distribution with location, scale and degrees of freedom parameters. Unpublished

### Examples

```
n <- 10
X1 <- runif(n,0,10)
X2 <- runif(n,5,10)
X3 <- runif(n,10,15)
y1 <- c(0.09, 1.68, -2.43, 0.23, 2.94, 1.50, 3.40, 2.22, 0.28, -0.17)
betas <- c(0,0,0,0)
gammas <- c(0,0,0)
gl <- 3
x <- cbind(rep(1,n),X1,X2,X3)
z <- cbind(rep(1,n),X2,X3)
y <- y1
Bpri <- diag(rep(100,4))
bpri <- rep(0,4)
Gpri <- diag(rep(10,3))
gpri <- rep(0,3)
glpri <- 7
propuesta <- "unif2"
apriori <- "unif"
tipo <- "D"
Maxi <- 100
nsim <- 50
bini=bpri
gini=gpri
glini=glpri
reg1 <- Bayesiantreg(y, x, z, nsim=nsim, bini, bpri,
Bpri, gini,
gpri,Gpri, glini, glpri,
type=tipo, apriori=apriori,
propuesta=propuesta,
Maxi=Maxi,burn=0.3, jump=3,
graph1 = TRUE, graph2 = TRUE, graph3 = TRUE)
```

*Bayesiantreg*version 1.0.1 Index]