# WishartSpike: The Spiked Wishart Maximum Eigenvalue Distributions In RMTstat: Distributions, Statistics and Tests derived from Random Matrix Theory

## Description

Density, distribution function, quantile function, and random generation for the maximum eigenvalue from a spiked Wishart matrix (sample covariance matrix) with `ndf` degrees of freedom, `pdim` dimensions, and population covariance matrix `diag(spike+var,var,var,...,var)`.

## Usage

 ```1 2 3 4``` ```dWishartSpike(x, spike, ndf=NA, pdim=NA, var=1, beta=1, log = FALSE) pWishartSpike(q, spike, ndf=NA, pdim=NA, var=1, beta=1, lower.tail = TRUE, log.p = FALSE) qWishartSpike(p, spike, ndf=NA, pdim=NA, var=1, beta=1, lower.tail = TRUE, log.p = FALSE) rWishartSpike(n, spike, ndf=NA, pdim=NA, var=1, beta=1) ```

## Arguments

 `x,q` vector of quantiles. `p` vector of probabilities. `n` number of observations. If `length(n) > 1`, the length is taken to be the number required. `spike` the value of the spike. `ndf` the number of degrees of freedom for the Wishart matrix. `pdim` the number of dimensions (variables) for the Wishart matrix. `var` the population (noise) variance. `beta` the order parameter (1 or 2). `log, log.p` logical; if TRUE, probabilities p are given as log(p). `lower.tail` logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

## Details

The spiked Wishart is a random sample covariance matrix from multivariate normal data with `ndf` observations in `pdim` dimensions. The spiked Wishart has one population covariance eigenvalue equal to `spike+var` and the rest equal to `var`. These functions are related to the limiting distribution of the largest eigenvalue from such a matrix when `ndf` and `pdim` both tending to infinity, with their ratio tending to a nonzero constant.

For the spiked distribution to exist, `spike` must be greater than `sqrt(pdim/ndf)*var`.

Supported values for `beta` are `1` for real data and and `2` for complex data.

## Value

`dWishartSpike` gives the density, `pWishartSpike` gives the distribution function, `qWishartSpike` gives the quantile function, and `rWishartSpike` generates random deviates.

## Author(s)

Iain M. Johnstone, Zongming Ma, Patrick O. Perry and Morteza Shahram

## References

Baik, J., Ben Arous, G., and Péché, S. (2005). Phase transition of the largest eigenvalue for non-null complex sample covariance matrices. Annals of Probability 33, 1643–1697.

Baik, J. and Silverstein, J. W. (2006). Eigenvalues of large sample covariance matrices of spiked population models. Journal of Multivariate Analysis 97, 1382-1408.

Paul, D. (2007). Asymptotics of sample eigenstructure for a large dimensional spiked covariance model. Statistica Sinica. 17, 1617–1642.