Learn R Programming

xtune (version 2.0.0)

estimateVariance: Estimate noise variance given predictor X and continuous outcome Y.

Description

estimateVariance estimate noise variance.

Usage

estimateVariance(X, Y, n_rep = 5)

Value

Estimated noise variance of X and Y.

Arguments

X

predictor matrix of dimension \(n\) by \(p\).

Y

continuous outcome vector of length \(n\).

n_rep

number of repeated estimation. Default is 10.

Details

The estimateSigma function from selectiveInference is used repeatedly to estimate noise variance.

References

Stephen Reid, Jerome Friedman, and Rob Tibshirani (2014). A study of error variance estimation in lasso regression. arXiv:1311.5274.

See Also

selectiveInference

Examples

Run this code
## simulate some data
set.seed(9)
n = 30
p = 10
sigma.square = 1
X = matrix(rnorm(n*p),n,p)
beta = c(2,-2,1,-1,rep(0,p-4))
Y = X%*%beta + rnorm(n,0,sqrt(sigma.square))

## estimate sigma square
sigma.square.est = estimateVariance(X,Y)
sigma.square.est

Run the code above in your browser using DataLab