-
Notifications
You must be signed in to change notification settings - Fork 2
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
vector components in fitode? #17
Comments
I talked to Jonathan about it, but I don't think there's a straightforward way to do this... there are two possibilities.
|
Here's a simple code generator that should generate something like the model JD wants: I don't know if it's worth the effort in this case or not. (I also don't know if the geometric series of rates is parameterized correctly - it's possible that it would be easier to fit with a simpler parameterization and then transform back to whatever is easier for humans to understand) n <- 4
Ivec <- paste0("I",1:n)
incidence <- sprintf("beta*S*(%s)", paste(Ivec, collapse = "+"))
Itrans <- function(i) sprintf("n*gamma^%d*I%d", i, i)
vars <- c("S", Ivec, "R")
resp <- c(sprintf("-%s", incidence),
sprintf("%s - n*gamma*I1", incidence),
sprintf("%s - %s", Itrans((2:n)-1), Itrans(2:n)),
Itrans(n))
## could also use base-R Map(), or a for loop ...
purrr::map2(vars, resp, ~reformulate(.x, response = .y)) |
This is very neat... you should share with JD if you haven't already. At the same time, I wonder if it's not worth the trouble writing a super generic function to do this given so many potential model structures... it seems like it would be so much easier to work on special cases like this than to try to figure out one function that covers all possible model structures... something to think about for a longer term |
Agreed (I did share it with him). I wouldn't try to write something general until we had collected a lot of specific examples. |
This is super-cool; I'll talk to Ningrui about trying it out. |
Jonathan Dushoff has a current problem where he is experimenting with models using a version of the linear chain trick. He therefore wants to be able to specify models of the form (roughly)
(In fact in his case the$\gamma$ values form a geometric progression rather than being constant across boxes)
Do you think there might be a way to accomplish this reasonably straightforwardly?
The text was updated successfully, but these errors were encountered: