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

What is the expected behaviour for report(estimate_contrasts(model))? #399

Open
alexisdmacintyre opened this issue Oct 27, 2023 · 1 comment
Assignees
Labels
waiting for response 💌 Need more information from people who submitted the issue

Comments

@alexisdmacintyre
Copy link

Question and context
Based on this documentation and discussion here, my understanding is that report() should return a little write-up summarising the results of an estimate_contrasts object. However, when I try this with my fitted lmer model, I just get generic descriptive statistics. The same thing happens for me if I run the example from the documentation:

library(modelbased)
model <- lm(Sepal.Width ~ Species, data = iris)
contr <- estimate_contrasts(model)
report(contr)

The expected response (according to the documentation):

#> The marginal contrasts analysis suggests the following. The difference between
#> setosa and versicolor is positive and statistically significant (difference =
#> 0.66, 95% CI [ 0.49, 0.82], t(147) = 9.69, p < .001). The difference between
#> setosa and virginica is positive and statistically significant (difference =
#> 0.45, 95% CI [ 0.29, 0.62], t(147) = 6.68, p < .001). The difference between
#> versicolor and virginica is negative and statistically significant (difference
#> = -0.20, 95% CI [-0.37, -0.04], t(147) = -3.00, p = 0.003)

What I get:

The data contains 3 observations of the following 9 variables:

  - Level1: 2 entries, such as setosa (n = 2); versicolor (n = 1); NA (0 missing)
  - Level2: 2 entries, such as virginica (n = 2); versicolor (n = 1); NA (0 missing)
  - Difference: n = 3, Mean = 0.30, SD = 0.45, Median = 0.45, MAD = 0.30, range: [-0.20, 0.66], Skewness = -1.34, Kurtosis = -1.50, 0 missing
  - CI_low: n = 3, Mean = 0.14, SD = 0.45, Median = 0.29, MAD = 0.30, range: [-0.37, 0.49], Skewness = -1.34, Kurtosis = -1.50, 0 missing
  - CI_high: n = 3, Mean = 0.47, SD = 0.45, Median = 0.62, MAD = 0.30, range: [-0.04, 0.82], Skewness = -1.34, Kurtosis = -1.50, 0 missing
  - SE: n = 3, Mean = 0.07, SD = 1.70e-17, Median = 0.07, MAD = 0.00, range: [0.07, 0.07], Skewness = 0.82, Kurtosis = -2.00, 0 missing
  - df: n = 3, Mean = 147.00, SD = 0.00, Median = 147.00, MAD = 0.00, range: [147, 147], Skewness = , Kurtosis = , 0 missing
  - t: n = 3, Mean = 4.46, SD = 6.63, Median = 6.68, MAD = 4.45, range: [-3.00, 9.69], Skewness = -1.34, Kurtosis = -1.50, 0 missing
  - p: n = 3, Mean = 1.05e-03, SD = 1.82e-03, Median = 9.08e-10, MAD = 1.35e-09, range: [5.50e-17, 3.15e-03], Skewness = 1.73, Kurtosis =
-1.50, 0 missing

I generated above using report 0.5.7 and modelbased 0.8.6 with R version 4.3.1 on Windows 10.

@rempsyc
Copy link
Member

rempsyc commented Sep 13, 2024

This is what I get with a reprex:

packageVersion("report")
#> [1] '0.5.9'
packageVersion("modelbased")
#> [1] '0.8.8'
library(modelbased)
library(report)
model <- lm(Sepal.Width ~ Species, data = iris)
contr <- estimate_contrasts(model)
#> No variable was specified for contrast estimation. Selecting `contrast =
#>   "
#>   Species
#>   "`.
report(contr)
#> The marginal contrasts analysis suggests the following. The difference between
#> setosa and versicolor is positive and statistically significant (difference =
#> 0.66, 95% CI [ 0.49, 0.82], t(147) = 9.69, p < .001). The difference between
#> setosa and virginica is positive and statistically significant (difference =
#> 0.45, 95% CI [ 0.29, 0.62], t(147) = 6.68, p < .001). The difference between
#> versicolor and virginica is negative and statistically significant (difference
#> = -0.20, 95% CI [-0.37, -0.04], t(147) = -3.00, p = 0.003)

Created on 2024-09-13 with reprex v2.1.1

Can you try updating report to the latest version? I just checked in the link to the other discussion you linked and support for estimate_contrast in report was only officially added from version 0.5.8, so the results you had was the previous behaviour before support was added.

@rempsyc rempsyc added the waiting for response 💌 Need more information from people who submitted the issue label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for response 💌 Need more information from people who submitted the issue
Projects
None yet
Development

No branches or pull requests

3 participants