Bootstrap.H File Reference

Header for resampling data points based on their known error. Can do both sample based and parametric (group) based sigmas. More...

#include <gsl/gsl_rng.h>
#include <cstdio>
#include <vector>
#include "kdsPmagL.H"

Go to the source code of this file.

Functions

void Print (const SVec &sv)
 Print out the values in a 6 or 7 value s diagonal matrix w/ or without sigma.
size_t BootstrapParametricSample (const std::vector< SVec > &s, const std::vector< float > &sigmas, SVec &newSample, gsl_rng *r)
 Draw a random sample from the raw dataset, but perturbed by sample's sigma.
size_t BootstrapParametricSite (const std::vector< SVec > &s, const float sigma, SVec &newSample, gsl_rng *r)
 Draw a random sample from the raw dataset, but perturbed by a single sigma.
template<class T>
getDevRandom (T &randomSample)
 This is used as a better random seed to pass to the GSL random number engine.


Detailed Description

Header for resampling data points based on their known error. Can do both sample based and parametric (group) based sigmas.


Function Documentation

size_t BootstrapParametricSample const std::vector< SVec > &  s,
const std::vector< float > &  sigmas,
SVec newSample,
gsl_rng *  r
 

Draw a random sample from the raw dataset, but perturbed by sample's sigma.

Parameters:
s All of the s 6 value diagonal matrix. See k15_s.
sigmas All the sigmas (7th value) for the s values. length must be the same as for s
newSample returns the new 6 values
r the GSL random number generator that we are using
Returns:
the index into s that was randomly chosen
This is not really a bootstrap! But is can be used to generate bootstraps. The alorithm here is to randomly select one of the samples in s, then the matching simga from sigmas. This selection is done with a gsl_ran_uniform so all samples are equally likely.

Then for each value in the selected s, a delta is created by sigmas[sampleNum] * gsl_ran_gaussian(r,1.0) then added to that s value. The 6 new s values are then renormalized to have a trace of 1.

http://www.gnu.org/software/gsl/manual/gsl-ref_19.html#SEC288

Bug:
Is this really the right way? Can only have up to 1 sigma error. How to allow 2 sigma error. Or N sigma

size_t BootstrapParametricSite const std::vector< SVec > &  s,
const float  sigma,
SVec newSample,
gsl_rng *  r
 

Draw a random sample from the raw dataset, but perturbed by a single sigma.

Parameters:
s All of the s 6 value diagonal matrix. See k15_s.
sigma sigma to apply across the s values in a gaussian distribution. Usually a Hext site value. See SiteSigma()
newSample returns the new 6 values
r the GSL random number generator that we are using
Returns:
the index into s that was randomly chosen
This is not really a bootstrap! But is can be used to generate bootstraps. The alorithm here is to randomly select one of the samples in s. This selection is done with a gsl_ran_uniform so all samples are equally likely.

Then for each value in the selected s, a delta is created by sigma * gsl_ran_gaussian(r,1.0) then added to that s value. The 6 new s values are then renormalized to have a trace of 1.

http://www.gnu.org/software/gsl/manual/gsl-ref_19.html#SEC288

Bug:
Is this really the right way? Can only have up to 1 sigma error. How to allow 2 sigma error. Or N sigma

template<class T>
T getDevRandom T &  randomSample  ) 
 

This is used as a better random seed to pass to the GSL random number engine.

Parameters:
randomSample Give is a variable to fill. This function will fill it with who knows what.
Returns:
returns the random value. The arg determines the size. Use the systems /dev/random entropy generator produce a random value for any data type. /dev/random will return how ever many bytes that are requested, so it just uses the size of the caller supplied data type.

void Print const SVec sv  ) 
 

Print out the values in a 6 or 7 value s diagonal matrix w/ or without sigma.

Parameters:
sv really a vector<float>


Generated on Thu Mar 2 17:55:25 2006 for density by  doxygen 1.4.6