get_scores_aov | R Documentation |
Evaluate the relationship between a numeric outcome and a categorical predictor,
or vice versa, by computing the ANOVA F-statistic or p-value.
Output a tibble result with with one row per predictor, and four columns:
name
, score
, predictor
, and outcome
.
get_scores_aov(score_obj, data, outcome)
score_obj |
A score object. See |
data |
A data frame or tibble containing the outcome and predictor variables. |
outcome |
A character string specifying the name of the outcome variable. |
The score_obj
object may include the following components:
neg_log10
A logical value indicating whether to apply a negative log10
transformation to p-values (default is TRUE
).
If TRUE
, p-values are transformed as -log10(pval)
. In this case:
The default fallback_value
is Inf
The default direction
is "maximize"
If FALSE
, raw p-values are used. In this case:
The fallback_value
should be set to 0
The direction
should be set to "minimize"
A tibble of result with one row per predictor, and four columns:
name
: the name of scoring metric.
score
: the score for the predictor-outcome pair.
predictor
: the name of the predictor.
outcome
: the name of the outcome.
data(ames, package = "modeldata")
data <- modeldata::ames |>
dplyr::select(
Sale_Price,
MS_SubClass,
MS_Zoning,
Lot_Frontage,
Lot_Area,
Street
)
# Define outcome
outcome <- "Sale_Price"
# Create a score object
score_obj <- score_aov()
score_res <- get_scores_aov(score_obj, data, outcome)
score_res
# Change score type
score_obj$score_type <- "pval"
score_res <- get_scores_aov(score_obj, data, outcome)
score_res
# Use raw p-values instead of -log10(p-values)
score_obj$score_type <- "pval"
score_obj$neg_log10 <- FALSE
score_obj$direction <- "minimize"
score_obj$fallback_value <- 0
score_res <- get_scores_aov(score_obj, data, outcome)
score_res
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.