Learn R Programming

volker (version 3.2.0)

model_metrics_tab: Output a regression table with estimates and macro statistics for multiple categorical or metric independent variables

Description

The regression output comes from stats::lm. The effect sizes are calculated by heplots::etasq. The variance inflation is calculated by car::vif. The standardized beta (in the column standard beta) is calculated by multiplying the estimate with the ratio x_sd / y_sd where x_sd contains the standard deviation of the predictor values and y_sd the standard deviation of the predicted value.

[Experimental]

Usage

model_metrics_tab(
  data,
  col,
  categorical,
  metric,
  interactions = NULL,
  adjust = "fdr",
  labels = TRUE,
  clean = TRUE,
  ...
)

Value

A volker list object containing volker tables with the requested statistics.

Arguments

data

A tibble.

col

The target column holding metric values.

categorical

A tidy column selection holding independet categorical variables.

metric

A tidy column selection holding independent metric variables.

interactions

A vector of interaction effects to calculate. Each interaction effect should be provided as multiplication of the variables. Example: c(sd_gender * adopter).

adjust

Performing multiple significance tests inflates the alpha error. Thus, p values need to be adjusted according to the number of tests. Set a method supported by stats::p.adjust, e.g. "fdr" (the default) or "bonferroni". Disable adjustment with FALSE.

labels

If TRUE (default) extracts labels from the attributes, see codebook.

clean

Prepare data by data_clean.

...

Placeholder to allow calling the method with unused parameters from effect_metrics.

Examples

Run this code
library(volker)
data <- volker::chatgpt

data |>
  filter(sd_gender != "diverse") |>
  model_metrics_tab(use_work, categorical = c(sd_gender, adopter), metric = sd_age)

Run the code above in your browser using DataLab