Skip to content

Commit

Permalink
Minor tweaks to lfmcmc vignette simfun
Browse files Browse the repository at this point in the history
  • Loading branch information
apulsipher committed Oct 24, 2024
1 parent cb89885 commit 20bb6f3
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions vignettes/likelihood-free-mcmc.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ obs_data <- unname(as.integer(get_today_total(model_sir)))
```{r lfmcmc-setup}
# Define Simulation Function
simfun <- function(params, m) {
set_param(model_sir, "Recovery Rate", params[0])
set_param(model_sir, "Transmission Rate", params[1])
set_param(model_sir, "Recovery Rate", params[1])
set_param(model_sir, "Transmission Rate", params[2])
reset(model_sir)
run(
model_sir,
ndays = 50,
seed = model_seed
)
res <- get_today_total(model_sir)
res <- unname(as.integer(get_today_total(model_sir)))
return(res)
}
Expand All @@ -87,9 +87,6 @@ sumfun <- function(res, dat, m) {
return()
}
# Set initial parameters
par0 <- as.double(c(0.5, 0.5))
```

## Init LFMCMC
Expand All @@ -104,12 +101,16 @@ lfmcmc_model <- LFMCMC(model_sir) |>

## Run LFMCMC
```{r lfmcmc-run}
# run_lfmcmc(
# lfmcmc = lfmcmc_model,
# params_init_ = par0,
# n_samples_ = 2000,
# epsilon_ = 1.0
# )
# Set initial parameters
par0 <- as.double(c(0.5, 0.5))
# Run LFMCMC
run_lfmcmc(
lfmcmc = lfmcmc_model,
params_init_ = par0,
n_samples_ = 2000,
epsilon_ = 1.0
)
# set_stats_names(lfmcmc_model, get_states(model_sir))
# set_par_names(lfmcmc_model, c("Immune recovery", "Infectiousness"))
Expand Down

0 comments on commit 20bb6f3

Please sign in to comment.