Quantile of F-distribution

Hello! I have boost libraries and I need quantile of F-distribution.
But unfortunatelty I've havent found an example of it on the internet.
As for the normal distribution it was
1
2
3
#include <boost/math/distributions/normal.hpp>
	boost::math::normal dist(0.0, 1.0);
double z = quantile(dist, 1-5/100);

For F-distribution it should be someting like that with two degree of fredom and probability.
1
2
3
#include <boost/math/distributions/fisher_f.hpp>
	boost::math::fisher_f dist(0.0, 1.0);
	double z = quantile(dist, 0.95);

Looked up to this link https://www.boost.org/doc/libs/1_69_0/libs/math/doc/html/math_toolkit/dist_ref/dists/f_dist.html but unfortunately I've haven't understood how two write two seconds lines for quntile of f distributions.
I need some help. Thanks in advance!
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <boost/math/distributions/fisher_f.hpp>
using namespace std;
using boost::math::fisher_f;

int main()
{
   double df1 = 5, df2 = 2;    // degrees of freedom
   double p = 0.8;             // cumulative probability
   fisher_f dist(df1, df2);    // distribution object with appropriate deg. freedom
   cout << "quantile(" << p << ") = " << quantile(dist, p);
}


Blimey, I never knew cpp.sh had boost!!! That's a well-kept secret!
Last edited on
Topic archived. No new replies allowed.