add_criterion {brms} | R Documentation |

## Add model fit criteria to model objects

### Description

Add model fit criteria to model objects

### Usage

```
add_criterion(x, ...)
## S3 method for class 'brmsfit'
add_criterion(
x,
criterion,
model_name = NULL,
overwrite = FALSE,
file = NULL,
force_save = FALSE,
...
)
```

### Arguments

`x` |
An |

`...` |
Further arguments passed to the underlying
functions computing the model fit criteria. If you are recomputing
an already stored criterion with other |

`criterion` |
Names of model fit criteria
to compute. Currently supported are |

`model_name` |
Optional name of the model. If |

`overwrite` |
Logical; Indicates if already stored fit
indices should be overwritten. Defaults to |

`file` |
Either |

`force_save` |
Logical; only relevant if |

### Details

Functions `add_loo`

and `add_waic`

are aliases of
`add_criterion`

with fixed values for the `criterion`

argument.

### Value

An object of the same class as `x`

, but
with model fit criteria added for later usage.

### Examples

```
## Not run:
fit <- brm(count ~ Trt, data = epilepsy)
# add both LOO and WAIC at once
fit <- add_criterion(fit, c("loo", "waic"))
print(fit$criteria$loo)
print(fit$criteria$waic)
## End(Not run)
```

*brms*version 2.21.0 Index]