Skip to content

Commit

Permalink
2024-08-08 update : prep testfile.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbernalz committed Aug 8, 2024
1 parent d4ba92c commit 8695591
Showing 1 changed file with 1 addition and 48 deletions.
49 changes: 1 addition & 48 deletions scratch/testfile.R
Original file line number Diff line number Diff line change
@@ -1,48 +1 @@
# Expose the stan functions into the global environment
model <- cmdstanr::cmdstan_model(
stan_file = file.path("inst", "stan", "wwinference.stan"),
compile = TRUE,
compile_standalone = TRUE,
force_recompile = TRUE
)
model$expose_functions(global = TRUE)
model <- cmdstanr::cmdstan_model(
stan_file = file.path("inst", "stan", "functions", "spatial_functions.stan"),
compile = TRUE,
compile_standalone = TRUE,
force_recompile = TRUE
)
model$expose_functions(global = TRUE)

n_time <- 150
state_dev_ar_coeff <- 0.8
log_state_rt <- rnorm(
n = n_time,
mean = 1.2,
sd = 0.05
)
state_dev_noise_vec <- state_deviation_noise_vec_aux_rng(
scaling_factor = 1.1,
sigma_eps = sqrt(0.2),
n_time = n_time
)
stan_log_aux_site_rt <- construct_aux_rt(
log_state_rt = log_state_rt,
state_deviation_ar_coeff = state_dev_ar_coeff,
state_deviation_noise_vec = state_dev_noise_vec
)


state_deviation_t_i <- 0
log_aux_site_rt <- matrix(
data = 0,
ncol = n_time,
nrow = 1
)
for (t_i in 1:n_time) {
state_deviation_t_i <- state_dev_ar_coeff * state_deviation_t_i +
state_dev_noise_vec[t_i]
log_aux_site_rt[t_i] <- log_state_rt[t_i] + state_deviation_t_i
}

stan_log_aux_site_rt == log_aux_site_rt
# prep for branch.

0 comments on commit 8695591

Please sign in to comment.