Skip to content

Calculate and Compare Multiple Definitions of Coefficient of Determination

0packages depend
1.8Kdownloads / year
90.4%test coverage
13/13flavors OK

Overview

About

Calculate nine types of coefficients of determination (R-squared) based on the classification by Kvalseth (1985) doi:10.1080/00031305.1985.10479448. This package is designed for educational purposes to demonstrate how R-squared values can fluctuate depending on the choice of formula, particularly in power regression models or linear models without an intercept. By providing a comprehensive list of definitions, it helps users understand the mathematical sensitivity of goodness-of-fit indices.

Changes in 0.2.0

New Features

  • Added model_info() function to extract metadata used for calculations, such as regression type (linear/power), sample size ($n$), and degrees of freedom ($k$, $df_{res}$).
  • The print() methods for r2_kvr2 and comp_kvr2 objects now display model information at the end of the output by default.
  • Added a new argument model_info (default is TRUE) to print() methods, allowing users to toggle the display of model metadata.
  • Added comp_model() to contrast intercept and no-intercept versions of the same model using QR-decomposition for robust re-calculation.
  • Added a set of plot functions that visually display the difference between the actual and predicted values of the dependent variable in the model and the coefficient of determination.

Improvements

  • Improved the auto-detection logic for power regression models. It now correctly distinguishes between a variable named "log" and the log() function call (e.g., lm(log(y) ~ x) is correctly identified while lm(log ~ x) is treated as linear).
  • Internal calculations now explicitly store model attributes to ensure consistency between r2() and model_info().

Bug Fixes

  • Fixed several typographical errors in the output and documentation. Notably, corrected "RMES" to "RMSE" (Root Mean Square Error) in the output of comp_fit().
  • Fixed a misclassification issue where models with a dependent variable named "log" were incorrectly identified as power regression when using type = "auto".
Show all changes in 0.2.0Hide the rest of the changes in 0.2.0
  • Corrected "liner" to "linear" in various internal labels and documentation to ensure consistency with standard statistical terminology.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 2.1 min · r-oldrel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-06-09
  • ERROR12 OK, 1 ERROR2026-06-08
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.2.0
READMEYes · 919 wordsVignettesYes · 2 · dynamicNEWSYes · 100% structured · mentions 0.2.0Citation fileNoWebsiteYes · pkgdown
Help pages
11
Examples that run
100%8 run in a plain check
Exported functions with examples
86%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
36%

Downloads

1.8K
CRAN downloads in the past year
Rank #23,148 · ~5/day · ~149/mo
Daily download trend is not available in this view yet.
20930 days
56390 days
1.8K1 year
Compare downloads with other packages →
Also on53 r2u2 autocran

Repository

1Stars
0Forks
0Open issues
0Open PRs
2Releases
50Commits
1Commit identities
50 commits · Last activity 2026-03-11 · Default branch at 0.2.0.9000, ahead of CRAN 0.2.0 (checked 2026-10-22)
Responsiveness
not measured
PracticesBeta

8 development-tooling and community-health practices detected across 4 families in the upstream repository

Checks run against github.com/indenkun/kvr2 on 2026-10-22.

Continuous integration (1)
GitHub Actions
Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2026-03-10 · The repository has a site deploy workflow

pkgdown site last built 2026-03-11

CRAN release process (2)
cran-comments.mdCRAN-SUBMISSION
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v4 (2026-10-20)

Dependencies

Declared dependencies
6 external dependencies (excludes base and recommended)

Installing kvr2 adds 30 packages (15 with compiled code, 29 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, isoband 1.5 MB.

Depends (0)
none
Imports (5)
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

People & History

People (1)
Author, Maintainer since 0.1.0 (2026)
Releases (2)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • 0.2.0Latest
    record
    2026-03-10 · current release · diff ↗ ·
    added 4 exports
    comp_model, model_info, plot_diagnostic, plot_kvr2
  • 0.1.0
    record
    2026-02-12
  • R
    R 4.5.0 released · 2025-04-11

Package metadata

First published
2026-02-12
Total releases
2 / 1 yrs
License
MIT + file LICENSE OSI
Download size
149 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("kvr2")
Kobayashi, M. (2026). kvr2: Calculate and Compare Multiple Definitions of Coefficient of Determination (Version 0.2.0) [Computer software]. https://doi.org/10.32614/CRAN.package.kvr2

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.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for kvr2 version 0.2.0 [Data set]. HJJB, LLC. Data release v2026-10-23. https://doi.org/10.5281/zenodo.21843040

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.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy