0
votes

I am running a beta regression model in R on proportion data with one quantitative predictor variable (amplitude = 40, 50, 60, 70). I have been able to get predictions from the model for the proportion at 40, 50, 60, 70 and plot it.

I understand from researching around this site and others that getting confidence intervals for predictions from beta regression models is not the same/as easy as it is with other models. I have read around that to get levels of confidence for beta regression models, bootstrapping the predictions from the model is one way of getting confidence intervals/bands (as mentioned in other posts, for example by Achim Zeileis on thread: https://stats.stackexchange.com/questions/230501/variance-vs-standard-deviation-in-beta-regression?noredirect=1&lq=1). My question is how would one actually carry out this boostrapping to get predictions and levels of confidence for the predictions from my model in R? I ideally want to get predictions for the proportion at amplitude: 40, 50, 60 and 70 with some level of confidence. I am rather new to bootstrapping, so if someone had insight into how one can bootstrap predictions and confidence intervals from a beta regression model that would be great.

1
Can you edit your question to add a small example please - you will likely be able to find one at the bottom of the help page of the R function that you are using. Please also add all packages that you are using.user20650

1 Answers

0
votes

Not sure exactly what you're looking for, but the boot package may offer a solution. Here's a toy example using random data for bootstrapping a regression:

    library(boot)
    library(xts)
    set.seed(789)
    dat <- xts(matrix(rnorm(1200), nrow=240, ncol=5), 
               as.Date(c(seq(as.Date("1990/1/1"), by = "month", length.out = 240))))
    colnames(dat) <-c("A", "B", "C", "D", "E")

    function.1 <-function(formula, dat, x) {
      a <-dat[x,]
      output <-lm(formula, data=a)
      return(coef(output))
    }

    results <- boot(data=dat, 
                    statistic=function.1,
                    R=1000, 
                    formula=A ~ .)

    results.ci <-boot.ci(results, type="basic", index=2)

results

ORDINARY NONPARAMETRIC BOOTSTRAP

Call:
boot(data = dat, statistic = function.1, R = 1000, formula = A ~ 
    .)


Bootstrap Statistics :
       original        bias    std. error
t1* -0.06716150  0.0029368176  0.06517814
t2* -0.04582073 -0.0050721571  0.07658141
t3*  0.14324494  0.0010631253  0.06500446
t4*  0.06771263 -0.0028811702  0.06247530
t5*  0.05620244  0.0005347628  0.06102209

results.ci
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 1000 bootstrap replicates

CALL : 
boot.ci(boot.out = results, type = "basic", index = 2)

Intervals : 
Level      Basic         
95%   (-0.1960,  0.1015 )  
Calculations and Intervals on Original Scale