Skip to content

Commit

Permalink
Merge branch 'master' into gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
avehtari committed Jan 3, 2024
2 parents 95ad35e + 3da02a5 commit 5adc114
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions demos_rstan/brms_demo.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ knitr::opts_chunk$set(cache=FALSE, message=FALSE, error=FALSE, warning=TRUE, com
library(tidyr)
library(dplyr)
library(tibble)
library(pillar)
library(stringr)
library(brms)
options(brms.backend = "cmdstanr", mc.cores = 2)
library(posterior)
Expand Down Expand Up @@ -108,7 +110,7 @@ mcmc_hist(draws, pars='theta') +
#' likelihood. Focus on theta which is the quantity of interest.
theta <- draws |>
subset_draws(variable='theta')
powerscale_sensitivity(fit_bin, prediction = \(x, ...) theta, num_args=list(digits=2)
powerscale_sensitivity(fit_bern, prediction = \(x, ...) theta, num_args=list(digits=2)
)$sensitivity |>
filter(variable=='theta') |>
mutate(across(where(is.double), ~num(.x, digits=2)))
Expand Down Expand Up @@ -700,7 +702,7 @@ temp_diff |>
#' Make prior sensitivity analysis by powerscaling both prior and
#' likelihood with focus on average summer temperature increase from
#' 1952 to 2022.
powerscale_sensitivity(fit_lin_hs, prediction = \(x, ...) temp_diff, num_args=list(digits=2)
powerscale_sensitivity(fit_spline_h, prediction = \(x, ...) temp_diff, num_args=list(digits=2)
)$sensitivity |>
filter(variable=='temp_diff') |>
mutate(across(where(is.double), ~num(.x, digits=2)))
Expand Down
6 changes: 4 additions & 2 deletions demos_rstan/brms_demo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ knitr::opts_chunk$set(cache=FALSE, message=FALSE, error=FALSE, warning=TRUE, com
library(tidyr)
library(dplyr)
library(tibble)
library(pillar)
library(stringr)
library(brms)
options(brms.backend = "cmdstanr", mc.cores = 2)
library(posterior)
Expand Down Expand Up @@ -146,7 +148,7 @@ likelihood. Focus on theta which is the quantity of interest.
```{r}
theta <- draws |>
subset_draws(variable='theta')
powerscale_sensitivity(fit_bin, prediction = \(x, ...) theta, num_args=list(digits=2)
powerscale_sensitivity(fit_bern, prediction = \(x, ...) theta, num_args=list(digits=2)
)$sensitivity |>
filter(variable=='theta') |>
mutate(across(where(is.double), ~num(.x, digits=2)))
Expand Down Expand Up @@ -923,7 +925,7 @@ likelihood with focus on average summer temperature increase from
1952 to 2022.

```{r}
powerscale_sensitivity(fit_lin_hs, prediction = \(x, ...) temp_diff, num_args=list(digits=2)
powerscale_sensitivity(fit_spline_h, prediction = \(x, ...) temp_diff, num_args=list(digits=2)
)$sensitivity |>
filter(variable=='temp_diff') |>
mutate(across(where(is.double), ~num(.x, digits=2)))
Expand Down

0 comments on commit 5adc114

Please sign in to comment.