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

Duplicated text in output of report()when used on a glmmTMB object #481

Open
yangsophieee opened this issue Feb 5, 2025 · 0 comments
Open

Comments

@yangsophieee
Copy link

Hi! I'm reporting on a bug where the output for report() produces duplicated text and two warnings when run on a glmmTMB object. See code below comparing a normal output for lm, and duplicated text in the output for glmmTMB.

library(glmmTMB)
library(report)

lm_fit <- lm(mpg ~ hp + wt, data = mtcars)
TMB_fit <- glmmTMB(mpg ~ hp + wt, data = mtcars)

report(lm_fit)
report(TMB_fit)

Output for lm object (expected)

r$> report(lm_fit)
We fitted a linear model (estimated using OLS) to predict mpg with hp and wt (formula: mpg ~ hp + wt). The model explains a statistically significant and substantial proportion of variance (R2 = 0.83, F(2, 29) = 69.21, p < .001,
adj. R2 = 0.81). The model's intercept, corresponding to hp = 0 and wt = 0, is at 37.23 (95% CI [33.96, 40.50], t(29) = 23.28, p < .001). Within this model:

  - The effect of hp is statistically significant and negative (beta = -0.03, 95% CI [-0.05, -0.01], t(29) = -3.52, p = 0.001; Std. beta = -0.36, 95% CI [-0.57, -0.15])
  - The effect of wt is statistically significant and negative (beta = -3.88, 95% CI [-5.17, -2.58], t(29) = -6.13, p < .001; Std. beta = -0.63, 95% CI [-0.84, -0.42])

Standardized parameters were obtained by fitting the model on a standardized version of the dataset. 95% Confidence Intervals (CIs) and p-values were computed using a Wald t-distribution approximation.

Output for glmmTMB object (actual)

We fitted a linear model (estimated using ML and nlminb optimizer) to predict mpg with hp and wt (formula: mpg ~ hp + wt). The model's explanatory power is substantial (R2 = 0.83, adj. R2 = 0.81). The model's intercept,
corresponding to hp = 0 and wt = 0, is at 37.23 (95% CI [34.24, 40.21], p < .001). Within this model:

  - The effect of wt is statistically significant and negative (beta = -0.03, 95% CI [-0.05, -0.01], p < .001; Std. beta = -0.63, 95% CI [-0.82, -0.44])
  - The intercept is statistically significant and negative (beta = -3.88, 95% CI [-5.06, -2.70], p < .001; Std. beta = -4.82e-08, 95% CI [-0.14, 0.14])

Standardized parameters were obtained by fitting the model on a standardized version of the dataset. 95% Confidence Intervals (CIs) and p-values were computed using a Wald z-distribution approximation. and We fitted a linear model
(estimated using ML and nlminb optimizer) to predict mpg with hp and wt (formula: mpg ~ hp + wt). The model's explanatory power is substantial (R2 = 0.83, adj. R2 = 0.81). The model's intercept, corresponding to hp = 0 and wt = 0,
is at 2.47 (95% CI [1.93, 3.15]). Within this model:

  - The effect of wt is statistically significant and negative (beta = -0.03, 95% CI [-0.05, -0.01], p < .001; Std. beta = -0.63, 95% CI [-0.82, -0.44])
  - The intercept is statistically significant and negative (beta = -3.88, 95% CI [-5.06, -2.70], p < .001; Std. beta = -4.82e-08, 95% CI [-0.14, 0.14])

Standardized parameters were obtained by fitting the model on a standardized version of the dataset. 95% Confidence Intervals (CIs) and p-values were computed using a Wald z-distribution approximation.
Warning messages:
1: In text == "" | text2 == "" :
  longer object length is not a multiple of shorter object length
2: In text == "" | text2 == "" :
  longer object length is not a multiple of shorter object length

The start of the duplicated text appears to begin on this line:

"Standardized parameters were obtained by fitting the model on a standardized version of the dataset. 95% Confidence Intervals (CIs) and p-values were computed using a Wald z-distribution approximation. and We fitted a linear model..."

It seems like the warning messages might be related:

Warning messages:
1: In text == "" | text2 == "" :
  longer object length is not a multiple of shorter object length

Specifications
I'm using R 4.4.1, version 0.6.0 for {report} and version 1.1.10 for {glmmTMB}.

Thank you so much! ☺️

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

No branches or pull requests

1 participant