bs_cor_rank {TensorPreAve} | R Documentation |
Bootstrap Rank Estimation.
Description
Function to estimate the rank of the core tensor by Bootstrapped Correlation Thresholding.
Usage
bs_cor_rank(X, initial_direction, r_range = NULL, C_range = NULL, B = 50)
Arguments
X |
A 'Tensor' object defined in package rTensor with |
initial_direction |
Direction corresponds to the strongest factors, written in a list of |
r_range |
Approximate range of |
C_range |
The range of constant C for calculating threshold. Default is |
B |
Number of bootstrap samples. Default is 50. Can be set as 10 to save time when dimension is large. |
Details
Input a tensor time series and estimated directions corresponding to the strongest factors, return the estimated rank of core tensor.
Value
A vector of length K
, indicating estimated number of factors in each mode.
Examples
# Example of real data set
set.seed(10)
Q_PRE = pre_est(value_weight_tensor)
Q_PROJ = iter_proj(value_weight_tensor, initial_direction = Q_PRE)
bs_rank = bs_cor_rank(value_weight_tensor, Q_PROJ)
bs_rank
# Example using generated data
K = 2
T = 100
d = c(40,40)
r = c(2,2)
re = c(2,2)
eta = list(c(0,0),c(0,0))
u = list(c(-2,2),c(-2,2))
set.seed(10)
Data_test = tensor_data_gen(K,T,d,r,re,eta,u)
X = Data_test$X
Q_PRE = pre_est(X)
Q_PROJ = iter_proj(X, initial_direction = Q_PRE)
bs_rank = bs_cor_rank(X, Q_PROJ)
bs_rank