Learn R Programming

EnTraineR (version 1.0.0)

trainer_var_test: Interpret an F test comparing two variances (var.test) with an audience-aware LLM prompt

Description

Builds a clear, audience-tailored prompt to interpret a base R stats::var.test() result.

Usage

trainer_var_test(
  vt_obj,
  introduction = NULL,
  alpha = 0.05,
  audience = c("beginner", "applied", "advanced"),
  summary_only = FALSE,
  llm_model = "llama3",
  generate = FALSE
)

Value

If generate = FALSE, a prompt string. If TRUE, a list with prompt, response, and model.

Arguments

vt_obj

An htest object returned by stats::var.test().

introduction

Optional character string giving the study context.

alpha

Numeric significance level (default 0.05).

audience

One of c("beginner","applied","advanced").

summary_only

Logical; if TRUE, return a 3-bullet executive summary regardless of audience depth (uses trainer_core_summary_only_block()).

llm_model

Character; model name for the generator (default "llama3").

generate

Logical; if TRUE, call the generator and return prompt + response.

Examples

Run this code
set.seed(1)
x <- rnorm(25, sd = 1.0); y <- rnorm(30, sd = 1.3)
vt <- var.test(x, y)
cat(trainer_var_test(vt, audience = "applied"))
cat(trainer_var_test(vt, audience = "advanced", summary_only = TRUE))

Run the code above in your browser using DataLab