Simulations

Independence Simulations

hyppo.sims.linear(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate linear data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Linear \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\):

\[\begin{split}X &\sim \mathcal{U}(-1, 1)^p \\ Y &= w^T X + \kappa \epsilon\end{split}\]

Examples

>>> from hyppo.sims import linear
>>> x, y = linear(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.exponential(n, p, noise=False, low=0, high=3)[source]

Simulates univariate or multivariate exponential data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: 0)

The lower limit of the uniform distribution simulated from.

high : float, (default: 3)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Exponential \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\):

\[\begin{split}X &\sim \mathcal{U}(0, 3)^p \\ Y &= \exp (w^T X) + 10 \kappa \epsilon\end{split}\]

Examples

>>> from hyppo.sims import exponential
>>> x, y = exponential(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.cubic(n, p, noise=False, low=-1, high=1, cubs=[-12, 48, 128], scale=0.3333333333333333)[source]

Simulates univariate or multivariate cubic data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

cubs : list of ints (default: [-12, 48, 128])

Coefficients of the cubic function where each value corresponds to the order of the cubic polynomial.

scale : float (default: 1/3)

Scaling center of the cubic.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Cubic \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\):

\[\begin{split}X &\sim \mathcal{U}(-1, 1)^p \\ Y &= 128 \left( w^T X - \frac{1}{3} \right)^3 + 48 \left( w^T X - \frac{1}{3} \right)^2 - 12 \left( w^T X - \frac{1}{3} \right) + 80 \kappa \epsilon\end{split}\]

Examples

>>> from hyppo.sims import cubic
>>> x, y = cubic(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.joint_normal(n, p, noise=False)[source]

Simulates univariate or multivariate joint-normal data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Joint Normal \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): Let \(\rho = \frac{1}{2} p\), \(I_p\) be the identity matrix of size \(p \times p\), \(J_p\) be the matrix of ones of size \(p \times p\) and \(\Sigma = \begin{bmatrix} I_p & \rho J_p \\ \rho J_p & (1 + 0.5\kappa) I_p \end{bmatrix}\). Then,

\[(X, Y) \sim \mathcal{N}(0, \Sigma)\]

Examples

>>> from hyppo.sims import joint_normal
>>> x, y = joint_normal(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.step(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate step data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Step \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\):

\[\begin{split}X &\sim \mathcal{U}(-1, 1)^p \\ Y &= \mathbb{1}_{w^T X > 0} + \epsilon\end{split}\]

where \(\mathbb{1}\) is the indicator function.

Examples

>>> from hyppo.sims import step
>>> x, y = step(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.quadratic(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate quadratic data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Quadratic \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\):

\[\begin{split}X &\sim \mathcal{U}(-1, 1)^p \\ Y &= (w^T X)^2 + 0.5 \kappa \epsilon\end{split}\]

Examples

>>> from hyppo.sims import quadratic
>>> x, y = quadratic(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.w_shaped(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate quadratic data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

W-Shaped \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\): \(\mathcal{U}(-1, 1)^p\),

\[\begin{split}X &\sim \mathcal{U}(-1, 1)^p \\ Y &= \left[ \left( (w^T X)^2 - \frac{1}{2} \right)^2 + \frac{w^T U}{500} \right] + 0.5 \kappa \epsilon\end{split}\]

Examples

>>> from hyppo.sims import w_shaped
>>> x, y = w_shaped(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.spiral(n, p, noise=False, low=0, high=5)[source]

Simulates univariate or multivariate spiral data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: 0)

The lower limit of the uniform distribution simulated from.

high : float, (default: 5)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Spiral \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\): \(U \sim \mathcal{U}(0, 5)\), \(\epsilon \sim \mathcal{N}(0, 1)\)

\[\begin{split}X_{|d|} &= U \sin(\pi U) \cos^d(\pi U)\ \mathrm{for}\ d = 1,...,p-1 \\ X_{|p|} &= U \cos^p(\pi U) \\ Y &= U \sin(\pi U) + 0.4 p \epsilon\end{split}\]

Examples

>>> from hyppo.sims import spiral
>>> x, y = spiral(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.uncorrelated_bernoulli(n, p, noise=False, prob=0.5)[source]

Simulates univariate or multivariate uncorrelated Bernoulli data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

prob : float, (default: 0.5)

The probability of the bernoulli distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Uncorrelated Bernoulli \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\): \(U \sim \mathcal{B}(0.5)\), \(\epsilon_1 \sim \mathcal{N}(0, I_p)\), \(\epsilon_2 \sim \mathcal{N}(0, 1)\),

\[\begin{split}X &= \mathcal{B}(0.5)^p + 0.5 \epsilon_1 \\ Y &= (2U - 1) w^T X + 0.5 \epsilon_2\end{split}\]

Examples

>>> from hyppo.sims import uncorrelated_bernoulli
>>> x, y = uncorrelated_bernoulli(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.logarithmic(n, p, noise=False)[source]

Simulates univariate or multivariate logarithmic data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Logarithmic \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(\epsilon \sim \mathcal{N}(0, I_p)\),

\[\begin{split}X &\sim \mathcal{N}(0, I_p) \\ Y_{|d|} &= 2 \log_2 (|X_{|d|}|) + 3 \kappa \epsilon_{|d|} \ \mathrm{for}\ d = 1, ..., p\end{split}\]

Examples

>>> from hyppo.sims import logarithmic
>>> x, y = logarithmic(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.fourth_root(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate fourth root data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Fourth Root \((X, Y) \in \mathbb{R}^p \times \mathbb{R}\):

\[\begin{split}X &\sim \mathcal{U}(-1, 1)^p \\ Y &= |w^T X|^\frac{1}{4} + \frac{\kappa}{4} \epsilon\end{split}\]

Examples

>>> from hyppo.sims import fourth_root
>>> x, y = fourth_root(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 1)
hyppo.sims.sin_four_pi(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate sine 4 \(\pi\) data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Sine 4:math:pi \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(U \sim \mathcal{U}(-1, 1)\), \(V \sim \mathcal{N}(0, 1)^p\), \(\theta = 4 \pi\),

\[\begin{split}X_{|d|} &= U + 0.02 p V_{|d|}\ \mathrm{for}\ d = 1, ..., p \\ Y &= \sin (\theta X) + \kappa \epsilon\end{split}\]

Examples

>>> from hyppo.sims import sin_four_pi
>>> x, y = sin_four_pi(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.sin_sixteen_pi(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate sine 16 \(\pi\) data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Sine 16:math:pi \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(U \sim \mathcal{U}(-1, 1)\), \(V \sim \mathcal{N}(0, 1)^p\), \(\theta = 16 \pi\),

\[\begin{split}X_{|d|} &= U + 0.02 p V_{|d|}\ \mathrm{for}\ d = 1, ..., p \\ Y &= \sin (\theta X) + \kappa \epsilon\end{split}\]

Examples

>>> from hyppo.sims import sin_sixteen_pi
>>> x, y = sin_sixteen_pi(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.square(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate square data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Square \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(U \sim \mathcal{U}(-1, 1)\), \(V \sim \mathcal{N}(0, 1)^p\), \(\theta = -\frac{\pi}{8}\),

\[\begin{split}X_{|d|} &= U \cos(\theta) + V \sin(\theta) + 0.05 p \epsilon_{|d|}\ \mathrm{for}\ d = 1, ..., p \\ Y_{|d|} &= -U \sin(\theta) + V \cos(\theta)\end{split}\]

Examples

>>> from hyppo.sims import square
>>> x, y = square(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.two_parabolas(n, p, noise=False, low=-1, high=1, prob=0.5)[source]

Simulates univariate or multivariate two parabolas data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

prob : float, (default: 0.5)

The probability of the bernoulli distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, 1) where n is the number of samples and p is the number of dimensions.

Notes

Two Parabolas \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\):

\[\begin{split}X &\sim \mathcal{U}(-1, 1)^p \\ Y &= ((w^T X)^2 + 2 \kappa \epsilon) \times \left( U = \frac{1}{2} \right)\end{split}\]

Examples

>>> from hyppo.sims import two_parabolas
>>> x, y = two_parabolas(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.circle(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate circle data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Circle \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(U \sim \mathcal{U}(-1, 1)^p\), \(\epsilon \sim \mathcal{N}(0, I_p)\), \(r = 1\),

\[\begin{split}X_{|d|} &= r \left( \sin(\pi U_{|d+1|}) \prod_{j=1}^d \cos(\pi U_{|j|}) + 0.4 \epsilon_{|d|} \right)\ \mathrm{for}\ d = 1, ..., p-1 \\ X_{|d|} &= r \left( \prod_{j=1}^p \cos(\pi U_{|j|}) + 0.4 \epsilon_{|p|} \right) \\ Y_{|d|} &= \sin(\pi U_{|1|})\end{split}\]

Examples

>>> from hyppo.sims import circle
>>> x, y = circle(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.ellipse(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate ellipse data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Ellipse \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(U \sim \mathcal{U}(-1, 1)^p\), \(\epsilon \sim \mathcal{N}(0, I_p)\), \(r = 5\),

\[\begin{split}X_{|d|} &= r \left( \sin(\pi U_{|d+1|}) \prod_{j=1}^d \cos(\pi U_{|j|}) + 0.4 \epsilon_{|d|} \right)\ \mathrm{for}\ d = 1, ..., p-1 \\ X_{|d|} &= r \left( \prod_{j=1}^p \cos(\pi U_{|j|}) + 0.4 \epsilon_{|p|} \right) \\ Y_{|d|} &= \sin(\pi U_{|1|})\end{split}\]

Examples

>>> from hyppo.sims import ellipse
>>> x, y = ellipse(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.diamond(n, p, noise=False, low=-1, high=1)[source]

Simulates univariate or multivariate diamond data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

low : float, (default: -1)

The lower limit of the uniform distribution simulated from.

high : float, (default: -1)

The upper limit of the uniform distribution simulated from.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Diamond \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(U \sim \mathcal{U}(-1, 1)\), \(V \sim \mathcal{N}(0, 1)^p\), \(\theta = -\frac{\pi}{4}\),

\[\begin{split}X_{|d|} &= U \cos(\theta) + V \sin(\theta) + 0.05 p \epsilon_{|d|}\ \mathrm{for}\ d = 1, ..., p \\ Y_{|d|} &= -U \sin(\theta) + V \cos(\theta)\end{split}\]

Examples

>>> from hyppo.sims import diamond
>>> x, y = diamond(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.multiplicative_noise(n, p)[source]

Simulates univariate or multivariate multiplicative noise data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Multiplicative Noise \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(\U \sim \mathcal{N}(0, I_p)\),

\[\begin{split}X &\sim \mathcal{N}(0, I_p) \\ Y_{|d|} &= U_{|d|} X_{|d|}\ \mathrm{for}\ d = 1, ..., p\end{split}\]

Examples

>>> from hyppo.sims import multiplicative_noise
>>> x, y = multiplicative_noise(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.multimodal_independence(n, p, prob=0.5, sep1=3, sep2=2)[source]

Simulates univariate or multimodal independence data.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

prob : float, (default: 0.5)

The probability of the bernoulli distribution simulated from.

sep1, sep2: float, (default: 3, 2)

The separation between clusters of normally distributed data.

Returns:
x, y : ndarray

Simulated data matrices. x and y have shapes (n, p) and (n, p) where n is the number of samples and p is the number of dimensions.

Notes

Multimodal Independence \((X, Y) \in \mathbb{R}^p \times \mathbb{R}^p\): \(U \sim \mathcal{N}(0, I_p)\), \(V \sim \mathcal{N}(0, I_p)\), \(U^\prime \sim \mathcal{B}(0.5)^p\), \(V^\prime \sim \mathcal{B}(0.5)^p\),

\[\begin{split}X &= \frac{U}{3} + 2 U^\prime - 1 \\ Y &= \frac{V}{3} + 2 V^\prime - 1\end{split}\]

Examples

>>> from hyppo.sims import multimodal_independence
>>> x, y = multimodal_independence(100, 2)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)

K-Sample Simulations

hyppo.sims.rot_2samp(sim, n, p, noise=True, degree=90)[source]

Rotates input simulations to produce a 2-sample simulation.

Parameters:
sim : callable()

The simulation (from the hyppo.sims module) that is to be rotated.

n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: True)

Whether or not to include noise in the simulation.

degree : float, (default: 90)

The number of degrees to rotate the input simulation by (in first dimension).

Returns:
samp1, samp2 : ndarray

Rotated data matrices. samp1 and samp2 have shapes (n, p+1) and (n, p+1) or (n, 2p) and (n, 2p) depending on the independence simulation. Here, n is the number of samples and p is the number of dimensions.

Examples

>>> from hyppo.sims import rot_2samp, linear
>>> x, y = rot_2samp(linear, 100, 1)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.trans_2samp(sim, n, p, noise=True, degree=90, trans=0.3)[source]

Translates and rotates input simulations to produce a 2-sample simulation.

Parameters:
n : int

The number of samples desired by the simulation.

p : int

The number of dimensions desired by the simulation.

noise : bool, (default: False)

Whether or not to include noise in the simulation.

degree : float, (default: 90)

The number of degrees to rotate the input simulation by (in first dimension).

trans : float, (default: 0.3)

The amount to translate the second simulation by (in first dimension).

Returns:
samp1, samp2 : ndarray

Translated/rotated data matrices. samp1 and samp2 have shapes (n, p+1) and (n, p+1) or (n, 2p) and (n, 2p) depending on the independence simulation. Here, n is the number of samples and p is the number of dimensions.

Examples

>>> from hyppo.sims import trans_2samp, linear
>>> x, y = trans_2samp(linear, 100, 1)
>>> print(x.shape, y.shape)
(100, 2) (100, 2)
hyppo.sims.gaussian_3samp(n, epsilon=1, weight=0, case=1)[source]

Generates 3 sample of gaussians corresponding to 5 cases.

Parameters:
n : int

The number of samples desired by the simulation.

epsilon : float, (default: 1)

The amount to translate simulation by (amount depends on case).

weight : float, (default: False)

Number between 0 and 1 corresponding to weight of the second Gaussian (used in case 4 and 5 to produce a mixture of Gaussians)

case : {1, 2, 3, 4, 5}, (default: 1)

The case in which to evaluate statistical power for each test.

Returns:
sims : list of ndarray

List of 3 2-dimensional multivariate Gaussian each corresponding to the desired case.

Examples

>>> from hyppo.sims import gaussian_3samp
>>> sims = gaussian_3samp(100)
>>> print(sims[0].shape, sims[1].shape, sims[2].shape)
(100, 2) (100, 2) (100, 2)