get_scores_aov: Compute F-statistic and p-value scores using ANOVA F-test

get_scores_aovR Documentation

Compute F-statistic and p-value scores using ANOVA F-test

Description

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.

Usage

get_scores_aov(score_obj, data, outcome)

Arguments

score_obj

A score object. See score_aov() for details.

data

A data frame or tibble containing the outcome and predictor variables.

outcome

A character string specifying the name of the outcome variable.

Details

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"

Value

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.

Examples

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

filtro documentation built on Aug. 8, 2025, 6:23 p.m.