Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

EmpiricalRandomVariable Class Reference

#include <RandomVariables.h>

Inheritance diagram for EmpiricalRandomVariable:

RandomObject< RangeType, ScalarType > List of all members.

Detailed Description

A random variable X distributed according to the empirical distribution associated with a data sample. This distribution assumes that the data points exhaust all possible values and all values are equally likely. Drawing samples of X amounts to sampling from the data set with replacement.

This is the type of random variable to use if you have a raw data set. Samples drawn from the empirical distribution do not need to have the same size as the data set and indeed can be arbitrarily large (sampling with replacement).

Class maintains a reference to the data set array but does not construct a copy of this array. The data are assumed to be of scalar type Real.

Michael J. Meyer

Definition at line 115 of file RandomVariables.h.

Public Member Functions

int getSampleSize () const
RealgetDataSet () const
 EmpiricalRandomVariable (Real *data_set, int sample_size)
Real nextValue ()

Static Public Member Functions

void test (int n)

Constructor & Destructor Documentation

EmpiricalRandomVariable::EmpiricalRandomVariable Real   data_set,
int    sample_size


sample_size number of data points
data_set array containing the data sample.

Definition at line 136 of file RandomVariables.h.

Member Function Documentation

int EmpiricalRandomVariable::getSampleSize   const [inline]

Number of data points.

Definition at line 124 of file RandomVariables.h.

Real* EmpiricalRandomVariable::getDataSet   const [inline]

The array containing the sample data.

Definition at line 128 of file RandomVariables.h.

References Real.

Real EmpiricalRandomVariable::nextValue   [virtual]

Sampling from the distribution of X, Samples from the underlying data set with replacement.

Implements RandomObject< RangeType, ScalarType >.

void EmpiricalRandomVariable::test int    n [static]

Allocates the data set 0,1,...,n-1, then prints a sample of size 200 from the empirical distribution.

The documentation for this class was generated from the following file:
Generated on Mon Sep 22 02:16:32 2003 for Libor-Library by doxygen1.3-rc3