Class StudentT

    • Field Detail

      • defaultT

        public static final StudentT defaultT
        A default instance for easily computing Student-T values
    • Constructor Detail

      • StudentT

        public StudentT()
        Constructs a StudentT distribution with 1.0 degree of freedom
      • StudentT

        public StudentT​(double[] parameters)
        Constructs a StudentT distribution with parameters[0] = degrees of freedom
        Parameters:
        parameters - An array with the degrees of freedom
      • StudentT

        public StudentT​(double dof)
        Constructs a StudentT distribution dof degrees of freedom
        Parameters:
        dof - degrees of freedom
      • StudentT

        public StudentT​(double dof,
                        java.lang.String name)
        Constructs a StudentT distribution dof degrees of freedom
        Parameters:
        dof - degrees of freedom
        name - an optional name/label
    • Method Detail

      • setDegreesOfFreedom

        public final void setDegreesOfFreedom​(double dof)
        Sets the degrees of freedom for the distribution
        Parameters:
        dof - must be >= 1.0
      • getDegreesOfFreedom

        public final double getDegreesOfFreedom()
        Returns:
        the degrees of freedom
      • getIntervalFactor

        public final double getIntervalFactor()
        Used in the binary search to set the search interval for the inverse CDF. The default addFactor is 6.0 The interval will be: start = Normal.stdNormalInvCDF(p) ll = start - getIntervalFactor()*getStandardDeviation(); ul = start + getIntervalFactor()*getStandardDeviation();
        Returns:
        the factor
      • setIntervalFactor

        public final void setIntervalFactor​(double factor)
        Used in the binary search to set the search interval for the inverse CDF. The default addFactor is 6.0 The interval will be: start = Normal.stdNormalInvCDF(p) ll = start - getIntervalFactor()*getStandardDeviation(); ul = start + getIntervalFactor()*getStandardDeviation();
        Parameters:
        factor - the factor
      • setParameters

        public void setParameters​(double[] parameters)
        Description copied from interface: ParametersIfc
        Sets the parameters
        Specified by:
        setParameters in interface ParametersIfc
        Parameters:
        parameters - an array of doubles representing the parameters
      • getParameters

        public double[] getParameters()
        Description copied from interface: ParametersIfc
        Gets the parameters
        Specified by:
        getParameters in interface ParametersIfc
        Returns:
        Returns an array of the parameters
      • getMean

        public double getMean()
        Description copied from interface: MeanIfc
        Returns the mean or expected value of a distribution
        Specified by:
        getMean in interface MeanIfc
        Returns:
        double the mean or expected value for the distribution
      • getVariance

        public double getVariance()
        Description copied from interface: VarianceIfc
        Returns the variance of the distribution if defined
        Specified by:
        getVariance in interface VarianceIfc
        Returns:
        double the variance of the random variable
      • pdf

        public double pdf​(double x)
        Description copied from interface: PDFIfc
        Returns the f(x) where f represents the probability density function for the distribution. Note this is not a probability.
        Specified by:
        pdf in interface PDFIfc
        Parameters:
        x - a double representing the value to be evaluated
        Returns:
        f(x)
      • getCDF

        public static double getCDF​(double dof,
                                    double x)
        A convenience method that uses defaultT to return the value of the CDF at the supplied x This method has the side effect of changing the degrees of freedom defaultT
        Parameters:
        dof - the degrees of freedom
        x - the value to evaluate
        Returns:
        the CDF value
      • getInvCDF

        public static double getInvCDF​(double dof,
                                       double p)
        A convenience method that uses defaultT to return the value of the inverse CDF at the supplied p This method has the side effect of changing the degrees of freedom for defaultT
        Parameters:
        dof - the degrees of freedom
        p - the value to evaluate
        Returns:
        the inverse
      • cdf

        public double cdf​(double x)
        Description copied from interface: CDFIfc
        Returns the F(x) = Pr{X <= x} where F represents the cumulative distribution function
        Specified by:
        cdf in interface CDFIfc
        Parameters:
        x - a double representing the upper limit
        Returns:
        a double representing the probability
      • invCDF

        public double invCDF​(double p)
        Description copied from interface: InverseCDFIfc
        Provides the inverse cumulative distribution function for the distribution While closed form solutions for the inverse cdf may not exist, numerical search methods can be used to solve F(X) = U.
        Specified by:
        invCDF in interface InverseCDFIfc
        Parameters:
        p - The probability to be evaluated for the inverse, p must be [0,1] or an IllegalArgumentException is thrown
        Returns:
        The inverse cdf evaluated at the supplied probability