Overview of the UVS Library

The heart of the UVS library is a set of classes describing univariate distributions of discrete and continuous types. For instance, to compute some properties of a normal distribution with mean of 1.6 and standard deviation of 0.33 you might write:

	#include "uvs/dist.h" // for uvs::Normal

	uvs::Normal my_dist(1.6, 0.33);
	std::cout << "fraction less than 2.0 = " << my_dist.cdf(2.0) << '\n';
	std::cout << "25th percentile = " << my_dist.icdf(0.25) << '\n';

UVS provides a process generator for each of these distributions. The name of the process generator is the same as the name of the distribution with a "PG" suffix. For example to print out 10 normal variates you might write:

	#include "uvs/rng.h" // for uvs::Good1
	#include "uvs/proc.h" // for uvs::NormalPG

	typedef uvs::Good1 RNG; // type of random number generator to use
	RNG rng;
	uvs::NormalPG<RNG> my_proc(&rng, 1.6, 0.33);
	for (int j = 0; j < 10; ++j)
		std::cout << my_proc() << '\n';

The process generators are derived from the corresponding distributions so anything you can do with a uvs::Normal you can also do with a uvs::NormalPG. For each of these "smart process generators" UVS provides a "fast process generator" which is implemented as a function rather than a class and therefore incurs no overhead for a virtual function call. See the header file for details.

UVS provides two sets of classes for collecting sample statistics: concrete data types and polymorphic data types. The concrete data types are generally faster but less flexible. The concrete types have names beginning with "sample_" and have a template parameter to distinguish discrete from continuous variables. Here is an example of computing the mean and standard deviation of 3 floating point numbers:

	#include "uvs/samp.h" // for uvs::sample_stdev

	uvs::sample_stdev<double> my_samp;
	my_samp(5.4);
	my_samp(2.8);
	my_samp(2.6);
	std::cout << " mean = " << my_samp.xbar() << '\n';
	std::cout << "stdev = " << my_samp.s() << '\n';

Finally, UVS provides a set of hypothesis testing functions. For instance to find out if the mean of the distribution from the previous example could be 10 we might write:

	#include "uvs/hypoth.h" // for uvs::HypMean and uvs::reject_two_tail

	double H0 = 10.0; // hypothesized mean
	uvs::HypMean my_hyp(my_samp.xbar(), my_samp.s(), my_samp.n(), H0);
	double alpha = 0.05; // alpha risk for hypothesis test
	bool answer = uvs::reject_two_tail(my_hyp, alpha);
If "answer" is false we can reject the null hypothesis at an alpha risk of 5%.