epiverse-trace / finalsize

R package to calculate the final size of an SIR epidemic in populations with heterogeneity in social contacts and disease susceptibility
https://epiverse-trace.github.io/finalsize/
Other
11 stars 7 forks source link

Would a default control function be worthwhile? #80

Open TimTaylor opened 2 years ago

TimTaylor commented 2 years ago

I wonder if this should call a default_control() function. This may be a little more tractable/transparent?

https://github.com/epiverse-trace/finalsize/blob/e059839623bd39504873eae5de6916a28fa643e8/R/final_size.R#L128-L134

It could become something like

 final_size <- function(r0 = 2.0, 
                        contact_matrix, 
                        demography_vector, 
                        p_susceptibility, 
                        susceptibility, 
                        solver = c("iterative", "newton"), 
                        control = default_controls(solver)) { 
pratikunterwegs commented 2 years ago

I agree that control = list() is a bit opaque, and in general I am in favour of being upfront about default arguments. Now that the proposed function body in #73 has a default control list creation step, with user values overriding the defaults if passed, this may be a bit more transparent to users?