-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add comparison function #12
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
richfitz
commented
Aug 23, 2024
•
edited
Loading
edited
thomrawson
reviewed
Aug 29, 2024
#Actual Model
pkgload::load_all()
data <- process_data(readRDS("tests/testthat/weekly.rds"))
## WEEKLY RATES EVERYWHERE!
pars <- cowflu_inputs(alpha = 0.35,
beta = 2.45,
gamma = 1.4,
sigma = 3.5,
asc_rate = 1,
dispersion = 1,
cowflu_fixed_inputs(p_region_export = movement$p_region_export,
p_cow_export = movement$p_cow_export,
movement_matrix = movement$movement_matrix,
time_test = 136,
n_herds_per_region = usda_data$n_herds_per_region,
n_cows_per_herd = usda_data$n_cows_per_herd,
start_herd = 26940, #26804 is where Texas starts.
start_count = 5,
condition_on_export = TRUE
))
#pars$time_test <- 136
#pars$n_test <- 0
#Texas starts at herd: usda_data$region_start[41] + 1 = 26804,
#this is with 4 cows in it.
#Currently, if you try and put more start cows in than there exists, it'll do it anyway and have negative in the S.
##TODO: Make a check to catch this.
set.seed(1)
n_particles <- 2
sys <- dust2::dust_system_create(cows(), pars, n_particles = n_particles, dt = 1) # n_threads for parallelism
dust2::dust_system_set_state_initial(sys)
## Check on doing comparison to data; this is just for debugging really.
## Here assuming that you are working with weeks:
dust2::dust_system_run_to_time(sys, data$week[[1]])
dust2::dust_system_compare_data(sys, list(positive_tests = data$positive_tests[[1]]))
data_week <- dust2::dust_filter_data(data, time = "week")
filter <- dust2::dust_filter_create(cows(), 0, data_week,
dt = 0.1, n_particles = 20, n_threads = 8)
ll <- dust2::dust_filter_run(filter, pars) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.