complexType "ssj:RandomVariateGenParams"
Namespace:
Content:
simple, 6 attributes
Defined:
globally in ssj.xsd, see XML source
Includes:
definitions of 6 attributes
Used:
XML Representation Summary
<...
    distributionClass
 = 
xsd:string
    estimateParameters
 = 
xsd:boolean : "false"
    generatorClass
 = 
xsd:string
    lowerBound
 = 
xsd:double
    shift
 = 
xsd:double
    upperBound
 = 
xsd:double
    >
   
Content: 
{ list of xsd:double }
</...>
All Direct / Indirect Based Elements (7):
Known Usage Locations
Annotation
Gives parameters for a probability distribution and a random number generator constructed using SSJ. The probability distribution is defined by a distribution class, and an array of numerical parameters called the data array while the random variate generator is defined by a distribution, and a generator class. The type of random stream used to generate the uniforms from which variates are obtained is supplied by the application, and can be configured through simulation parameters. Generated values may also be truncated on a given interval, and shifted by a certain amount, by using the appropriate attributes. Most parameters are given through attributes, except the data array which is given as nested text.

More specifically, when constructing an object representing a distribution, the application first finds a Java class corresponding to the name given by the distributionClass attribute. The found distribution class is then scanned as follows in order to look for a suitable constructor accepting the data array. If the estimateParameters attribute is false or unset, the application examines the distribution class to find a constructor taking an array of double-precision values, and calls this constructor with the data array. If no such constructor exists, the application looks for a constructor taking the same number of numerical parameters than the length of the data array, and tries to call it. The input double-precision values are converted to the appropriate types for calling the constructor. If a conversion to integer is needed, the decimals in the concerned input value are truncated.

On the other hand, if estimateParameters is set to true, the input array is treated as an array of observations used for parameter estimation. For this, a static method named getInstanceFromMLE is looked for and called in the distribution class. The exact scheme for parameter estimation depends on the distribution class used.

After the distribution is constructed, the application may also create a random variate generator. By default, generators use inversion, but this can be overridden by setting an alternate generator class through the generatorClass attribute. The lowerBound and upperBound attributes may also be use to set truncation parameters while the shift attribute is used to set the shift subtracted to each generated value. Note that one must use inversion for a truncated distribution.

See the documentation of SSJ's umontreal.iro.lecuyer.probdist package for the available distributions, and their parameters. See also umontreal.iro.lecuyer.randvar for the available generators.

An instance of the class derived by JAXB from this complex type can be converted into SSJ objects using methods in the ParamReadHelper class. More specifically, the createBasicDistribution method creates a Distribution object without considering shifting and truncation. The createTruncatedDist method creates the truncated distribution from the basic distribution. The createGenerator method creates random variate generators from parameters, and possibly the distribution object.

For example, let rvg be an element representing a probability distribution. For an exponential distribution with mean 1/10, one uses

<rvg distributionClass="ExponentialDist">
   10</rvg>
            

When creating the distribution, an application finds the distribution class ExponentialDist in package umontreal.iro.lecuyer.probdist. According to the documentation of SSJ, this class does not provide a constructor taking an array of double-precision values. However, it has a constructor taking one argument corresponding to the inverse of the mean. As a result, the nested text of rvg contains the desired rate, 10, for a mean of 1/10.

For a gamma distribution with shape parameter 20, scale parameter 2, and mean 10, one has to use the GammaDist class instead of ExponentialDist. The documentation of this class indicates that it defines a constructor taking the shape and scale parameters, so the array of data will contain the parameters. This results in the following XML code.

               <rvg distributionClass="GammaDist">20 2</rvg>
            

However, generating gamma variates using inversion is slow. One can alternatively use acceptance-rejection by adding the attribute generatorClass="GammaAcceptanceRejectionGen" to rvg.

Suppose now that we wish to have random variates following a normal distribution truncated to positive numbers. The corresponding rvg looks as follows.

               <rvg distributionClass="NormalDist"
               lowerBound="0">10 5</rvg>
            

In this example, we select the NormalDist distribution which has a constructor taking the mean and the variance. Using the input array, we then specify a mean of 10, and a variance of 5. Using the lowerBound attribute, we then restrict our normal distribution to positive numbers.

Suppose now that we have 100 observations and we suspect their distribution to be gamma. We can then use the estimateParameters attribute as follows for parameters to be estimated via maximum likelihood.

               <rvg distributionClass="GammaDist"
               generatorClass="GammaAcceptanceRejectionGen"
               estimateParameters="true"> 13.583 38.350 36.988
               174.782 25.055 76.227 65.542 43.937 14.617 140.998 85.697
               52.774 39.501 27.493 94.177 234.529 35.521 3.475 339.398
               15.490 140.056 20.032 8.392 24.555 113.580 21.363 74.357
               23.090 97.026 146.662 219.492 211.232 185.475 129.586
               70.093 8.275 4.256 270.992 380.576 65.159 88.477 111.913
               0.202 284.074 49.649 80.090 128.229 109.601 14.614 77.179
               8.003 156.671 29.713 17.353 62.487 9.279 18.595 111.629
               147.295 100.060 55.822 217.506 10.113 315.508 45.521
               150.381 140.569 29.204 187.779 121.608 95.364 117.455
               255.000 159.561 130.894 100.282 97.153 60.966 72.697
               218.799 177.292 70.690 72.737 37.344 106.093 20.325
               90.501 117.777 201.008 13.961 14.421 238.566 16.629
               27.469 186.505 154.357 281.944 4.212 36.368
               142.395</rvg>
            

These values were obtained by generating 100 i.i.d. exponentials with 100. This corresponds to the gamma distribution with shape parameter 1 and scale parameter 1/100.

Type Definition Detail
Type Derivation Tree
xsd:double
  ssj:doubleList (list)
      ssj:RandomVariateGenParams (extension)
Derivation:
extension of ssj:doubleList
XML Source (w/o annotations (7); see schema source)
<xsd:complexType name="RandomVariateGenParams">
<xsd:simpleContent>
<xsd:extension base="ssj:doubleList">
<xsd:attribute name="distributionClass" type="xsd:string">
</xsd:attribute>
<xsd:attribute name="generatorClass" type="xsd:string">
</xsd:attribute>
<xsd:attribute name="shift" type="xsd:double">
</xsd:attribute>
<xsd:attribute name="lowerBound" type="xsd:double">
</xsd:attribute>
<xsd:attribute name="upperBound" type="xsd:double">
</xsd:attribute>
<xsd:attribute default="false" name="estimateParameters" type="xsd:boolean">
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
Attribute Detail
distributionClass
Gives the class name of the selected probability distribution. The given class must be an implementation of the umontreal.iro.lecuyer.probdist.Distribution interface, and determines the number and use of parameters. If the given class name is not fully qualified, a search for the distribution class is made in the umontreal.iro.lecuyer.probdist package. For example, setting this attribute to ExponentialDist, or umontreal.iro.lecuyer.probdist.ExponentialDist is equivalent.
Type:
xsd:string
Use:
optional
Defined:
locally, within (this) ssj:RandomVariateGenParams complexType
<xsd:attribute name="distributionClass" type="xsd:string">
</xsd:attribute>

estimateParameters
Determines if parameter estimation needs to be performed.
Type:
xsd:boolean
Use:
optional
Default:
"false"
Defined:
locally, within (this) ssj:RandomVariateGenParams complexType
<xsd:attribute default="false" name="estimateParameters" type="xsd:boolean">
</xsd:attribute>

generatorClass
Gives the class name of the random variate generator. The given class must be an implementation of the umontreal.iro.lecuyer.randvar.RandomVariateGen class, and determines the method used to generate variates. If the given class name is not fully qualified, a search for the generator class is made in the umontreal.iro.lecuyer.randvar package. For example, setting this attribute to GammaAcceptanceRejectionGen, or umontreal.iro.lecuyer.randvar.GammaAcceptanceRejectionGen is equivalent. By default, the basic RandomVariateGen class is used for all distributions, except discrete distributions over the integers. In the latter case, RandomVariateGenInt is used.
Type:
xsd:string
Use:
optional
Defined:
locally, within (this) ssj:RandomVariateGenParams complexType
<xsd:attribute name="generatorClass" type="xsd:string">
</xsd:attribute>

lowerBound
Gives the lower bound of the distribution, i.e., the lowest value that can be generated from it. If this attribute is given without the complementary upperBound attribute, the upper bound is assumed to be infinite. If both attributes are omitted, the distribution is not truncated.
Type:
xsd:double
Use:
optional
Defined:
locally, within (this) ssj:RandomVariateGenParams complexType
<xsd:attribute name="lowerBound" type="xsd:double">
</xsd:attribute>

shift
Gives the shift which is subtracted to any value generated by the random variate generator. The shift is also added to all observations when performing parameter estimation.
Type:
xsd:double
Use:
optional
Defined:
locally, within (this) ssj:RandomVariateGenParams complexType
<xsd:attribute name="shift" type="xsd:double">
</xsd:attribute>

upperBound
Gives the upper bound of the distribution, i.e., the highest value that can be generated from it.
Type:
xsd:double
Use:
optional
Defined:
locally, within (this) ssj:RandomVariateGenParams complexType
<xsd:attribute name="upperBound" type="xsd:double">
</xsd:attribute>

XML Schema documentation generated with DocFlex/XML (Kit) v1.6.8
DocFlex/XML (Kit) is a freeware edition of DocFlex/XML, which is a powerful template-driven documentation and report generator from any data stored in XML files. Based on an innovative technology developed by FILIGRIS WORKS, this new tool offers virtuoso data querying and formatting capabilities not found in anything else!
Need to convert your XML data into a clear nice-looking documentation or reports? Web-ready hypertext HTML or printable MS Word / OpenOffice.org friendly RTF? DocFlex/XML may be a cheap, quick and effective solution exactly for this task!
Have questions? Not sure how to use it? Just send us e-mail to contact@filigris.com and we are always happy to help you! See also our services at www.filigris.com