Kolmogorov
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hy, i'm trying to perform the Kolmogorov-Smirnov test by using the function h = kstest(x,CDF). I have to use this test to verify the good agreement of my data set (matrix (20,6545)) to the Cumulative GEV distribution but i can't build the CDF matrix. This is the program that i wrote:
E=patterns_EOBS(:,6545); %dataset
M=6545;
N=20;
x=[-5:3:55]';
parmhat_EOBS=zeros(M,3);
P=zeros(N,M);
CDF=zeros(N,2);
h=zeros(M);
p=zeros(M);
kstat=zeros(M);
cv=zeros(M);
for j=1:M
parmhat_EOBS(j,:)=gevfit(E(:,j));
for i=1:N
P(i,j)=gevcdf(x(i),parmhat_EOBS(j,1),parmhat_EOBS(j,2),parmhat_EOBS(j,3));
end
CDF(:,j)=horzcat(E(:,j),P(:,j));
[h(j),p(j),kstat(j),cv(j)]=kstest(E(:,j),CDF(:,j));
end
And this is the error that mathlab returns to me:
??? Subscripted assignment dimension mismatch.
Error in ==> KolmoEOBS at 22 CDF(:,j)=horzcat(E(:,j),P(:,j));
CAn you help me?
MArghe
1 comentario
Andrew Newell
el 30 de Mayo de 2011
Since you don't know the parameters of your distribution in advance, you should be using lillietest.
Respuestas (3)
Ivan van der Kroon
el 26 de Mayo de 2011
Matlab is very clear here; your dimensions mitmatch: size(CDF(:,j))=[20,1] while size(horzcat(E(:,j),P(:,j)))=[20,2].
Another problem that will occur is that j will be greater than 2 at some point while size(CDF)=[20,2].
From this I think you are looking for
CDF=zeros(N,2,M);
CDF(:,:,j)=horzcat(E(:,j),P(:,j));
0 comentarios
MArghe
el 30 de Mayo de 2011
1 comentario
Oleg Komarov
el 30 de Mayo de 2011
Line 8: zeros(M) = zeros(M,M) --> zeros(6545) ~ 2.6 Gb = (6545^2) * 8 bytes
Ivan van der Kroon
el 30 de Mayo de 2011
I know that CDF has to be of size Nx2, but you want to have M of those in your for-loop. So you have to use CDF(:,:,j), which is a Nx2 again. If you are not interested in it, you should overwrite it every iteration, i.e. no preallocation fod CDF and no indexes:
CDF=horzcat(E(:,j),P(:,j));
[h(j),p(j),kstat(j),cv(j)]=kstest(E(:,j),CDF);
This way you save considerable memory. But working with a 6545x6545 system is hard as Oleg commented. It checked and it worked for me (on my 64bits version).
0 comentarios
Ver también
Categorías
Más información sobre Hypothesis Tests en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!