Creates a toy data set \(S = (X)\) where the columns of \(X\) are sampled from an independent Gaussian distribution with mean \(\mu_i\) and standard deviation \(\sigma_i\), i.e. \(N(\mu_i, \sigma_i^2)\). The final dimension will be \(n \times p\), with the number of data points \(n\) to be specified.

generate_X(n = 100, mu = rep(0, 10), sigma = rep(1, 10))

Arguments

n

The desired number of data points in the data set.

mu

A \(p\)-dimensional vector of means for \(\mu\).

sigma

A \(p\)-dimensional vector of non-negative standard deviations for \(\sigma\).

Value

An \(n \times p\) dimensional data frame given by \(S = (X)\). In the default case, the columns \(X_i\) are sampled from \(N(0,1)\), \(n = 100\) and \(p = 10\).

Examples

generate_X()
#> # A tibble: 100 × 10
#>         X1     X2      X3      X4      X5       X6     X7     X8      X9    X10
#>      <dbl>  <dbl>   <dbl>   <dbl>   <dbl>    <dbl>  <dbl>  <dbl>   <dbl>  <dbl>
#>  1 -1.14   -0.579 -0.708   0.479   1.00   -0.712   -0.166  0.842  0.578  -0.110
#>  2 -0.280  -0.169  1.48    1.67    0.528  -1.36     0.120  1.26   0.113  -1.05 
#>  3 -0.894  -1.92   0.845  -0.0365  1.16   -0.501   -0.662 -0.710  0.440  -0.891
#>  4  0.137  -1.53   1.29   -0.441   0.173   1.44    -0.531 -0.354 -2.00   -0.619
#>  5 -0.749  -1.11   0.298   0.734   0.578  -0.512   -0.301 -1.08   1.04    0.255
#>  6  0.518   1.60  -0.406  -0.575  -0.116  -0.00197 -0.602  0.967 -1.01   -0.439
#>  7 -0.192  -0.640 -0.139   0.0749  0.905   1.78    -0.318 -0.481 -0.505   1.47 
#>  8  0.0288  1.57  -0.223   0.0593 -0.0166  1.03     0.308 -1.04   0.0900  0.833
#>  9  0.359  -1.45   1.75    0.848  -0.922  -0.581    0.799  0.200 -1.29   -0.914
#> 10 -0.0290 -0.792 -0.0817  2.58   -1.06   -1.59     1.75   1.71  -1.73   -0.273
#> # … with 90 more rows

generate_X(n = 40, mu = 1:10, sigma = rep(1, 10))
#> # A tibble: 40 × 10
#>        X1    X2    X3    X4    X5    X6    X7    X8    X9   X10
#>     <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1  2.14  0.787  2.03  3.65  4.17  4.89  7.13 10.3   9.83  9.38
#>  2 -0.382 3.37   1.31  3.45  4.04  5.37  6.63  7.62  7.63  9.81
#>  3  0.156 2.08   1.52  3.98  5.47  4.52  6.55  8.03  9.19 10.4 
#>  4 -0.837 0.734  5.43  3.66  6.49  6.15  8.20  8.78 11.0   9.97
#>  5  2.04  3.17   2.77  4.19  5.85  3.70  7.96  6.02  8.19  9.47
#>  6  1.22  2.70   4.11  4.35  4.91  5.56  8.10  7.99  9.25 13.1 
#>  7  1.80  2.80   2.56  3.21  4.24  5.35  7.05  8.70  9.51  8.58
#>  8  1.71  0.998  4.26  3.25  4.58  6.42  6.93  9.22  8.50 10.3 
#>  9  0.683 1.32   4.44  2.15  3.88  6.05  6.73  7.86  8.10  8.24
#> 10 -1.25  2.72   2.08  2.44  3.63  4.71  5.91  7.50 10.0   8.98
#> # … with 30 more rows