• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Non Central Chi square distribution function

Joined
9/19/14
Messages
52
Points
18
Hi all, I was wondering, what is the best method to calculate the the Non central chi square distribution function?
 
What do want to 'calculate'?
I want to compute the non central chi square distribution and I was wondering, what was the best method to do this?
From my understanding there are various methods such as gamma series method, analytic approximations etc..
 
Code:
double dof = 3.0;
    double lambda = 1.5;

    boost::math::non_central_chi_squared_distribution<double> myNonCentralChiSquared(dof, lambda);


    cout << "pdf: " << pdf(myNonCentralChiSquared, x) << endl;
    cout << "cdf: " << cdf(myNonCentralChiSquared, x) << endl;

    // Other properties
    cout << "\n***Noncentral Chi^2 Distribution: \n";
    cout << "mean: " << mean(myNonCentralChiSquared) << endl;
    cout << "variance: " << variance(myNonCentralChiSquared) << endl;
    cout << "median: " << median(myNonCentralChiSquared) << endl;
    cout << "mode: " << mode(myNonCentralChiSquared) << endl;
    cout << "kurtosis excess: " << kurtosis_excess(myNonCentralChiSquared) << endl;
    cout << "kurtosis: " << kurtosis(myNonCentralChiSquared) << endl;
    cout << "characteristic function: " << chf(myNonCentralChiSquared, x) << endl;
    cout << "hazard: " << hazard(myNonCentralChiSquared, x) << endl;
 
Thank you for that,
I think I am a little confused. I think my original question should have been which is the best method to approximate the non central chi square distribution?
Because I am looking for the maths behind it and I have come across many methods etc...

Mathematica and MATLAB both have built in functions, e.g.:

http://www.mathworks.co.uk/help/stats/noncentral-chi-square-distribution.html?refresh=true

I am guessing you want to generate pdf and/or cdf?
 
Back
Top