-
Notifications
You must be signed in to change notification settings - Fork 5
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
Prototype binomial obs model #568
base: main
Are you sure you want to change the base?
Conversation
Try this Pull Request!Open Julia and type: import Pkg
Pkg.activate(temp=true)
Pkg.add(url="https://github.com/CDCgov/Rt-without-renewal", rev="binomial-obs", subdir="EpiAware")
using EpiAware |
I think ultimately this goes back to #161 because we do want to lay out a long term data structure plan. Then the observed cases and the observed |
Total brainstorm (no wrong answer) first thought. We can splat both positional and kwargs so a pattern that could work: for i in eachindex(Y_t)
y_t_defined[i + diff_t] ~ observation_error(obs_model, Y_t[i]...; priors...)
end This would require Also padding would have to be done at the level down; which might make sense here because padding something on [0,1] is different |
In fact given our transform expectation utility maybe just get rid of padding (different issue) |
This is close to what we have and doesn't help because it still means N (which we are assuming is data and so not in Y_t which is model generated) is a vector? |
N being a vector is a problem for the generate from prior approach unless we have some thing where we also pass in the index, e.g. function observation_error(obs_model::BinomialError, Y_t, t ; N)
return Binomial(N[t], Y_t)
end I'm conceptually ok with |
yes my point was your approach didn't seem to work? |
The maths means we want/need
Because |
More chucking ideas out there, instead of inelegant double splatting for i in eachindex(Y_t)
y_t_defined[i + diff_t] ~ observation_error(obs_model, Y_t[i], priors...)
end could be (yet another) @submodel for i in eachindex(Y_t)
@submodel generated_y_t = observation_error(obs_model, y_t_defined[i + diff_t] , Y_t[i], priors...)
end This gives more flexibility to pass in the data as a Vector{SomeDataObj} e.g. @model function observation_error(obs_model::BinomialError, y_t, Y_t)
cases, N = y_t
cases ~ Binomial(N, Y_t)
return cases
end I realise this is not cost free |
@SamuelBrand1 any thoughts. The issue with the current approach is N needs to be a vector and the prior function has no way to support this. One option is a data unpacking generic method (empty) that can be specialised and other options are to doo with changing what is passed in in the first place