% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/23_Chatterjee.R
\name{xi_stable}
\alias{xi_stable}
\title{Bootstrap-averaged Chatterjee's xi}
\usage{
xi_stable(x, y, B = 1000, seed = NULL)
}
\arguments{
\item{x}{Numeric or ordered factor (predictor)}

\item{y}{Numeric or ordered factor (response)}

\item{B}{Number of bootstrap replications. Default 1000.}

\item{seed}{Optional integer seed for reproducibility.}
}
\value{
A list with elements:
\describe{
\item{xi}{Mean of the B Chatterjee xi values.}
\item{sd}{Standard deviation of the B values (tie-breaking spread).}
\item{se}{Standard error of the mean (sd / sqrt(B)).}
\item{B}{Number of bootstrap replications used.}
}
}
\description{
Computes Chatterjee's xi B times with random tie-breaking and returns
the average. This stabilizes the estimate against tie-breaking
variability, which is important for ordinal data with many ties (e.g.,
Likert-scale items).
}
\details{
For each of the B replications, ties in x are broken randomly via
\code{rank(x, ties.method = "random")} inside \code{chatterjee_xi()}.
The standard error of the mean shrinks as 1 / sqrt(B); B = 1000 typically
yields SE around 0.001 for moderately tied data.
}
\examples{
\donttest{
x <- rnorm(100)
y <- x^2 + rnorm(100, sd = 0.1)
xi_stable(x, y, B = 500, seed = 42)
}
}
\references{
Chatterjee, S. (2021). A new coefficient of correlation. Journal of
the American Statistical Association, 116(536), 2009-2022.
}
