edu.uah.math.distributions
Class RandomVariable

java.lang.Object
  extended by edu.uah.math.distributions.RandomVariable

public class RandomVariable
extends java.lang.Object

This class models a random variable in terms of a distribution and an interval dataset. The dataset holds a random sample from the distribution.

Version:
August, 2003
Author:
Kyle Siegrist, Dawn Duehring

Constructor Summary
RandomVariable()
          This default constructor creates a new random variable with a normal distribution and with the default name "X".
RandomVariable(Distribution d)
          This special constructor creates a new random variable with a specified probability distribution and the default name "X".
RandomVariable(Distribution d, java.lang.String n)
          This general constructor creates a new random variable with a specified probability distribution and name.
 
Method Summary
 Distribution getDistribution()
          This method gets the probability distribution.
 IntervalData getIntervalData()
          Get the data distribution.
 java.lang.String getName()
          This method gets the name of the random variable.
 double getValue()
          This method gets the current value of the random variable.
 void reset()
          This method resets the data distribution.
 void sample()
          This method simulates a value of the probability distribution and assigns the value to the data distribution.
 void setDistribution(Distribution d)
          This method assigns the probability distribution and create a corresponding interval data distribution.
 void setName(java.lang.String n)
          This method assign a name to the random variable.
 void setValue(double x)
          This method assigns a value to the random variable.
 double simulate()
          This method simulates a value of the probability distribution, assigns the value to the data distribution, and returns the value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RandomVariable

public RandomVariable(Distribution d,
                      java.lang.String n)
This general constructor creates a new random variable with a specified probability distribution and name.

Parameters:
d - the probability distribution
n - the name of the variable

RandomVariable

public RandomVariable(Distribution d)
This special constructor creates a new random variable with a specified probability distribution and the default name "X".

Parameters:
d - the probability distribution

RandomVariable

public RandomVariable()
This default constructor creates a new random variable with a normal distribution and with the default name "X".

Method Detail

setDistribution

public void setDistribution(Distribution d)
This method assigns the probability distribution and create a corresponding interval data distribution.

Parameters:
d - the probability distribution

getDistribution

public Distribution getDistribution()
This method gets the probability distribution.

Returns:
the probability distribution

getIntervalData

public IntervalData getIntervalData()
Get the data distribution.

Returns:
the interval data distribution

setValue

public void setValue(double x)
This method assigns a value to the random variable.


getValue

public double getValue()
This method gets the current value of the random variable.

Returns:
the current value of the random variable

sample

public void sample()
This method simulates a value of the probability distribution and assigns the value to the data distribution.


simulate

public double simulate()
This method simulates a value of the probability distribution, assigns the value to the data distribution, and returns the value.

Returns:
a simulated value from the distribution

reset

public void reset()
This method resets the data distribution.


getName

public java.lang.String getName()
This method gets the name of the random variable.

Returns:
the name of the variable

setName

public void setName(java.lang.String n)
This method assign a name to the random variable.

Parameters:
n - the name of the random variable