Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Define distribution function to be zero if ecdf(X) is not defined
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a distribution of random numbers X in the interval [50,100]. When using the function ecdf(X) to receive the empirical cumulative distribution function, the values for x<50 are not defined.
I the following, I want to integrate (1-ecdf(X)) from 0 to infinity and therefore need the ecdf(X) to be zero.
Is there a possibility to define the ecdf(X) to be zero for x<50?
댓글 수: 0
채택된 답변
Torsten
2017년 11월 9일
[f,x] = ecdf(X);
Ecdf=@(p) interp1(x,f,p)*(p>=50)
Best wishes
Torsten.
댓글 수: 6
Torsten
2017년 11월 9일
편집: Torsten
2017년 11월 9일
If you integrate from the first x-value to the last x-value (as the command
"trapz(x,Distribution_distorted)"
does), you automatically ensure that the CDF is counted to be zero outside the interval where its mass is concentrated (namely outside [x(1);x(end)]). And I guess this is what you want.
Best wishes
Torsten.
추가 답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!