code for computing the formular
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I have the set of numbers
(Si) = (0.25541156, 4.446482251, 0.389762062, 4.211214131)
(sj) = ( 0.25541156, 4.446482251, 0.389762062, 4.211214131)
pvalue = ( #( si greater than sj ) + 0.5 (si = sj) )/ i
when i = 1
I am trying to compute this steps
pvalue = 1 when i = 1 pvalue is always 1
si = sj = 1
when i = 2
J = 1 if s2 > sj1 = 1 pvalue = ( 1 + 0.5(1)) / 2 = 0.75
J = 2 s2 = sj2 = 1
for i = 3
J = 1 s3 > sj1 = 1
J = 2 s3 > sJ2 = 0 pvalue = (1 + 0.5 (1))/3 = 0.5
J= 3 s3 = sj3 = 1
for i = 4
J = 1 s4 > sj1 = 1
J = 2 S4 > Sj2 = 0 pvalue = 2 + 0.5(1)/4 = 0.625
J = 3 s4 > sj3 = 1
J = 4 s4 = sj4 = 1
I will appreciate it if I get a code to compute the various pvalue
jonathan
0 Kommentare
Akzeptierte Antwort
dpb
am 10 Apr. 2019
Bearbeitet: dpb
am 10 Apr. 2019
fnP=@(a,i) (sum(a(i)>a(1:i))+0.5*sum(a(i)==a(1:i)))/i;
>> for i=2:numel(Si),fnP(Si,i),end
ans =
0.75
ans =
0.50
ans =
0.63
>>
To wrap the i==1 special case got more than I could get into the anonymous function in the time I had to play...for general use write a little function--
function P=fnP(A,n)
% Return some undefined P-value estimator from vector A, number elements, n
if n==1
P==1;
else
P=(sum(A(n)>A(1:n)) + 0.5*sum(A(n)==A(1:n)))/n;
end
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!