Description Usage Arguments Value Examples
Simulate some data from a sparse 2 factor model
1 2 | factorModelSim1(n, p, p1 = 2, lambdas = c(5, 2), beta1 = 1, sig0 = 0.1,
sig1 = 1)
|
n |
number of observations |
p |
number of predictors |
p1 |
number of predictors which load onto the factors (requires 2* |
lambdas |
relative weights of the factors |
beta1 |
coefficient of y on the first factor (the second is calculated automatically to make the marginal correlation between those predictors and the response 0) |
sig0 |
Standard deviation of the factor |
sig1 |
Standard deviation of the noise |
A list containing:
X
— n x p matrix of predictors
Y
— response vector of length n
theta
— regression coefficients on the predictors
beta
— regression coefficients on the factors (first is beta1
)
U
— p x 2 matrix of factors
Lambda
— matrix of factor weights (as input)
SigXY
— marginal correlation between columns of X and Y
1 | dat = factorModelSim1(100,1000,5,c(5,1),2,.1,.1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.