simulation.generation.data: Generate simulation data

Description Usage Arguments Value Details Author(s) Examples

View source: R/datagenertor.R

Description

This function generates data for the simulation studies. This function is extremely adaptive and allows for many different data set ups. The function offers variability on: dimension of the data.frame, user-defined coefficient vector, 2 types of correlation matrixs, different correlation levels, varation of the model error sigma and the option to split the data.frame into a training and a testing set.

Usage

1
2
simulation.generation.data(n = n, coeff = coeff, matrix.option = 1,
  collinear = collinear, sig = sig, split.prop = 0.8, option = 1)

Arguments

n

The number of rows in the data.frame

coeff

A vector a true coefficients

matrix.option

1: Using an Exchangeable correlation matrix to simulate the predictors
2: Using an Autoregressive correlation matrix to simulate the predictors

collinear

The correlation levels within the matrix.option

sig

The model inherent error, the σ^2

split.prop

An element specifying the training proportion. Note the testing proportion will be 1 - the training proportion.

option

1: split the dataset according to c(split.prop, 1 - split.prop)
2: Use the whole dataset. Note When option = 2, the split.prop will be ignored

Value

A list of elements:

ytrain

return ONLY when option = 1, this is the training proportion for y

xtrain

return ONLY when option = 1, this is the training set for the predictors

ytest

return ONLY when option = 1, this is the testing proportion for y

xtest

return ONLY when option = 1, this is the testing proportion for the predictors

resample.data

return ONLY when option = 2, this is the whole dataset

Details

This is the data generating function for the simulation functions: simulation.collinear and simulation.adlasso

Author(s)

Mokyo Zhou

Examples

1
2
3
4
5
#100 observations, true coefficient vector is c(1,2,3,4), using the exchangeable correlation matrix,
#correlation level within the exchangeable matrix is 0.3, model sigma is 2, splitting
#the dataset into 0.8/0.2.
result <- simulation.generation.data(n = 100, coeff = c(1,2,3,4), matrix.option = 1,
collinear = 0.3, sig = 2,split.prop = 0.8, option = 1)

MokyoZhou/lassoenet documentation built on May 20, 2019, 11:38 a.m.