% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/analysis-t-test.R
\name{get_pairwise}
\alias{get_pairwise}
\title{All-Pairs Pairwise T-Tests for Survey Designs}
\usage{
get_pairwise(
  design,
  x,
  by,
  group = NULL,
  pval_adj = "holm",
  conf_level = 0.95,
  variance = "ci",
  na.rm = TRUE,
  min_cell_n = 30L,
  decimals = NULL,
  label_values = TRUE,
  label_vars = TRUE,
  name_style = "surveycore",
  ...,
  .id = NULL,
  .if_missing_var = NULL
)
}
\arguments{
\item{design}{A survey design object: \code{survey_taylor},
\code{survey_replicate}, \code{survey_twophase}, or \code{survey_nonprob}.}

\item{x}{<\code{\link[tidyselect:language]{tidy-select}}> A single unquoted
numeric variable name for the outcome variable.}

\item{by}{<\code{\link[tidyselect:language]{tidy-select}}> A single unquoted
variable name for the grouping variable. Must have at least 2 active
levels.}

\item{group}{<\code{\link[tidyselect:language]{tidy-select}}> Optional subgroup
variable(s). When supplied, pairwise comparisons are run within each
group stratum. P-value adjustment is applied separately per stratum.
Default \code{NULL}.}

\item{pval_adj}{Character(1). P-value adjustment method passed to
\code{\link[stats:p.adjust]{stats::p.adjust()}}. Default \code{"holm"}. Use \code{"none"} for unadjusted
p-values. Error: \code{surveycore_error_invalid_pval_adj}.}

\item{conf_level}{Numeric(1). Confidence level strictly in (0, 1).
Default \code{0.95}.}

\item{variance}{Character. Which uncertainty columns to include.
Valid values: \code{"se"}, \code{"ci"}. Default \code{"ci"}.}

\item{na.rm}{Logical(1). Accepted for API uniformity. Default \code{TRUE}.}

\item{min_cell_n}{Integer(1). Warn for small cells. Default \code{30L}.}

\item{decimals}{Integer(1) or \code{NULL}. Round all double output columns.
Default \code{NULL}.}

\item{label_values}{Logical(1). Convert \code{by}/\code{group} codes to value
labels. Default \code{TRUE}.}

\item{label_vars}{Logical(1). Accepted for API uniformity; no visible
effect. Default \code{TRUE}.}

\item{name_style}{Character(1). \code{"surveycore"} (default) or \code{"broom"}.}

\item{...}{Unused. Reserved so that \code{.id} and \code{.if_missing_var} remain
named-only when a \code{survey_collection} is passed as \code{design}.}

\item{.id}{Character(1) or \code{NULL}. Column name used to identify each
survey when \code{design} is a \code{\link{survey_collection}}. For collection inputs,
\code{NULL} (the default) resolves to the collection's stored \verb{@id} property.
Pass a non-\code{NULL} value to override. Ignored when \code{design} is a single
survey.}

\item{.if_missing_var}{\code{"error"}, \code{"skip"}, or \code{NULL}. How to handle
surveys in a collection that lack one of the requested NSE variables.
For collection inputs, \code{NULL} (the default) resolves to the collection's
stored \verb{@if_missing_var} property. Pass a non-\code{NULL} value to override.
Ignored when \code{design} is a single survey.}
}
\value{
A \code{survey_pairwise} tibble (also inheriting \code{survey_result}).
Columns: group columns (when active), \code{level_a}, \code{level_b},
\code{estimate}, \code{mean_a}, \code{mean_b}, \code{n_a}, \code{n_b}, \code{se} (optional),
\code{ci_low} (optional), \code{ci_high} (optional), \code{t_stat}, \code{df},
\code{p_value} (adjusted), \code{stars}. Use \code{\link[=meta]{meta()}} to access the
adjustment method and other metadata.
}
\description{
Runs all k(k-1)/2 pairwise two-sample t-tests for a grouping variable
with k levels and applies multiple-comparison p-value adjustment.
Delegates pair-level computations to \code{\link[=get_t_test]{get_t_test()}}.
}
\examples{
gss_sub <- gss_2024[gss_2024$sex \%in\% c(1L, 2L) & !is.na(gss_2024$age), ]
gss_sub$sex <- factor(gss_sub$sex, levels = c(1, 2), labels = c("Male", "Female"))
gss_design <- as_survey(gss_sub,
  ids = vpsu, weights = wtssps, strata = vstrat, nest = TRUE)
get_pairwise(gss_design, age, by = sex)

}
\seealso{
Other analysis: 
\code{\link{clean}()},
\code{\link{get_anova}()},
\code{\link{get_corr}()},
\code{\link{get_covariance}()},
\code{\link{get_diffs}()},
\code{\link{get_freqs}()},
\code{\link{get_means}()},
\code{\link{get_quantiles}()},
\code{\link{get_ratios}()},
\code{\link{get_t_test}()},
\code{\link{get_totals}()},
\code{\link{get_variance}()},
\code{\link{meta}()}
}
\concept{analysis}
