-
Notifications
You must be signed in to change notification settings - Fork 8
revision analysis first draft #492
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
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I got caught up on a few style/convention/technicalities points. Main "substantive" things are that I think the names of some quantities need some brainstorming.
Need to do another pass about correctness (think we flagged some things on Slack).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Complaining/brainstorming more about naming.
I'm getting some surprising results regarding min and max lags. Think there might be a bug here and maybe some pre-existing issues. Hoping you can figure out what's up before we push the button on this.user error
cli_inform("Change by more than {abs_change_threshold} in actual value (when revised):") | ||
cli_li(num_percent(abs_change, n_real_revised)) | ||
} | ||
return(revision_behavior) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return(revision_behavior) | |
return(invisible(revision_behavior)) |
idea: we might also want to make this an S3-classed thing with a print
that will print the summary + a pointer to use as_tibble()
to get the underlying data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dunno, I personally find printing the full thing under if you haven't assigned it to a variable to be somewhat useful, if maybe a bit cluttered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Might consider then:
- [Adding some sort of explanatory blurb to explain what this tibble is... it'd be convenient to just tack this on to the end of the summary you print, but might be a little hard to word]
Alternatively, if printing the summary, also explicitly print[--- maybe this is too much clutter..]revision_behavior
, but with a little explanatory blurb beforehand, and returning invisibly if the summary printing was requested (to not double-print it)
(Any way, always returning invisibly isn't the right thing. Should definitely return visibly if the summary wasn't printed.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized my previous main concern wasn't actually an issue.
62e496d
to
8617ea7
Compare
6489d34
to
889d53e
Compare
Checklist
Please:
PR).
brookslogan, nmdefries.
DESCRIPTION
. Always incrementthe patch version number (the third number), unless you are making a
release PR from dev to main, in which case increment the minor version
number (the second number).
(backwards-incompatible changes to the documented interface) are noted.
Collect the changes under the next release number (e.g. if you are on
1.7.2, then write your changes under the 1.8 heading).
process.
Change explanations for reviewer
This adds a function that computes some per-epi-key (so normally geo_value-time_value pairs) stats about revisions. Under normal operation it drops all
NA
values so they are treated as missing. It returns a tibble that has 1 row for each epi-key, with columns:min_lag
: the minimum time to any value (ifdrop_nas=FALSE
, this includesNA
's)max_lag
: the amount of time until the final (new) version (same caveat fordrop_nas=FALSE
, though it is far less likely to matter)max_change
: the difference between the smallest and largest values (this always excludesNA
values)max_rel_change
:max_change
divided by the largest value (so it will always be less than 1). Note that this need not be the final value. It will beNA
whenevermax_change
is 0.time_to_x_final
: wherex
is thepercent_final_value
(default). This gives the lag when the value is within1-x
of the value at the final time. For example, consider the series (0,20, 99, 150, 102, 100); thentime_to_x_final
is the 5th index, since even though 99 is within 20%, it is outside the window afterwards at 150.The function also (optionally) prints out an overall summary of this summary.
This PR factors out compactification into a standalone function (since I needed it to drop
NA
s effectively.Still to do:
Magic GitHub syntax to mark associated Issue(s) as resolved when this is merged into the default branch