R: Efficient approximate leave-one-out cross-validation (LOO)...

loo_subsample.brmsfit {brms} | R Documentation

## Efficient approximate leave-one-out cross-validation (LOO) using subsampling

### Description

Efficient approximate leave-one-out cross-validation (LOO) using subsampling

### Usage

    ## S3 method for class 'brmsfit'
    loo_subsample(x, ..., compare = TRUE, resp = NULL, model_names = NULL)

### Arguments

`x` | A `brmsfit` object.
`...` | More `brmsfit` objects or further arguments passed to the underlying post-processing functions. In particular, see `prepare_predictions` for further supported arguments.
`compare` | A flag indicating if the information criteria of the models should be compared to each other via `loo_compare`.
`resp` | Optional names of response variables. If specified, predictions are performed only for the specified response variables.
`model_names` | If `NULL` (the default) will use model names derived from deparsing the call. Otherwise will use the passed values as model names.

### Details

More details can be found on `loo_subsample`.

### Examples

    ## Not run:
    # model with population-level effects only
    fit1 <- brm(rating ~ treat + period + carry,
                data = inhaler)
    (loo1 <- loo_subsample(fit1))

    # model with an additional varying intercept for subjects
    fit2 <- brm(rating ~ treat + period + carry + (1|subject),
                data = inhaler)
    (loo2 <- loo_subsample(fit2))

    # compare both models
    loo_compare(loo1, loo2)

    ## End(Not run)

[Package brms version 2.17.0 Index]