Learn R Programming

mgc (version 2.0.2)

mgc.sims.wshape: W Shaped Simulation

Description

A function for Generating a W-shaped simulation.

Usage

mgc.sims.wshape(n, d, eps = 0.5, ind = FALSE, a = -1, b = 1)

Arguments

n

the number of samples for the simulation.

d

the number of dimensions for the simulation setting.

eps

the noise level for the simulation. Defaults to 0.5.

ind

whether to sample x and y independently. Defaults to FALSE.

a

the lower limit for the data matrix. Defaults -1.

b

the upper limit for the data matrix. Defaults to 1.

Value

a list containing the following:

X

[n, d] the data matrix with n samples in d dimensions.

Y

[n] the response array.

Details

Given: \(w_i = \frac{1}{i}\) is a weight-vector that scales with the dimensionality. Simumlates \(n\) points from \(W-shape(X, Y) \in \mathbf{R}^d \times \mathbf{R}\) where: $$U \sim {U}(a, b)^d$$, $$X \sim {U}(a, b)^d$$, $$Y = \left[\left((w^TX)^2 - \frac{1}{2}\right)^2 + \frac{w^TU}{500}\right] + \kappa \epsilon N(0, 1)$$ and \(\kappa = 1\textrm{ if }d = 1, \textrm{ and 0 otherwise}\) controls the noise for higher dimensions.

For more details see the help vignette: vignette("sims", package = "mgc")

Examples

Run this code
# NOT RUN {
library(mgc)
result  <- mgc.sims.wshape(n=100, d=10)  # simulate 100 samples in 10 dimensions
X <- result$X; Y <- result$Y
# }

Run the code above in your browser using DataLab