% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/load_data_external.R
\name{load_sample_size_data}
\alias{load_sample_size_data}
\title{Access sample size simulation data}
\usage{
load_sample_size_data()
}
\value{
A named list with the following elements:
\itemize{
\item \code{description}: Short description of the dataset
\item \code{version}: GitHub release tag of the dataset (e.g., \code{"v0.1.0-data"})
\item \code{created}: Date the dataset was created (as character string)
\item \code{n_rep}: Number of simulation iterations per condition
\item \code{data}: A data frame with simulation results (see \strong{Data Structure})
}
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#experimental}{\figure{lifecycle-experimental.svg}{options: alt='[Experimental]'}}}{\strong{[Experimental]}}

Loads pre-computed simulation results for SPRT sample size planning.
If not already cached locally, the data (~150 MB) will be downloaded automatically
from GitHub releases. Use this function to access the complete dataset for custom
analysis and visualization. See the \strong{Data Structure} section below for details
on available columns.

Data is hosted at:
\href{https://github.com/MeikeSteinhilber/sprtt_plan_sample_size}{MeikeSteinhilber/sprtt_plan_sample_size}
}
\section{Data Structure}{

The \code{data} element contains simulation results with the following columns:

\strong{Simulation Metadata:}
\itemize{
\item \code{batch}: Batch identifier for the simulation run
\item \code{iteration}: Individual simulation iteration within a batch
\item \code{source_file}: Path to the file containing simulation parameters or results
}

\strong{Input Parameters:}
\itemize{
\item \code{f_simulated}: The true effect size used to generate the simulated data
\item \code{f_expected}: The expected effect size specified for the SPRT
\item \code{k_groups}: Number of groups in the design
\item \code{alpha}: Significance level (Type I error rate)
\item \code{power}: Desired statistical power (1 - Type II error rate)
\item \code{distribution}: Data distribution used for simulation
\item \code{sd}: Standard deviation(s) used in data generation in each group
\item \code{sample_ratio}: Ratio of sample sizes between groups (e.g., 1:1, 2:1)
\item \code{n_raw_data}: Total number of raw observations generated in each group
\item \code{fix_n}: Fixed sample size
}

\strong{Individual Test Results:}
\itemize{
\item \code{n}: Actual sample size at which the SPRT terminated
\item \code{decision}: Test decision
\item \code{decision_error}: Whether the decision was erroneous (Type I or Type II error)
\item \code{log_lr}: Log-likelihood ratio at termination
\item \code{f}: Calculated effect size from the data
\item \code{f_adj}: Adjusted effect size
\item \code{f_statistic}: F-statistic from ANOVA test
}

\strong{Summary Statistics (Aggregated across iterations):}
\itemize{
\item \code{decision_error_rate}: Proportion of incorrect decisions
\item \code{mean_n}: Mean sample size across all iterations
\item \code{sd_error_n}: Standard error of the mean sample size (sd(n)/sqrt(n))
\item \code{median_n}: Median sample size (50th percentile)
\item \code{min_n}, \code{max_n}: Minimum and maximum sample sizes observed
\item \code{q25_n}, \code{q50_n}, \code{q75_n}, \code{q90_n}, \code{q95_n}: Sample size quantiles
\item \code{decision_rate_25}, \code{decision_rate_50}, \code{decision_rate_75},
\code{decision_rate_90}, \code{decision_rate_95}, \code{decision_rate_100}:
Cumulative decision rates at various percentages of maximum sample size
}
}

\examples{
\dontrun{
# Load data (downloads automatically if needed)
loaded <- load_sample_size_data()

# Access the simulation data frame
head(loaded$data)

# Check dataset version
loaded$version  # e.g. "v0.1.0-data"
loaded$created
}
}
