generate_XY: Simulate a normal data set S = (X,Y), where Y = X^T beta.

Description Usage Arguments Value Examples

View source: R/generate_normal.R

Description

Creates a toy data set S = (X,Y) where the columns of X are sampled from an independent Gaussian distribution with mean μ_i and standard deviation σ_i, i.e. N(μ_i, σ_i^2). The response Y is given by Y = X^T β. The final dimension will be n \times (p + 1), with the number of data points n to be specified.

Usage

1
2
3
4
5
6
generate_XY(
  n = 100,
  mu = rep(0, 10),
  sigma = rep(1, 10),
  beta_coefficients = 1:10
)

Arguments

n

desired number of data points in the data set.

mu

a p-dimensional vector of means for μ.

sigma

a p-dimensional vector of non-negative standard deviations for σ.

beta_coefficients

a p-dimensional vector of coefficients for β.

Value

An n \times (p+1) dimensional data frame given by S = (X,Y). In the base case, the columns X_i are sampled from N(0,1). We also have n = 100 and p = 10, with beta-coefficients 1 to 10.

Examples

1
2
3
generate_XY()

generate_XY(n = 60, mu = 1:4, sigma = rep(1, 4), beta_coefficients = 1:4)

lamke07/stat545lamke07 documentation built on Dec. 21, 2021, 8:49 a.m.