Description Usage Arguments Value Details Author(s) Examples
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.
1 2 | simulation.generation.data(n = n, coeff = coeff, matrix.option = 1,
collinear = collinear, sig = sig, split.prop = 0.8, option = 1)
|
n |
The number of rows in the |
coeff |
A vector a true coefficients |
matrix.option |
1: Using an Exchangeable correlation matrix to simulate the predictors |
collinear |
The correlation levels within the |
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 |
A list of elements:
ytrain |
return ONLY when |
xtrain |
return ONLY when |
ytest |
return ONLY when |
xtest |
return ONLY when |
resample.data |
return ONLY when |
This is the data generating function for the simulation functions: simulation.collinear
and simulation.adlasso
Mokyo Zhou
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.