Skip to content
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 Analyze Poisson using broom #114

Merged
merged 1 commit into from
Feb 10, 2022
Merged

Refactor Analyze Poisson using broom #114

merged 1 commit into from
Feb 10, 2022

Conversation

jwildfire
Copy link
Contributor

Details

Refactoring Analyze Poisson using broom.

Risk Assessment

Risk: Medium
Mitigation Strategy:

  • Qualification Testing
  • Unit Testing
  • Code Review
  • QC
  • Automated Testing

Notes: Moderate risk since it's refactoring a statistical workflow, but changes are really mostly moving towards tidyverse syntax. Underlying model is still run by Poisson. Since we are pre-v1, will cover the full QC checklist separate from this PR. Filed #113 to tackle base unit tests in future PR.

@jwildfire jwildfire requested a review from gwu05 February 8, 2022 21:21
dfAnalyzed$PredictedCount <- exp(dfAnalyzed$LogExposure*cModel$coefficients[2]+cModel$coefficients[1])
dfAnalyzed$PValue = stats::pnorm( abs(dfAnalyzed$Residuals) , lower.tail=F ) * 2
dfAnalyzed <- dfAnalyzed[order(abs(dfAnalyzed$Residuals) , decreasing=T), ]
dfAnalyzed <- broom::augment(cModel, dfModel, type.predict = "response") %>%
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably something looked into a while back, but I forget the difference here between Residuals vs standardized residuals for the formula in the Poisson. I think we probably only need to keep the relevant columns (two residuals columns, and the additional hat (leverage), sigma (sd), cooksd (influence), may confuse user and probably can be hidden for now)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I agree. Will think about it a bit more once wilcoxon and maybe disposition are done and try to come up with some standardized naming.

Copy link
Contributor

@gwu05 gwu05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good - could consider simplifying analyze outputs.

@jwildfire jwildfire merged commit 45bc69b into dev Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants