Add compute_icc() for calculating intraclass correlation from clustered designs #492
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Extracts
compute_icc()function fromcopilot/adjust-seroincidence-likelihoodinto standalone PR. Computes Intraclass Correlation Coefficient (ICC) for seroincidence estimates using design effect (DEFF) method: ICC = (DEFF - 1) / (m̄ - 1), where DEFF is the ratio of cluster-robust to standard variance.Note: Examples are wrapped in
\dontrun{}as the clustering functionality (cluster_varparameter) is not yet available in the main branch. The function is ready to use once clustering support is merged.Changes
Core functionality:
compute_icc.R- S3 generic with methods forseroincidenceandseroincidence.byobjectscompute_icc_single.R- Internal ICC computation for single estimatescompute_cluster_robust_var.R- Sandwich variance estimator for clustered dataicc_single_to_df_row.R- Helper for stratified result formattingOutput methods:
print.icc_seroincidence.R- Formatted output with clustering diagnosticsprint.icc_seroincidence.by.R- Stratified results as tibbleDocumentation:
\dontrun{})compute_icc+ 5 S3 methodsConfiguration:
Example Usage
-for NEWS.md inclusionOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.