Next: Kriging Weights
Up: Algorithms
Previous: Construct Non-Parametric Cdf
Subsections
template<class target_cdf, class data_cdf, class forward_iterator>
void
cdf_transform(forward_iterator first, forward_iterator last,
data_cdf& from, target_cdf& to)
cdf_transform transforms the range of values [first,last) so that their final cumulative distribution function is to. Cdf from is the cumulative distribution function before the data are transformed. It could be computed with build_cdf.
In header file <univariate_stats.h>
- The range [first,last) is a valid range.
- The values in range [first,last) are of type taret_cdf::value_type, or are convertible to this type.
The values in range [first,last) are overwritten by the transformed values.
Transform 100 uniformly distributed values so that the transformed values follow a standard normal distribution:
int main()
{
vector<double> uniform_values;
for(int i=1; i<=100; i++)
uniform_values.push_back( rand() );
non_param_cdf from;
vector<double> tmp(uniform_values);
build_cdf(tmp.begin(), tmp.end(), from);
gaussian_cdf normal_cdf(0,1);
cdf_transform(uniform_values.begin(), uniform_values.end(),
from, normal_cdf);
}
Next: Kriging Weights
Up: Algorithms
Previous: Construct Non-Parametric Cdf
nicolas
2002-05-07