stargaze doesnt print all statistics

Hi,

I want to compare two nested models in stargaze. There is a way to do so by using keep.stats.

Example:


# Set the seed for reproducibility
set.seed(123)

# Generate data
Modelling_fw_data <- data.frame(
  x1 = runif(100, min = 1, max = 10),
  x2 = runif(100, min = 1, max = 10),
  x3 = runif(100, min = 1, max = 10),
  x4 = runif(100, min = 1, max = 10),
  y = runif(100, min = 1, max = 10)
)

GLM_modelling_fw_example1 <- glm(
    y ~ log(x1)   
    ,data  = Modelling_fw_data ,family  = inverse.gaussian(link = "log") ,weights = x4)

GLM_modelling_fw_example2 <- glm(
    y ~ log(x1) + x2 + x3  ,data    = Modelling_fw_data ,family  = inverse.gaussian(link = "log")  ,weights = x4)


stargazer(GLM_modelling_fw_example1 ,GLM_modelling_fw_example2 
              ,keep.stat = c('all')
              ,title='CM & RM model summary'
              ,model.names = FALSE
              ,column.labels=c('CM', 'RM')
              ,align=TRUE
              ,type = "html")
    

The above stargazer prints non of the statistics. Does anyone know why is that?

Thanks

I'm not sure, but here's an alternative

library(broom)
set.seed(123)

Modelling_fw_data <- data.frame(
  x1 = runif(100, min = 1, max = 10),
  x2 = runif(100, min = 1, max = 10),
  x3 = runif(100, min = 1, max = 10),
  x4 = runif(100, min = 1, max = 10),
  y = runif(100, min = 1, max = 10)
)

example1 <- glm(
  y ~ log(x1),
  data = Modelling_fw_data, family = inverse.gaussian(link = "log"), weights = x4
)

example2 <- glm(
  y ~ log(x1) + x2 + x3,
  data = Modelling_fw_data, family = inverse.gaussian(link = "log"), weights = x4
)

tidy(example1)
#> # A tibble: 2 × 5
#>   term        estimate std.error statistic  p.value
#>   <chr>          <dbl>     <dbl>     <dbl>    <dbl>
#> 1 (Intercept)    2.00     0.150      13.3  1.07e-23
#> 2 log(x1)       -0.182    0.0889     -2.05 4.33e- 2
tidy(example2)
#> # A tibble: 4 × 5
#>   term        estimate std.error statistic  p.value
#>   <chr>          <dbl>     <dbl>     <dbl>    <dbl>
#> 1 (Intercept)   2.09      0.239      8.74  7.68e-14
#> 2 log(x1)      -0.204     0.0915    -2.23  2.84e- 2
#> 3 x2            0.0187    0.0214     0.876 3.83e- 1
#> 4 x3           -0.0295    0.0185    -1.60  1.13e- 1

Created on 2023-01-09 with reprex v2.0.2