Derivative with respect to power-scaling
powerscale_derivative.Rd
Calculate the analytical derivative of a quantity with respect to power-scaling prior or likelihood.
Examples
example_model <- example_powerscale_model()
draws <- example_model$draws
log_prior <- log_prior_draws(draws, joint = TRUE)
posterior::summarise_draws(
posterior::subset_draws(draws, variable = c("mu", "sigma")),
mean,
mean_sens = ~powerscale_derivative(.x, log_prior, quantity = "mean")
)
#> # A tibble: 2 × 3
#> variable mean psens_mean
#> <chr> <dbl> <dbl>
#> 1 mu 9.53 -0.313
#> 2 sigma 0.884 0.145