hard_thresholding: hard thresholding

Description Usage Arguments Value Examples

View source: R/hard_thresholding.R

Description

hard thresholding

Usage

1
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

1
2
3
4
5
6
7
8
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)

lucasgodeiro/TextForecast documentation built on Sept. 19, 2019, 3:41 a.m.