Bivariate Within- and Between-Cluster Correlations
Overview
Separates supplied variables into within- and between-cluster components and calculates bivariate correlations for each level separately. For Pearson correlations, the centered-score decomposition corresponds to commonly used between- and within-cluster correlations reviewed by Tu et al. (2025) doi:10.1002/sim.10326. The package's descriptive Spearman option is distinct from the clustered rank parameters introduced in that paper. The package is also motivated by the distinction between within- and between-person variation described by Curran and Bauer (2011) doi:10.1146/annurev.psych.093008.100356 and by Hamaker (2024) doi:10.1080/00273171.2022.2155930. The package is intended for longitudinal or otherwise clustered data where researchers need transparent correlation matrices before fitting more complex multilevel models.
Statistical correctness
- Reimplemented the one-way random-effects, single-measure ICC(1,1) with the ANOVA method-of-moments formula for unequal cluster sizes. Negative sample ICCs are retained, and non-estimable cases now return explicit diagnostics.
- Corrected Pearson analytic degrees of freedom and Fisher-z confidence intervals. Intervals are bounded by -1 and 1, and inference that is not supported by the available analysis units is reported as unavailable.
- Clarified that the Spearman option is a descriptive correlation of mean-centered scores within clusters and of cluster means between clusters. Unsupported analytic, row-jackknife, and cluster-size-weighted Spearman inference has been removed; whole-cluster bootstrap intervals remain available.
Show all changes in 0.3.2Hide the rest of the changes in 0.3.2
Inputs, diagnostics, and output
- Strengthened validation for data, cluster identifiers, method, confidence levels, bootstrap settings, weighting, and centering choices.
- Logical variables and declared two-level factors are supported with explicit 0/1 orientation. Other categorical inputs are rejected with guidance, and non-finite numeric values are treated as missing.
- Detailed tables now retain every requested variable pair, including pairs whose coefficient or inference cannot be estimated. Pair-specific observation counts, cluster counts, coefficient status, inference status, reasons, and bootstrap yield diagnostics are reported.
- Correlation-matrix diagonals are 1 only for variables with positive variance at the relevant level; otherwise they are
NA. - Added positive-semidefinite diagnostics for the unrounded within- and between-cluster matrices. Pairwise matrices that are not positive semidefinite now trigger a targeted warning, and
missing_data = "listwise"provides an optional common-row analysis. get_matrix(..., numeric = TRUE)now returns unrounded numeric within, between, and merged matrices, including unrounded ICC diagonals.print()now provides concise, executable guidance for inspecting summaries and extracting full tables, numeric matrices, and ICCs.- Plot panels now use the exact pair-specific rows, centering rule, method, and between-cluster weights used by the fitted object. Annotations come from the stored coefficient and p-value, and significance legends are omitted when p-values were not requested or are unavailable.
to_excel()now accepts a data frame or matrix directly, supports mixed lists of tabular objects, errors clearly when there is nothing to write, and invisibly returns the supplied output path.
Development and release preparation
- Added reference tests against
psych::statsBy()for within- and between-cluster correlations and ICC(1,1), and expanded automated regression-test coverage. - Added a pkgdown website workflow and a vignette introducing the distinction between within- and between-cluster correlations.
- Removed obsolete self-generated test fixtures, a generated plot file, and tracked R session history. Added safeguards against including regenerated session or graphics artifacts in the repository and source package.
- Corrected the bundled-data documentation to report 5,000 observations from 100 participants measured over 50 days.
- Added repository citation metadata and a DOI badge that use the permanent Zenodo concept DOI,
10.5281/zenodo.20357592, rather than a release-specific DOI.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK8 OK2026-06-10
Documentation
- Help pages
- 12
- Examples that run
- 100%7 run in a plain check
- Exported functions with examples
- 71%
- Documented parameters
- 95%
- Return-value docs
- 100%
- Help pages citing references
- 17%
Downloads
Repository
- PRs merged (all time)
- 96%
- Median days to close, 50 most recently updated closed issues
- 1
- Median days to close, 50 most recently updated closed PRs
- 0
Releases over time
Issues over time
PRs over time
Commits over time
9 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/pascal-kueng/wbcorr on 2026-10-22.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-08-25 · The repository has a site deploy workflow
pkgdown site last built 2026-08-25
Show all practicesHide 1 practice
Dependencies
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 0.3.2Latest
- 0.3.12026-06-09
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-06-09
- Total releases
- 2 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.5.0
- Bundled data
- 111 KB / 1 file
- Download size
- 212 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("wbCorr")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-24, which the citation names so these numbers can be found later. More on citing and the projects behind them.