Skip to content

support for psw#45

Merged
malcolmbarrett merged 2 commits intomainfrom
psw
Aug 4, 2025
Merged

support for psw#45
malcolmbarrett merged 2 commits intomainfrom
psw

Conversation

@malcolmbarrett
Copy link
Member

No description provided.

@malcolmbarrett malcolmbarrett requested a review from Copilot August 4, 2025 12:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for propensity score weight (psw) objects from the propensity package throughout the halfmoon package. The changes enable seamless integration with psw objects while maintaining backward compatibility with numeric weights.

  • Modified data generation to preserve psw objects instead of converting to numeric
  • Added utility function to extract numeric data from both regular numeric vectors and psw objects
  • Updated all weight-handling functions to work with psw objects through the extraction utility

Reviewed Changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
data-raw/nhefs_weights.R Preserves psw objects from propensity package instead of converting to numeric
R/utils.R Adds extract_weight_data() utility function to handle both numeric and psw weights
R/utils-validation.R Updates weight validation to accept psw objects
R/compute_balance.R Updates all balance functions to extract numeric data from psw weights
R/compute_qq.R Updates weighted_quantile to handle psw weights
R/ess.R Updates effective sample size calculation for psw weights
R/check_auc.R Updates ROC curve functions to handle psw weights
R/geom_*.R Updates all geom functions to extract numeric data from psw weights
R/plot_*.R Updates plotting functions to handle psw weight columns
tests/testthat/test-compute_balance.R Adds comprehensive tests for psw object compatibility
tests/testthat/test-geom_*.R Updates tests with workarounds for pivot_longer compatibility
man/*.Rd Updates documentation examples with psw extraction workarounds
Comments suppressed due to low confidence (2)

tests/testthat/test-compute_balance.R:1530

  • [nitpick] The variable name 'w_cat_ato' is inconsistent with the pattern used elsewhere in the test. Other weight variables use 'w_cat_ate' and 'w_cat_att_none'. Consider using a more descriptive name or ensuring consistency with the naming convention.
    weights = nhefs_weights$w_cat_ato

tests/testthat/test-geom_qq2.R:148

  • [nitpick] The variable name 'nhefs_for_pivot2' is inconsistent with 'nhefs_for_pivot' used elsewhere. Consider using a consistent naming pattern like 'nhefs_for_pivot' throughout the file.
  nhefs_for_pivot2 <- nhefs_weights

@malcolmbarrett malcolmbarrett merged commit 41ec02b into main Aug 4, 2025
8 checks passed
@malcolmbarrett malcolmbarrett deleted the psw branch August 4, 2025 15:07
@malcolmbarrett malcolmbarrett mentioned this pull request Aug 4, 2025
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.

1 participant