Skip to content

Simulate infections #557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add backend argument
  • Loading branch information
sbfnk committed Feb 20, 2024
commit af9076533965eb3e72e276075018c2c7569cd5a9
17 changes: 9 additions & 8 deletions R/simulate_infections.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ simulate_infections <- function(estimates, R, initial_infections,
truncation = trunc_opts(),
obs = obs_opts(),
CrIs = c(0.2, 0.5, 0.9),
backend = "rstan",
pop = 0, ...) {
## deprecated usage
if (!missing(estimates)) {
Expand Down Expand Up @@ -173,16 +174,16 @@ simulate_infections <- function(estimates, R, initial_infections,
day_of_week_effect, dim = c(1, data$week_effect)
)

# Load model
model <- stanmodels$simulate_infections

sim <- sampling(
object = model,
data = data, chains = 1, iter = 1,
algorithm = "Fixed_param",
refresh = 0
# Create stan arguments
stan <- stan_opts(backend = backend, chains = 1, samples = 1, warmup = 1)
args <- create_stan_args(
stan, data = data, fixed_param = TRUE, model = "simulate_infections",
verbose = FALSE
)

## simulate
sim <- fit_model(args, id = "simulate_infections")

## join batches
dates <- c(
seq(min(R$date) - seeding_time, min(R$date) - 1, by = "day"),
Expand Down
4 changes: 4 additions & 0 deletions man/simulate_infections.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.