Displaying 1 result from an estimated 1 matches for "ecfd".
Did you mean:
ecdf
2004 Oct 26
2
Empirical P Value
...the p value for a stat from the ECDF. That is the
index of the first occurrence,
on an ordered vector, of a value either greater than or equal to a given
value.
Ideally I would not have to order the vector beforehand.
Currently I use:
PValue<-function(stat, ECDF){
###Get the length of the ECFD
L<-length(ECDF)
###Loop through the ECDF until the p value is found
for(i in 1:L){
if(ECDF[i]>=stat){
break
}
}
###Return the 3 values that bracket the p value
c((i-1)/L, i/L, (i+1)/L)
}
Is there a way of doing this that avoids the explicit loop?
platform i386-pc...