edu.ucla.stat.SOCR.distributions
Class RandomVariable

java.lang.Object
  extended by edu.ucla.stat.SOCR.distributions.RandomVariable

public class RandomVariable
extends java.lang.Object


Constructor Summary
RandomVariable(Distribution d)
          Special constructor: create a new random variable with a specified probability distribution and the name X
RandomVariable(Distribution d, java.lang.String n)
          General constructor: create a new random variable with a specified probability distribution and name
 
Method Summary
 Distribution getDistribution()
          Get the probability distribution
 IntervalData getIntervalData()
          Get the data distribution
 java.lang.String getName()
          Get the name of the random variable
 double getValue()
          Get the current value of the random variable
 void reset()
          Reset the data distribution
 void sample()
          Simulate a value of the probability distribution and assign the value to the data distribution
 void setDistribution(Distribution d)
          Assign the probability distribution and create a corresponding data distribution
 void setName(java.lang.String n)
          Assign a name to the random variable
 void setValue(double x)
          Assign a value to the random variable
 double simulate()
          Simulate a value of the probability distribution, assign the value to the data distribution and return 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)
General constructor: create a new random variable with a specified probability distribution and name


RandomVariable

public RandomVariable(Distribution d)
Special constructor: create a new random variable with a specified probability distribution and the name X

Method Detail

setDistribution

public void setDistribution(Distribution d)
Assign the probability distribution and create a corresponding data distribution


getDistribution

public Distribution getDistribution()
Get the probability distribution


getIntervalData

public IntervalData getIntervalData()
Get the data distribution


setValue

public void setValue(double x)
Assign a value to the random variable


getValue

public double getValue()
Get the current value of the random variable


sample

public void sample()
Simulate a value of the probability distribution and assign the value to the data distribution


simulate

public double simulate()
Simulate a value of the probability distribution, assign the value to the data distribution and return the value


reset

public void reset()
Reset the data distribution


getName

public java.lang.String getName()
Get the name of the random variable


setName

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