mgc.sims.cubic: Cubic Simulation

Description Usage Arguments Value Details Author(s) Examples

View source: R/simulations.R

Description

A function for Generating a cubic simulation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
mgc.sims.cubic(
  n,
  d,
  eps = 80,
  ind = FALSE,
  a = -1,
  b = 1,
  c.coef = c(-12, 48, 128),
  s = 1/3
)

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 80.

ind

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

a

the lower limit for the range of the data matrix. Defaults to -1.

b

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

c.coef

the coefficients for the cubic function, where the first value is the first order coefficient, the second value the quadratic coefficient, and the third the cubic coefficient. Defaults to c(-12, 48, 128).

s

the scaling for the center of the cubic. Defaults to 1/3.

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] = 1/i is a weight-vector that scales with the dimensionality. Simulates n points from Linear(X, Y), where:

X ~ U(a, b)^d

Y = c[3](w^TX - s)^3 + c[2](w^TX - s)^2 + c[1](w^TX - s) + κ ε

and K = 1 if d=1, and 0 otherwise controls the noise for higher dimensions.

Author(s)

Eric Bridgeford

Examples

1
2
3
library(mgc)
result  <- mgc.sims.cubic(n=100, d=10)  # simulate 100 samples in 10 dimensions
X <- result$X; Y <- result$Y

mgc documentation built on July 1, 2020, 7:09 p.m.