Learn R Programming

crisp (version 1.0.0)

sim.data: Simulate Data to Use with crisp.

Description

This function generates data according to the simulation scenarios considered in Section 3 of the CRISP paper (and plotted in Figure 2 of the paper).

Usage

sim.data(n, scenario, noise = 1, X = NULL)

Arguments

n
The number of observations.
scenario
The simulation scenario to use. Options are 1 (additive model), 2 (interaction model), 3 ('tetris' model), or 4 (smooth model), which correspond to the simulation scenarios of Section 3 of the CRISP paper. Each scenario has two covariates.
noise
The standard deviation of the normally-distributed noise that is added to the signal.
X
The n x 2 covariate matrix, which is automatically generated if not specified.

Value

A list containing:
  • X: An n x 2 covariate matrix.
  • y: An n-vector containing the response values.
  • Other elements: As specified by the user.

See Also

crisp, crispCV

Examples

Run this code
#See ?'crisp-package' for a full example of how to use this package

#generate data (using a very small 'n' for illustration purposes)
set.seed(1)
data <- sim.data(n = 15, scenario = 2)

#plot the mean model for the scenario from which we generated data
plot(data)

Run the code above in your browser using DataLab