factorModelSim1: Simulate some data from a sparse 2 factor model

Description Usage Arguments Value Examples

View source: R/simulTemp.R

Description

Simulate some data from a sparse 2 factor model

Usage

1
2
factorModelSim1(n, p, p1 = 2, lambdas = c(5, 2), beta1 = 1, sig0 = 0.1,
  sig1 = 1)

Arguments

n

number of observations

p

number of predictors

p1

number of predictors which load onto the factors (requires 2*p1 <= p)

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

Value

A list containing:

  1. X — n x p matrix of predictors

  2. Y — response vector of length n

  3. theta — regression coefficients on the predictors

  4. beta — regression coefficients on the factors (first is beta1)

  5. U — p x 2 matrix of factors

  6. Lambda — matrix of factor weights (as input)

  7. SigXY — marginal correlation between columns of X and Y

Examples

1
dat = factorModelSim1(100,1000,5,c(5,1),2,.1,.1)

dajmcdon/aimer documentation built on May 6, 2019, 1:31 a.m.