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

View source: R/estimate_variance.R

estimateVarianceR Documentation

Estimate noise variance given predictor X and continuous outcome Y.

Description

estimateVariance estimate noise variance.

Usage

estimateVariance(X, Y, n_rep = 5)

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.

Value

Estimated noise variance of X and Y.

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

## 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

xtune documentation built on July 9, 2023, 5:22 p.m.