Packages

c

scalation.random

Trinomial

case class Trinomial(p: Double = 1.0/3.0, q: Double = 1.0/3.0, n: Int = 5, stream: Int = 0) extends Variate with Product with Serializable

This class generates Trinomial random variates. While Binomial is based on trials with two outcomes, success (1) or failure (0). Trinomial is based on trials with three outcomes, high (2), medium (1) or low (0). This discrete RV models the result of 'n' trials.

p

the probability of high (2)

q

the probability of medium (1)

n

the number of independent trials

stream

the random number stream

See also

onlinecourses.science.psu.edu/stat414/node/106 FIX - fails distribution test - maybe due to 'pf' method

Linear Supertypes
Serializable, Serializable, Product, Equals, Variate, Error, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Trinomial
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Variate
  7. Error
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Trinomial(p: Double = 1.0/3.0, q: Double = 1.0/3.0, n: Int = 5, stream: Int = 0)

    p

    the probability of high (2)

    q

    the probability of medium (1)

    n

    the number of independent trials

    stream

    the random number stream

Value Members

  1. def discrete: Boolean

    Determine whether the distribution is discrete or continuous.

    Determine whether the distribution is discrete or continuous.

    Definition Classes
    Variate
  2. final def flaw(method: String, message: String): Unit

    Show the flaw by printing the error message.

    Show the flaw by printing the error message.

    method

    the method where the error occurred

    message

    the error message

    Definition Classes
    Error
  3. def gen: Double

    Determine the next random number for the particular distribution.

    Determine the next random number for the particular distribution.

    Definition Classes
    TrinomialVariate
  4. def gen1(z: Double): Double

    Determine the next random number for the particular distribution.

    Determine the next random number for the particular distribution. This version allows one parameter.

    z

    the limit parameter

    Definition Classes
    TrinomialVariate
  5. def igen: Int

    Determine the next random integer for the particular distribution.

    Determine the next random integer for the particular distribution. It is only valid for discrete random variates.

    Definition Classes
    Variate
  6. def igen1(z: Double): Int

    Determine the next random integer for the particular distribution.

    Determine the next random integer for the particular distribution. It is only valid for discrete random variates. This version allows one parameter.

    z

    the limit parameter

    Definition Classes
    Variate
  7. val mean: Double
    Definition Classes
    TrinomialVariate
  8. val n: Int
  9. val p: Double
  10. def pf(k: Int, l: Int): Double
  11. def pf(y: Double, z: Double): Double
  12. def pf(z: Double): Double

    Compute the probability function (pf): Either (a) the probability density function (pdf) for continuous RV's or (b) the probability mass function (pmf) for discrete RV's.

    Compute the probability function (pf): Either (a) the probability density function (pdf) for continuous RV's or (b) the probability mass function (pmf) for discrete RV's.

    z

    the mass point whose probability density/mass is sought

    Definition Classes
    TrinomialVariate
  13. def pmf(k: Int): Array[Double]

    Return the entire probability mass function (pmf) for finite discrete RV's.

    Return the entire probability mass function (pmf) for finite discrete RV's.

    k

    number of objects of the first type

    Definition Classes
    TrinomialVariate
  14. val q: Double
  15. def sgen: String

    Determine the next random string for the particular distribution.

    Determine the next random string for the particular distribution. For better random strings, overide this method.

    Definition Classes
    Variate
  16. def sgen1(z: Double): String

    Determine the next random string for the particular distribution.

    Determine the next random string for the particular distribution. For better random strings, overide this method. This version allows one parameter.

    z

    the limit parameter

    Definition Classes
    Variate
  17. val stream: Int