File tree Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Expand file tree Collapse file tree 3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -887,9 +887,14 @@ format.parameters_sem <- function(x,
887887 logit_model <- isTRUE(.additional_arguments(x , " logit_link" , FALSE )) ||
888888 isTRUE(attributes(x )$ coefficient_name %in% c(" Log-Odds" , " Odds Ratio" ))
889889
890+ # remove NA and infinite values from spurios coefficients
891+ if (! is.null(spurious_coefficients )) {
892+ spurious_coefficients <- spurious_coefficients [! is.na(spurious_coefficients ) & ! is.infinite(spurious_coefficients )] # nolint
893+ }
894+
890895 # check for complete separation coefficients or possible issues with
891896 # too few data points
892- if (! is.null(spurious_coefficients ) && logit_model ) {
897+ if (! is.null(spurious_coefficients ) && length( spurious_coefficients ) && logit_model ) {
893898 if (any(spurious_coefficients > 50 )) {
894899 msg <- c(msg , " Some coefficients are very large, which may indicate issues with complete separation." ) # nolint
895900 } else if (any(spurious_coefficients > 15 )) {
Original file line number Diff line number Diff line change 7777 Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
7878 using a Wald z-distribution approximation.
7979
80+ ---
81+
82+ Code
83+ print(model_parameters(m))
84+ Output
85+ # Fixed Effects
86+
87+ Parameter | Log-Odds | SE | 95% CI | z | df | p
88+ ---------------------------------------------------------------------
89+ (Intercept) | -0.20 | 0.50 | [-1.18, 0.79] | -0.39 | 29.98 | 0.695
90+
91+ # Smooth Terms
92+
93+ Parameter | z | df | p
94+ ---------------------------------------
95+ Smooth term (mpg) | 7.24 | 1.02 | 0.007
96+ Message
97+
98+ The model has a log- or logit-link. Consider using `exponentiate =
99+ TRUE` to interpret coefficients as ratios.
100+
80101# adding model summaries
81102
82103 Code
Original file line number Diff line number Diff line change @@ -118,3 +118,9 @@ withr::with_options(
118118 expect_snapshot(print(out ))
119119 })
120120)
121+
122+ test_that(" print model with multiple components" , {
123+ skip_if_not_installed(" mgcv" )
124+ m <- mgcv :: gam(vs ~ s(mpg ), data = mtcars , family = " binomial" )
125+ expect_snapshot(print(model_parameters(m )))
126+ })
You can’t perform that action at this time.
0 commit comments