// non_central_t_example.cpp // Copyright Paul A. Bristow 2012. // Use, modification and distribution are subject to the // Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt // or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include #include int main() { using namespace std; try { double nu = 3.0; double delta = 3.0; double x = 3.0; boost::math::non_central_t_distribution nct(delta, nu); cout << "Constructed student's t " << nct.degrees_of_freedom() << " degrees of freedom, " << nct.non_centrality() << " non-centrality" << endl; double test_pdf = pdf(nct, x); double test_cdf = cdf(nct, x); cout << "Probability density of non-central Student's t at " << x << " is " << test_pdf << endl; cout << "Cumulative probability of non-central Student's t at " << x << " is " << test_cdf << endl; } catch(std::exception& ex) { cout << ex.what() << endl; } } // int main() /* Output: Description: Autorun "J:\Cpp\MathToolkit\test\Math_test\Debug\non_central_t_example.exe" Constructed student's t 3 degrees of freedom, 3 non-centrality Probability density of non-central Student's t at 3 is 0.236781 Cumulative probability of non-central Student's t at 3 is 0.425022 */