easystats / easystats/performance

Possible error in r2_xu in performance

Open
#598 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

3 investigators :grey_question::question: Bug :bug:
Dominant language
R
Stars
1.2k
Forks
109
Avg merge
6h 34m
Merged PRs (30d)
8

Description

Hello,

I just wanted to briefly point out that, in my opinion, r2_xu in performance might not be correctly specified; to me it looks like the function calculates an omega as given in equation (6) of Xu (2003; 0.1002/sim.1572), altough this equation seems to be only for null models. In the current version r2_xu is calculated as follows:

r2_xu <- 1 - stats::var(stats::residuals(model, verbose = FALSE))/stats::var(insight::get_response(model, verbose = FALSE))

This means that the variance of the residuals of the model with covariates is devided by the variance of the reponse (equation 6), not by the residual variance of the null model (as in equation 5).

Of course I might also get it wrong?

Best wishes

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the r2_xu calculation quoted in the issue and read the surrounding performance implementation. Compare it with equations (5) and (6) of Xu (2003); done means the applicable definition is established and the implementation and regression coverage reflect it.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.