easystats / easystats/performance

Wald tests - differences across packages

Open
#509 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

m1 <- glm(vs ~ disp + hp + drat, data = mtcars, family = "binomial")
m2 <- glm(vs ~ disp + hp, data = mtcars, family = "binomial")
m3 <- glm(vs ~ disp, data = mtcars, family = "binomial")

rez <- performance::test_wald(m1, m2, m3)
ref1 <- lmtest::waldtest(m1, m2, m3, test = "F")
ref2 <- anova(m1, m2, m3, test = "F")
#> Warning: using F test with a 'binomial' family is inappropriate

rez
#> Name | Model | df | df_diff |     F |     p
#> -------------------------------------------
#> m1   |   glm | 28 |         |       |      
#> m2   |   glm | 29 |   -1.00 |  8.44 | 0.007
#> m3   |   glm | 30 |   -1.00 | 12.94 | 0.001
#> Models were detected as nested and are compared in sequential order.
ref1
#> Wald test
#> 
#> Model 1: vs ~ disp + hp + drat
#> Model 2: vs ~ disp + hp
#> Model 3: vs ~ disp
#>   Res.Df Df      F  Pr(>F)  
#> 1     28                    
#> 2     29 -1 2.0444 0.16383  
#> 3     30 -1 2.9782 0.09504 .
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ref2
#> Analysis of Deviance Table
#> 
#> Model 1: vs ~ disp + hp + drat
#> Model 2: vs ~ disp + hp
#> Model 3: vs ~ disp
#>   Resid. Df Resid. Dev Df Deviance      F  Pr(>F)  
#> 1        28     12.869                             
#> 2        29     16.750 -1  -3.8802 3.8802 0.04886 *
#> 3        30     22.696 -1  -5.9462 5.9462 0.01475 *
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Created on 2022-10-30 with reprex v2.0.2

@DominiqueMakowski @mattansb @bwiernik (or someone else)

Any ideas?

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 by reproducing the example with performance::test_wald(), lmtest::waldtest(), and anova() using the three binomial glm models shown. Determine which result or comparison semantics are intended, then add a regression test covering the discrepancy; the issue does not identify a source file or existing test.

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
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.