loo.cv {blmeco} | R Documentation |

## Bayesian leave-one-out cross-validation

### Description

Bayesian leave-one-out cross-validation based on the log pointwise predictive density

### Usage

```
loo.cv(mod, nsim = 100, bias.corr = FALSE)
```

### Arguments

`mod` |
an object obtained by the functions lm or glm |

`nsim` |
number of Monte Carlo simulations used to describe the posterior distributions. Computing time is large! |

`bias.corr` |
The leave-one-out cross-validation underestimates predictive fit because each prediction is conditioned n-1 data points. For large n this bias is negligible. For small n, a bias correction is recommended. |

### Details

For details see Gelman et al. (2014) p 175

### Value

`LOO.CV` |
leave-one-out cross-validation estimate of out-of-sample predictive fit, (log pointwise predictive density) |

`bias.corrected.LOO.CV` |
bias corrected leave-one-out cross-validation estimate of out-of-sample predictive fit, (log pointwise predictive density) |

`minus2times_lppd` |
-2*LOO.CV, transformed LOO.CV to scale of deviance |

`est.peff` |
estimate for the number of effective parameters |

### Author(s)

F. Korner

### References

Gelman A, Carlin JB, Stern HS, Dunson DB, Vehtari A and Rubin DB (2014) Bayesian Data Analysis, Third edn. CRC Press.

### See Also

### Examples

```
## Not run:
x <- runif(20)
y <- 2+0.5*x+rnorm(20, 0, 1)
mod <- lm(y~x)
loo.cv(mod, bias.corr=TRUE) # increase nsim!!
## End(Not run)
```

*blmeco*version 1.4 Index]