posterior_average.brmsfit {brms} | R Documentation |

## Posterior draws of parameters averaged across models

### Description

Extract posterior draws of parameters averaged across models. Weighting can be done in various ways, for instance using Akaike weights based on information criteria or marginal likelihoods.

### Usage

```
## S3 method for class 'brmsfit'
posterior_average(
x,
...,
variable = NULL,
pars = NULL,
weights = "stacking",
ndraws = NULL,
nsamples = NULL,
missing = NULL,
model_names = NULL,
control = list(),
seed = NULL
)
posterior_average(x, ...)
```

### Arguments

`x` |
A |

`...` |
More |

`variable` |
Names of variables (parameters) for which to average across models. Only those variables can be averaged that appear in every model. Defaults to all overlapping variables. |

`pars` |
Deprecated alias of |

`weights` |
Name of the criterion to compute weights from. Should be one
of |

`ndraws` |
Total number of posterior draws to use. |

`nsamples` |
Deprecated alias of |

`missing` |
An optional numeric value or a named list of numeric values
to use if a model does not contain a variable for which posterior draws
should be averaged. Defaults to |

`model_names` |
If |

`control` |
Optional |

`seed` |
A single numeric value passed to |

### Details

Weights are computed with the `model_weights`

method.

### Value

A `data.frame`

of posterior draws.

### See Also

### Examples

```
## Not run:
# model with 'treat' as predictor
fit1 <- brm(rating ~ treat + period + carry, data = inhaler)
summary(fit1)
# model without 'treat' as predictor
fit2 <- brm(rating ~ period + carry, data = inhaler)
summary(fit2)
# compute model-averaged posteriors of overlapping parameters
posterior_average(fit1, fit2, weights = "waic")
## End(Not run)
```

*brms*version 2.21.0 Index]