Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

# Please help me to translate this code in to R language. I want to find out critical values for lag 10, 20 and 30. I have attached the matlab code.

1 visualización (últimos 30 días)
Aqsa Ghafar el 22 de En. de 2023
Cerrada: John D'Errico el 22 de En. de 2023
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% FUNCTION quantileQmax(L,p,iprob) %
% computes quantiles of statistic Qmax at level 1-alpha %
% when max autocorrelation is at lag p %
% and the largest computed lag is L %
% probability levels: iprob=1 alpha=0.10 %
% iprob=2 alpha=0.01 %
% any other iprob: alpha=0.05 %
% %
% Matlab functions required: fzero, chi2inv %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function qqq= quantileQmax(L,p,iprob)
if iprob==1
alpha=0.1;
elseif iprob==2
alpha=0.01;
else
alpha=0.05;
end
x0=chi2inv(1-alpha,p);
qqq=fzero(@(x)(qnoncondp(x,p,L)-1+alpha),x0);
end