Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple glms no longer supported? #659

Closed
jbohenek opened this issue Nov 29, 2023 · 2 comments · Fixed by #660
Closed

Simple glms no longer supported? #659

jbohenek opened this issue Nov 29, 2023 · 2 comments · Fixed by #660
Assignees

Comments

@jbohenek
Copy link

Hey all,

Again, I love the package, thanks for all the hard work. I am writing because I am having issues using performance (0.10.8)'s check_model() on a simple binomial model. The weird thing is that a previous version of check_model() worked fine on this model. And what's also weird is that it's not every simple glm(). For example, using check_model() on glm(vs~mpg,data=mtcars,family=binomial()) works just fine, but it still errors for my model below.

library(tidyverse)
library(easystats)
#> Warning: package 'easystats' was built under R version 4.3.2
#> # Attaching packages: easystats 0.7.0
#> ✔ bayestestR  0.13.1   ✔ correlation 0.8.4 
#> ✔ datawizard  0.9.0    ✔ effectsize  0.8.6 
#> ✔ insight     0.19.7   ✔ modelbased  0.8.6 
#> ✔ performance 0.10.8   ✔ parameters  0.21.3
#> ✔ report      0.5.7    ✔ see         0.8.1
eel<-read_csv("https://raw.githubusercontent.com/jbohenek/biol_5130/main/eel.csv") |>
  mutate(cured_bin = cured |> factor() |> as.numeric()-1)
#> Rows: 113 Columns: 4
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> chr (3): id, cured, intervention
#> dbl (1): duration
#> 
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
eel$cured_bin |> str()
#>  num [1:113] 1 1 1 0 0 0 1 0 0 1 ...

#model
fit<-glm(cured_bin~intervention+duration,data=eel,family=binomial())
summary(fit) #fits fine
#> 
#> Call:
#> glm(formula = cured_bin ~ intervention + duration, family = binomial(), 
#>     data = eel)
#> 
#> Coefficients:
#>                           Estimate Std. Error z value Pr(>|z|)   
#> (Intercept)              -0.998873   1.333109  -0.749  0.45369   
#> interventionNo treatment  1.233532   0.414565   2.975  0.00293 **
#> duration                  0.007835   0.175913   0.045  0.96447   
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> 
#> (Dispersion parameter for binomial family taken to be 1)
#> 
#>     Null deviance: 154.08  on 112  degrees of freedom
#> Residual deviance: 144.16  on 110  degrees of freedom
#> AIC: 150.16
#> 
#> Number of Fisher Scoring iterations: 4

#check
check_model(fit)
#> Error: `check_model()` not implemented for models of class `glm` yet.


Created on 2023-11-29 with [reprex v2.0.2](https://reprex.tidyverse.org/)
@strengejacke
Copy link
Member

Thanks, should be fixed in #660

library(easystats)
#> # Attaching packages: easystats 0.7.0 (red = needs update)
#> ✔ bayestestR  0.13.1.7     ✔ correlation 0.8.4.9000
#> ✔ datawizard  0.9.0.2      ✔ effectsize  0.8.6.2   
#> ✖ insight     0.19.6.6     ✔ modelbased  0.8.6.4   
#> ✔ performance 0.10.8.6     ✔ parameters  0.21.3.1  
#> ✔ report      0.5.7.13     ✔ see         0.8.1     
#> 
#> Restart the R-Session and update packages with `easystats::easystats_update()`.

eel <- data_read("https://raw.githubusercontent.com/jbohenek/biol_5130/main/eel.csv") |>
  data_modify(cured_bin = to_numeric(cured, lowest = 0))

fit <- glm(cured_bin ~ intervention + duration, data = eel, family = binomial())
check_model(fit)

Created on 2023-11-29 with reprex v2.0.2

@jbohenek
Copy link
Author

Perfect, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants