`R/use_weights.R`

`summarize.adjustr_weighted.Rd`

Uses weights computed in `adjust_weights`

to compute posterior
summary statistics. These statistics can be compared against their reference
values to quantify the sensitivity of the model to aspects of its
specification.

- .data
An

`adjustr_weighted`

object.- ...
Name-value pairs of expressions. The name of each argument will be the name of a new variable, and the value will be computed for the posterior distribution of eight alternative specification. For example, a value of

`mean(theta)`

will compute the posterior mean of`theta`

for each alternative specification.Also supported is the custom function

`wasserstein`

, which computes the Wasserstein-p distance between the posterior distribution of the provided expression under the new model and under the original model, with`p=1`

the default. Lower the`spacing`

parameter from the default of 0.005 to compute a finer (but slower) approximation.The arguments in

`...`

are automatically quoted and evaluated in the context of`.data`

. They support unquoting and splicing.- .resampling
Whether to compute summary statistics by first resampling the data according to the weights. Defaults to

`FALSE`

, but will be used for any summary statistic that is not`mean`

,`var`

or`sd`

.- .model_data
Stan model data, if not provided in the earlier call to

`adjust_weights`

.

An `adjustr_weighted`

object, with the new columns specified in
`...`

added.

```
if (FALSE) {
model_data = list(
J = 8,
y = c(28, 8, -3, 7, -1, 1, 18, 12),
sigma = c(15, 10, 16, 11, 9, 11, 10, 18)
)
spec = make_spec(eta ~ student_t(df, 0, 1), df=1:10)
adjusted = adjust_weights(spec, eightschools_m)
summarize(adjusted, mean(mu), var(mu))
summarize(adjusted, wasserstein(mu, p=2))
summarize(adjusted, diff_1 = mean(y[1] - theta[1]), .model_data=model_data)
summarize(adjusted, quantile(tau, probs=c(0.05, 0.5, 0.95)))
}
```