Class RandomEx1

java.lang.Object
com.imsl.test.example.stat.RandomEx1
All Implemented Interfaces:
CdfFunction

public class RandomEx1 extends Object implements CdfFunction

Generates a pseudorandom sample from a normal distribution and performs a goodness of fit test.

In this example, a normal random sample of size 1000 is generated via Random.nextGaussian. Random.setSeed is first used to set the seed. After the ChiSquaredTest constructor is called, the random observations are added to the test one at a time to simulate streaming data. The Chi-squared test is performed using Cdf.normal as the cumulative distribution function object to see how well the random numbers fit the normal distribution.
See Also:
  • Constructor Details

    • RandomEx1

      public RandomEx1()
  • Method Details

    • cdf

      public double cdf(double x)
      Description copied from interface: CdfFunction
      Public interface for the user-supplied cumulative distribution function to be used by InverseCdf.
      Specified by:
      cdf in interface CdfFunction
      Parameters:
      x - a double scalar value representing the point at which the inverse CDF is desired.
      Returns:
      a double scalar value representing the probability that a random variable for this CDF takes a value less than or equal to this value is p.
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception