After using eh_test_subtype()
to obtain a model fit, if
factor variables are involved in the analysis it will be of interest to
obtain overall p-values testing for differences across subtypes across
all levels of the factor variable.
The posthoc_factor_test()
function allows for post-hoc
testing of a factor variable.
# create a new example dataset that contains a factor variable
factor_data <-
subtype_data %>%
mutate(
x4 = cut(
x1,
breaks = c(-3.4, -0.4, 0.3, 1.1, 3.8),
include.lowest = T,
labels = c("1st quart",
"2nd quart",
"3rd quart",
"4th quart")
)
)
# Fit the model using x4 in place of x1
mod1 <- eh_test_subtype(
label = "subtype",
M = 4,
factors = list("x4", "x2", "x3"),
data = factor_data,
digits = 2
)
After we have the model fit, we can obtain the p-value testing all
levels of x4
simulaneously.
The function returns both a formatted and unformatted p-value. The
formatted p-value can be accessed as pval
:
The unformatted p-value can be accessed as pval_raw
: