data_gen {cvmaPLFAM}R Documentation

Simulated data

Description

Simulate sample data for illustration, including a M0-column design matrix of scalar predictors, a 100-column matrix of the functional predictor, a one-column vector of mu, a one-column vector of Y, and a one-column vector of testY.

Usage

data_gen(R, K, n, ntest, M0, typ, design)

Arguments

R

A scalar of value ranging from 0.1 to 0.9. The ratio of var(mu)/var(Y).

K

A scalar. The number of replications.

n

A scalar. The sample size of training data.

ntest

A scalar. The sample size of test data.

M0

A scalar. True dimension of scalar predictors.

typ

A scalar of value 1 - 2. Type of the effect for the functional predictor.

design

A scalar of value 1 - 3. Correspond to simulation studies.

Value

A list of K simulated training data sets and K simulated test data sets. Each data set is of matrix type, whose first M0 columns corresponds to the design matrix of scalar predictors, followed by the recording/measurement matrix of the functional predictor, and vectors mu, Y.

Examples

library(MASS)
# Example: Design 1 in simulation study
set.seed(22)
data1 <- data_gen(R = 0.6, K = 2, n = 10, ntest = 5, M0 = 4, typ = 1, design = 1)
str(data1)
# List of 4
#$ : num [1:10, 1:106] -0.501 -1.266 -0.564 -0.563 -0.395 ...
#$ : num [1:10, 1:106] -1.207 -0.089 -0.782 0.123 0.66 ...
#$ : num [1:5, 1:106] 0.816 0.679 0.816 -0.563 -1.367 ...
#$ : num [1:5, 1:106] -0.089 -0.785 0.899 -0.785 -0.445 ...


# Example: Design 2 in simulation study
data_gen(R = 0.3, K = 3, n = 10, ntest = 5, M0 = 20, typ = 1, design = 2)

# Example: Design 3 in simulation study
data_gen(R = 0.9, K = 5, n = 20, ntest = 10, M0 = 4, typ = 2, design = 3)



[Package cvmaPLFAM version 0.1.1 Index]