hard_thresholding {TextForecast}R Documentation

hard thresholding

Description

hard thresholding

Usage

hard_thresholding(x, w, y, p_value, newx)

Arguments

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.

Value

the variables less than p-value.

Examples

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)


[Package TextForecast version 0.1.3 Index]