%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% This code is used to generate critical values for the CLR statistic \ % we pre-calculate three sets of the CLR crtical values % we fix K (number of factors) in the beginning %% finite sample critical values: fixed N,T, various r, we may consider several %% combinations of (N,T) %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear; rng(1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Input values: a combination of N,T and range of r T=100; N=30; r_range=0:1:200; % quan=0.95; K=1; rdd_num=50000; CLR_qunatile=NaN(length(r_range),1); for n=1:length(r_range) fprintf('%2.0f out of %2.0f\n', n, length(r_range)); r=r_range(n); CLR=NaN(rdd_num,1); parfor i=1:rdd_num CLR(i)=CLR_simu_dist(N,T,K,r,1); end CLR_qunatile(n)= quantile(CLR,quan); end save CLR_qunatile_alongr_N25T50.mat r_range CLR_qunatile figure() plot(r_range, CLR_qunatile)