tidy_lm_add_logical_significance
R/tidy_lm_add_logical_significance.R
tidy_lm_add_logical_significance.Rd
add a logical column of significance comparing p-values to alpha
tidy_lm_add_logical_significance(tidy_df, alpha = 0.05)
tidy_df | a |
---|---|
alpha | = 0.05 (default). can specify another alpha value or a vector |
logical column of significance (i.e., TRUE or FALSE) by comparing p
to the cut-off alpha. this column is added to a tidy
table of a lm
result
packages <- c("broom", "bootPermBroom", "dplyr") xfun::pkg_attach(packages, message = F, install = T) lm(salary ~ sex, carData::Salaries) %>% tidy() %>% tidy_lm_add_logical_significance(., c("0.01", "0.05"))#> # A tibble: 2 x 7 #> term estimate std.error statistic p.value sig_thr_0.01 sig_thr_0.05 #> <chr> <dbl> <dbl> <dbl> <dbl> <lgl> <lgl> #> 1 (Intercept) 101002. 4809. 21.0 2.68e-66 FALSE FALSE #> 2 sexMale 14088. 5065. 2.78 5.67e- 3 TRUE TRUE