Converts a survey_glm_fit object into a survey_glm_tidy result tibble
with one row per model coefficient (plus optional reference rows for factor
predictors), design-based standard errors, confidence intervals, and
structured metadata.
Usage
clean(
model,
conf_level = 0.95,
include_reference = TRUE,
n = FALSE,
statistic = TRUE,
exponentiate = FALSE,
interaction_sep = " * ",
...
)Arguments
- model
A
survey_glm_fitobject fromsurvey_glm().- conf_level
Numeric scalar in
(0, 1). Confidence level for confidence intervals. Default0.95.- include_reference
Logical. If
TRUE, reference levels for unordered factor predictors appear as rows withestimate = NAandreference_row = TRUE. DefaultTRUE.- n
Logical. If
TRUE, adds ann_obscolumn with the unweighted observation count per term. DefaultFALSE.- statistic
Logical. If
TRUE(default), includes thestatistic(t-statistic) column. Set toFALSEto drop it.- exponentiate
Logical. If
TRUE, exponentiatesestimate,conf_low, andconf_high.std_erroris left on the log scale (matchingbroomconvention). Firessurveycore_warning_exponentiate_nonlogwhen the model link is not log-based. DefaultFALSE.- interaction_sep
Character scalar. Separator for interaction term labels. Default
" * ".- ...
Currently unused.
Value
A survey_glm_tidy object: a tibble with S3 class
c("survey_glm_tidy", "survey_result", "tbl_df", "tbl", "data.frame").
Metadata is accessed via meta().
See also
survey_glm() to fit the model, meta() to access metadata.
Other analysis:
get_corr(),
get_diffs(),
get_freqs(),
get_means(),
get_quantiles(),
get_ratios(),
get_totals(),
meta()
Examples
d <- as_survey(gss_2024, ids = vpsu, weights = wtssps,
strata = vstrat, nest = TRUE)
fit <- survey_glm(d, age ~ sex)
clean(fit)
#> # A tibble: 2 × 11
#> term variable var_label label reference_row estimate std_error statistic
#> * <chr> <chr> <chr> <chr> <lgl> <dbl> <dbl> <dbl>
#> 1 (Intercep… (Interc… NA (Int… FALSE 47.6 1.54 30.8
#> 2 sex sex responde… resp… FALSE 0.260 0.957 0.271
#> # ℹ 3 more variables: p_value <dbl>, conf_low <dbl>, conf_high <dbl>
clean(fit, conf_level = 0.99, exponentiate = FALSE)
#> # A tibble: 2 × 11
#> term variable var_label label reference_row estimate std_error statistic
#> * <chr> <chr> <chr> <chr> <lgl> <dbl> <dbl> <dbl>
#> 1 (Intercep… (Interc… NA (Int… FALSE 47.6 1.54 30.8
#> 2 sex sex responde… resp… FALSE 0.260 0.957 0.271
#> # ℹ 3 more variables: p_value <dbl>, conf_low <dbl>, conf_high <dbl>
