statistics - Chi-Squared Probability Function in C++ -
My low code calculates trust interval by using chi-squares 'Quantil' and potential functions from Boost.
I am trying to implement this function to avoid the boost of Boost. Is there a resource where I can get such an implementation?
#include & lt; Boost / math / distributions / chi_squared.hpp & gt; # Include & lt; Boost / cstdint.hpp & gt; using namespace std; Boost :: math :: using chi_squared; Boost :: math :: use quantity; Vector & lt; Double & gt; ConfidenceInterval (double X) {Vector & lt; Double & gt; ConfInts; // is an approximate value in which // we want to get confidence interval. Chi_squared distl (2); Chi_quareware diste ((x + 1) * 2); Double alpha = 0.90; Double lower_limit = 0; If (x! = 0) {chi_squared distl (x * 2); Lower_limit = (volume (distal, (1-alpha) / 2))) / 2; } Double upper_limit = (volume (1, - ((1-alpha) / 2))) / 2; ConfInts.push_back (lower_limit); ConfInts.push_back (UPPER_LIMIT); Return ConfInts; }
If you are looking for source code you can copy / paste Some links are:
YMMV ...
Comments
Post a Comment