View source: R/hard_thresholding.R
hard_thresholding | R Documentation |
hard thresholding
hard_thresholding(x, w, y, p_value, newx)
x |
the input matrix x. |
w |
the optional input matrix w, that cannot be selected. |
y |
the response variable. |
p_value |
the threshold p-value. |
newx |
matrix that selection will applied. Useful for time series, when we need the observation at time t. |
the variables less than p-value.
data("stock_data") data("optimal_factors") y=as.matrix(stock_data[,2]) y=as.vector(y) w=as.matrix(stock_data[,3]) pc=as.matrix(optimal_factors) t=length(y) news_factor <- hard_thresholding(w=w[1:(t-1),],x=pc[1:(t-1),],y=y[2:t],p_value = 0.01,newx = pc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.