Learn R Programming

rbart (version 1.0)

hbartqqplot: Predictive qqplot for heterbart

Description

Given results from predict.rbart, gets draws from the predictive distribution at each x and then computes the empirical inverse cdf to get draws which would be uniform if the predicitive were the true distribution. Then draws a qqplot against the uniform. In large enough samples, if the model is correct, the qqplot should look like like a straight line with intercept 0 and slope 1. In small samples, we expect the predictive to be more spread out than the true distribution, even if the model is correct.

Usage

hbartqqplot(y,rbmod,nunif=10000,linecolor="red",linewd=3,...)

Arguments

y

y values corresponding to x values given to predict.rbart.

rbmod

Output list from predict.rbart.

nunif

Number of uniform(0,1) draws used in constructing the qqplot.

linecolor,linewd

Line color and width for (0,1) line.

...

Arguments passed on to stats::qqplot.

Value

quantiles of y in draws from the predictive (conditional on each x value).

Examples

Run this code
# NOT RUN {
##################################################
## please see vignette and/or www.rob-mcculloch.org for more realistic examples
##################################################

## get simulated data
data(simdat)

##get rbart run on the simulated data
data(rbartonsimd)

##  Predictive quantile-quantile plot
temp = hbartqqplot(simdat$yp,rbartonsimd,xlab="predictive quantile",ylab="uniform",
                      cex.axis=1.4,cex.lab=1.2)
# }

Run the code above in your browser using DataLab