Learn R Programming

Bayesianbetareg (version 1.2)

diagnostics: Plot the residuals of the bayesian beta regression

Description

Plot the residuals (pearson standarized and deviance), the Cooks distance and the leverage against the predicted values for the Bayesian Beta Regression

Usage

diagnostics(model, residuals)

Arguments

model
object of class bayesbetareg, with the structure of the model
residuals
object of class bayesbetareg, with the residuals of the Bayesianbetareg

Value

Plot the residuals of the bayesian beta regression

Examples

Run this code
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 of the function betasresiduals and plots

readingskillsresiduals<- betaresiduals(Y,X,re)
diagnostics(re,readingskillsresiduals)

Run the code above in your browser using DataLab