% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stats_hotellingsT2.R
\name{ellipse2d}
\alias{ellipse2d}
\title{Calculate 2D Hotelling T^2 Ellipse}
\usage{
ellipse2d(obj, dims = c(1, 2), npoints = 100)
}
\arguments{
\item{obj}{A \code{list} as returned by \code{hotellingsT2()}.}

\item{dims}{Integer vector of length 2 specifying which dimensions to project
onto. Default is \code{c(1, 2)}.}

\item{npoints}{Integer. Number of points used to approximate the ellipse.
Default is 100.}
}
\value{
A \code{data.frame} with columns \code{x} and \code{y} containing
ellipse coordinates.
}
\description{
Generates coordinates of a two-dimensional ellipse corresponding
to a Hotelling T^2 region projected onto selected dimensions.
}
\details{
The ellipse is obtained by projecting the multivariate T^2 ellipsoid onto
the specified dimensions. The scaling is derived from the Hotelling T^2
statistic and accounts for sample size and dimensionality.
}
\examples{
set.seed(1)
X <- cbind(rnorm(100), rnorm(100) + 0.5)

t2 <- hotellingsT2(X)
ell <- ellipse2d(t2)

plot(X[,1], X[,2], asp = 1, pch = 16,
     xlab = "Score 1", ylab = "Score 2")
lines(ell$x, ell$y, col = "red", lwd = 2)
}
