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.
posthoc_factor_test() function allows for post-hoc
testing of a factor variable.
# Load needed packages library(riskclustr) library(dplyr) #> Warning: package 'dplyr' was built under R version 4.2.1
# 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
mypval <- posthoc_factor_test( fit = mod1, factor = "x4", nlevels = 4 )
The function returns both a formatted and unformatted p-value. The
formatted p-value can be accessed as
mypval$pval #> [,1] #> [1,] "<.001"
The unformatted p-value can be accessed as
mypval$pval_raw #> [,1] #> [1,] 0