Compute the Coefficient of Determination for Vector or Matrix Outcomes
Overview
Compute the coefficient of determination for outcomes in n-dimensions. May be useful for multidimensional predictions (such as a multinomial model) or calculating goodness of fit from latent variable models such as probabilistic topic models like latent Dirichlet allocation or deterministic topic models like latent semantic analysis. Based on Jones (2019) doi:10.48550/arXiv.1911.11061.
This patch addresses the issue with package documentation highlighted by CRAN and
described here
It also cites the arXiv paper in the DESCRIPTION by its DOI,
<doi:10.48550/arXiv.1911.11061>, rather than as <arXiv:1911.11061>, which
CRAN's checks had been flagging with a NOTE.
This patch also makes calc_rsquared() substantially faster, with no change to
its arguments or return value.
- **Sparse
yis no longer read as though it were dense.** The calculation visited every cell ofyand read each one out of the sparse matrix, which costs a search per read; on a 70,676 x 20,926 matrix that was roughly three billion searches to read four million nonzeros. Both sums of squares split into a part over the nonzeros and a part that does not depend ony's values, and the second part has a closed form, so only the nonzeros need visiting. On that matrix with 100 latent dimensions: **194 s to 1.5 s single threaded, and 16.6 s to 0.34 s on twelve threads.**
Show all changes in 0.1.6Hide the rest of the changes in 0.1.6
- **A
yhatsupplied directly no longer builds an identity matrix.** Whenyhatwas given as a matrix rather than as two matrices to multiply, it was turned into a factorization by pairing it with an identity the width ofy-- quadratic memory in the number of columns, and a matrix multiplication that did nothing. Such ayhatnow goes to its own routine. At 20,926 columns the identity alone was 3.5 GB, so this case previously became unusable on wide outcomes well before it became slow. - **Results are unchanged**, to floating point tolerance. The sums are accumulated in a different order, so this is not bit-for-bit identical to 0.1.5; agreement with a dense reference calculation is to about 1e-14 relative, and R-squared is unchanged in every digit
print()will show you. - **The note about parallelism and precision has been retired.** Results do not depend on
threads: each observation writes its own slot and the totals are summed sequentially afterwards. Thread counts from 1 to 12 were verified to give bit-identical results, on both the factorized and direct paths.
From NEWS.md in the release
Install
Health
- OK13 OK2026-09-05
- NOTE11 OK, 2 NOTE2026-06-09
- ERROR11 OK, 1 NOTE, 1 ERROR2026-06-08
- WARNING11 OK, 1 NOTE, 1 WARNING2026-06-07
- NOTE12 OK, 2 NOTE2026-04-22
Show 4 earlier changesHide 4 earlier changes
- ERROR11 OK, 2 NOTE, 1 ERROR2026-04-18
- NOTE12 OK, 2 NOTE2026-04-10
- ERROR12 OK, 1 NOTE, 1 ERROR2026-04-09
- NOTE12 OK, 2 NOTE2026-03-10
Documentation
- Help pages
- 2 (1 internal)includes a package overview page
- Examples that run
- 100%1 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 7
- Median days to close, 50 most recently updated closed PRs
- 0
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
6 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/tommyjones/mvrsquared on 2026-10-21.
The R CMD check workflow runs on Linux
This repository shows signs of AI coding tools.
- Claude Codefirst seen 2026-08-30Commits: at least 4 crediting it in the message
- Claude Opus 54 commits · Aug 2026
Dependencies
Installing mvrsquared adds 3 packages (3 with compiled code, 3.1 MB of source tarballs). Heaviest: Rcpp 1.8 MB, RcppArmadillo 1.0 MB, RcppThread 308 KB.
Code & Tests
People & History
Pick two releases to compare their code metrics.
- 0.1.6Latest
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- 0.1.52023-07-15 · diff ↗
- RR 4.3.0 released · 2023-04-21
- 0.1.42022-06-01 · diff ↗
- RR 4.2.0 released · 2022-04-22
- 0.1.22021-09-20 · diff ↗
- RR 4.1.0 released · 2021-05-18
- 0.1.12020-10-21 · diff ↗
- 0.1.02020-06-25 · diff ↗
- RR 4.0.0 released · 2020-04-24
- 0.0.32020-02-20
- RR 3.6.0 released · 2019-04-26
Package metadata
- First published
- 2020-02-20
- Total releases
- 7 / 6 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 3.0.2
- Download size
- 122 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("mvrsquared")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-23, which the citation names so these numbers can be found later. More on citing and the projects behind them.