TPC_BIC {TPCselect} | R Documentation |
Variable Selection via Thresholded Partial Correlation
Description
Use BIC to select the best s
and constant
over grids.
Usage
TPC_BIC(y, x, s = 0.05, constant = 1, method = "threshold")
Arguments
y |
response vector; |
x |
covariate matrix; |
s |
a value or a vector that used as significance level(s) for partial
correlation test. BIC will be used to select the best |
constant |
a value or a vector that used as the tuning constant for partial
correlation test. BIC will be used to select the best |
method |
the method to be used; default set as method = "threshold"; "simple" is also available. |
Value
TPC.object a TPC object, which extends the lm
object. New attributes are:
beta - the fitted coefficients
selected_index - the selected coefficients indices
Examples
#generate sample data
p = 200
n = 200
truebeta <- c(c(3,1.5,0,0,2),rep(0,p-5))
rho = 0.3
sigma = matrix(0,p+1,p+1)
for(i in 1:(p+1)){
for(j in 1:(p+1)){
sigma[i,j] = rho^(abs(i-j))
}
}
x_error = 0.9*MASS::mvrnorm(n,rep(0,p+1),sigma) + 0.1*MASS::mvrnorm(n,rep(0,p+1),9*sigma)
x = x_error[,1:p]
error = x_error[,p+1]
y = x%*%truebeta + error
#perform variable selection via partial correlation
TPC.fit = TPC_BIC(y,x,0.05,c(1,1.5),method="threshold")
TPC.fit$beta
[Package TPCselect version 0.8.3 Index]