Skip to contents

This function used for generate some sample data for experiment

Usage

gen_sample_data(size, dgp, seed = NULL)

Arguments

size

control the sample size.

dgp

data generating process, have options "normal", "chisq", "mixed", "poly", "2_fold_uniform".

seed

random seed number.

Value

A numeric vector of length size. The elements of the vector are generated according to the specified dgp:

normal

Normally distributed values with mean 0 and standard deviation 2.

chisq

Chi-squared distributed values with df = 10.

mixed

Half normally distributed (mean 0, sd = 2) and half chi-squared distributed (df = 10) values.

poly

Values from a polynomial cumulative distribution function on [0,1].

2_fold_uniform

Sum of two uniformly distributed random numbers.

Examples

# Generate 500 samples from 2-fold uniform distribution
X <- gen_sample_data(500, "2_fold_uniform", seed = 123)