How can I use truncate function for F distribution?
Show older comments
I need the truncated F inverse cumulative distribution function. But makedist function do not work for "F". So, how can I use truncate function for "F" distribution? Thanks
Answers (1)
n=100;
xu = rand(n);
xft = finv(fcdf(a,v1,v2)+xu*(fcdf(b,v1,v2)-fcdf(a,v1,v2)),v1,v2);
gives you n random numbers xft of the truncated F-distribution where
v1: numerator degrees of freedom
v2: denominator degrees of freedom
[a;b] : truncation interval.
Or to precisely answer your question:
The inverse cumulative distribution function of the truncated F-distribution finvt(x,v1,v2) is given by
finvt(x,v1,v2)=finv(fcdf(a,v1,v2)+x*(fcdf(b,v1,v2)-fcdf(a,v1,v2)),v1,v2)
Best wishes
Torsten.
2 Comments
ati
on 14 Oct 2015
The F distribution is not in the list of distributions you can apply the "makedist" command to:
Thus, there is also no way to truncate it with the "truncate" command:
However, the F distribution is part of the statistics toolbox. The cumulated distribution (fcdf) and its inverse (finv) can be used. Combining them in the way
finvt(x,v1,v2)=finv(fcdf(a,v1,v2)+x*(fcdf(b,v1,v2)-fcdf(a,v1,v2)),v1,v2)
you get the inverse of the cumulated distribution of the truncated F distribution on the truncation interval [a;b].
And using it as
n=100;
xu = rand(n);
xft = finv(fcdf(a,v1,v2)+xu*(fcdf(b,v1,v2)-fcdf(a,v1,v2)),v1,v2);
you can generate random numbers of the truncated F distribution.
I guess this is your final aim, isn't it ?
Best wishes
Torsten.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!