# bayesresiduals: Computation of posterior residual outlying probabilities for... In LearnBayes: Functions for Learning Bayesian Inference

## Description

Computes the posterior probabilities that Bayesian residuals exceed a cutoff value for a linear regression model with a noninformative prior

## Usage

 `1` ```bayesresiduals(lmfit,post,k) ```

## Arguments

 `lmfit` output of the regression function lm `post` list with components beta, matrix of simulated draws of regression parameter, and sigma, vector of simulated draws of sampling standard deviation `k` cut-off value that defines an outlier

## Value

vector of posterior outlying probabilities

Jim Albert

## Examples

 ```1 2 3 4 5 6 7 8``` ```chirps=c(20,16.0,19.8,18.4,17.1,15.5,14.7,17.1,15.4,16.2,15,17.2,16,17,14.1) temp=c(88.6,71.6,93.3,84.3,80.6,75.2,69.7,82,69.4,83.3,78.6,82.6,80.6,83.5,76.3) X=cbind(1,chirps) lmfit=lm(temp~X) m=1000 post=blinreg(temp,X,m) k=2 bayesresiduals(lmfit,post,k) ```

### Example output

```           1            2            3            4            5            6
8.650461e-03 1.890880e-01 1.734943e-02 9.350177e-06 3.873963e-11 3.108944e-08
7            8            9           10           11           12
1.527867e-02 2.049203e-12 2.495306e-01 1.725156e-02 8.974623e-03 3.655172e-11
13           14           15
1.560055e-05 1.102365e-06 5.687012e-02
```

LearnBayes documentation built on May 1, 2019, 7:03 p.m.