-
Notifications
You must be signed in to change notification settings - Fork 6
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
Refactor observe_process
function
#33
Comments
I think its implementing the observation process which in this instance is censoring but agree it can be renamed. FYI I think this should be organised under some kind of simulation label (as this is part of the simulation/validation code) - in general if we start organising issues like this it may help us gain some clarity around what is happening |
Even in this instance I'd think of the observation process as having multiple stages, including but not limited to censoring. I think having functions to modularly implement each part of the observation process would be nice. |
Yes agree |
As a part of this issue, I propose to:
|
observe_process()
function
I am now working in this direction. |
Note on implementation:
|
I've drafted a function that would look like this: observe_process <- function(linelist, pwindow = 1, swindow = 1) {
assert_numeric(pwindow, lower = 0)
assert_numeric(swindow, lower = 0)
linelist |>
mutate(
ptime_lwr = .floor_mult(.data$ptime, f = pwindow),
ptime_upr = .data$ptime_lwr + pwindow,
stime_lwr = .floor_mult(.data$stime, f = pwindow),
stime_upr = .data$stime_lwr + swindow,
delay_lwr = pmax(0, .data$stime_lwr - .data$ptime_lwr - 1),
delay_upr = .data$delay_lwr + pwindow + swindow
)
} If users provide data where I'm also interested as to why in the original code the upper bound for the delay was the lower bound plus one. Isn't this wrong? The upper bound should be plus two? |
Expanding upon
then I think we can do two things with this function:
Things to be worried about here:
|
To me, the function should also be renamed. I am thinking of it as a "add censoring" function, which might exist as some part of a more modular observation process collection of functions. As I write above, I think this function can also be used within preprocessing for data that are censored but don't have the windows in the
|
observe_process()
functionobserve_process
function
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch!
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 96671b56707c79c32c3b90aae51f07fb1c69343d [formerly c053cfd78c114c248605ed72f1cbabb4b32b3569] Former-commit-id: cc406257db083a003725ac53a1ac52c64129f234
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 05053e1 Former-commit-id: 0fb7ec80e140a7887bb091dac128d53ce950c5ec
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 05053e1 Former-commit-id: 0fb7ec80e140a7887bb091dac128d53ce950c5ec
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 05053e1 Former-commit-id: 0fb7ec80e140a7887bb091dac128d53ce950c5ec
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 96671b56707c79c32c3b90aae51f07fb1c69343d [formerly c053cfd78c114c248605ed72f1cbabb4b32b3569] Former-commit-id: cc406257db083a003725ac53a1ac52c64129f234
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 96671b56707c79c32c3b90aae51f07fb1c69343d [formerly c053cfd78c114c248605ed72f1cbabb4b32b3569] Former-commit-id: cc406257db083a003725ac53a1ac52c64129f234 Former-commit-id: 99acbd4
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 05053e1 Former-commit-id: 0fb7ec80e140a7887bb091dac128d53ce950c5ec Former-commit-id: 30c9d47dc3d7266df6c74eb77fa4a870232d5c36 [formerly 0f90b0e] Former-commit-id: c4777e5410e516ba0ae27961dc3e9bfb94decb54
* Add template for new add_event_vars function * First draft complete of add_event_vars functionality * Reduce complexity of add_event_vars using a helper function * Template for add_obs_vars * Revert commit to wrong branch! Former-commit-id: 05053e1 Former-commit-id: 0fb7ec80e140a7887bb091dac128d53ce950c5ec Former-commit-id: 30c9d47dc3d7266df6c74eb77fa4a870232d5c36 [formerly 0f90b0e] Former-commit-id: c4777e5410e516ba0ae27961dc3e9bfb94decb54
New plan
add_event_vars
function to add upper and lower given either lower and window or lower and upperptime_lwr
andptime_upr
(i.e. change the names)Old
I've just used
observe_process()
. Some notes on possible refactor:The text was updated successfully, but these errors were encountered: