xy: Random generation of linear model matrix and outcomes

Description Usage Arguments Details Value Author(s) References Examples

Description

This function can be used for simulations to evaluate the performance of linear model selection with independent predictors.

Usage

1
2
3
xy(n, p.all, p.true, R2, beta0 = 5, 
   yname = paste("y", p.true, sep = ""), 
   xname = paste("x", p.true, p.all, sep = ""))

Arguments

n

sample size.

p.all

maximum model dimension, i.e., number of candidate predictors plus 1.

p.true

true model dimension, i.e., number of predictors with nonzero coefficients plus 1.

R2

coefficient of determination for the true model.

beta0

true model intercept; in some contexts this value may be arbitrary.

yname

name for the generated outcome vector.

xname

name for the generated model matrix.

Details

xy simulates entries of a model matrix independently from the standard normal distribution, then simulates outcomes whose mean is simply beta0 plus the sum of the first p.true - 1 predictors. The errors are normal with mean 0 and standard deviation chosen so as to attain the given R2; see Tibshirani & Knight (1999), p. 538.

Value

A list with components X (model matrix, without intercept column) and y (outcome vector).

Author(s)

Philip Reiss phil.reiss@nyumc.org and Lei Huang huangracer@gmail.com

References

Tibshirani, R., and Knight, K. (1999). The covariance inflation criterion for adaptive model selection. Journal of the Royal Statistical Society, Series B, 61, 529–546.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Generate 40 vectors of 8 candidate predictors, of which 
# (the first) 2 have nonzero coefficients, along with 40 outcomes,
# with R^2=.8
tmp = xy(40, 9, 3, .8)

# As a side effect, the above created objects y5 and X59,
# equal to tmp$y and tmp$X respectively.
# The following lines can then be used to examine how different
# information criteria fare at identifying the true model as "best". 
ic.min(y3, x39)
eic(y3, x39, nboot=100)
cvic(y3, x39)

reams documentation built on May 2, 2019, 2:23 p.m.