bradbell / at_cascade

Cascading Dismod_at Analysis From Parent To Child Regions
https://at-cascade.readthedocs.io
4 stars 3 forks source link

Extend csv.predict so that it can predict using samples of the prioir. #14

Closed garland-culbreth closed 3 months ago

garland-culbreth commented 4 months ago

Type of changes

garland-culbreth commented 4 months ago

Adding: I'd like to have a go at building out this functionality myself, I think it would be good experience to get, but I'm not yet certain that I can commit to it. If I'm able to I'll add another comment here.

bradbell commented 3 months ago

As I understand, you are not really interested in the priors, but rather the predictions corresponding to the priors ? See https://at-cascade.readthedocs.io/csv.predict.html Currently csv.predict only shows predictions corresponding to the posteriors.

garland-culbreth commented 3 months ago

You're right, interested in the predictions corresponding to the priors, exactly (apologies for the ambiguous wording). More specifically: This item was envisioning an output analogous to sam_predict.csv with prediction samples generated from the prior distribution, rather than the posterior distribution.

bradbell commented 3 months ago

I think that the place we should start is by understanding exactly what is in the prior_sim table: https://dismod-at.readthedocs.io/prior_sim_table.html#prior-sim-table-name

Looking at the code in under prior_sim_table https://cppad.readthedocs.io/latest/jit_get_started.cpp.html#jit-get-started-cpp-title it is clear that the the value dage and dtime values are simulated independently. We would need to simulate the values where theses three independent priors are combined to just simulate correlated values.

The easiest (and slowest) way to do this is to hold out all the data, fit, and compute posterior samples for an area then do predictions from that.

It is possible that a fit with just the priors would fail, in which case one cannot make any predictions given just the prior (not enough information). For example, if any of the priors at the root level are uniform, you will probably not be able to do predictions from the priors (at any level). (It is possible that a rates dage, dtime, or value prior is uniform and it still determines the rate give the other priors for the rate).

bradbell commented 3 months ago

I merged this pull request with the changes on 06-18; see https://at-cascade.readthedocs.io/2024.html#mm-dd-06-18

I am not sure why it is not marked as merged. Please close this pull request if you are satisfied that it has been completed.

garland-culbreth commented 3 months ago

Closing since it's been merged but for some reason not marked so.