Menu

Function TPC_20

Tomy Duby

Purpose

This function starts the command line interface to Tail Probability Calculator.

It is also called by the TPC_10 function when submitting a tail probability calculation.

Arguments

  • cf ... is a cell structure of length n of function handles of characteristic functions. For more information see below in Notes
  • lambda ... is a vector of length n of coefficients of linear combination of random variables.
  • x ... can be a scalar or vector of real values at which to calculate the tail probability / cumulative distribution function (cdf) / probability density function (pdf) / quantile.
  • Optional arguments:
    • 'Tail' ... this optional argument tells the software what to calculate. It can have the following values:
      • true or 1 or 'tail'... to calculate the tail probability, this is also the default value (the last option is implemented in version 1.0);
      • false or '0' or 'cdf'... to calculate the cumulative distribution function;
      • 'pdf' ... to calculate the probability density function;
      • 'quant' ... to calculate quantile.

Notes

Currently Supported Classes of Random Variables

The following two classes of random variables are supported:

Class of Symmetric Random Variables with Support on the Whole Real Axis

The following random variables belong to this class:

  • Normal distribution with mean zero and standard deviation sigma > 0.
  • Student's t distribution with n degrees of freedom.
  • Symmetric uniform distribution with limits -b and b.
  • Symmetric triangular distribution with limits -b and b and centre point 0.

Class of Random Variables with Support on the Positive Real Axis

The following random variables belong to this class:

  • Central or non-central chi-squared distribution with n degrees of freedom and parameter of non-centrality ksi.
  • Inverse Gamma distribution with shape parameter alpha > 0 and location parameter beta > 0.

How TCP_20 accepts a linear combination of random variables from one class

The following rules must be followed:

  • The characteristic function of the linear combination of random variables must be a cell structure of characteristic functions of individual random variables.

  • The following random variables and their characteristic functions are currently recognized:

    • For symmetric random variables with support on the whole real axis:
      • Normal distribution: cf_normal( t, 0, sigma );
      • Student's t distribution: cf_t( t, nu );
      • Symmetric uniform distribution: cf_uniform( t, -b, b );
      • Symmetric triangular distribution: cf_triangular( t, -b, b, 0);
    • For random variables with support on the positive real axis:
      • Chi-squared distribution: cf_chi2( t, k, ksi );
      • Inverse Gamma distribution: cf_IGamma( t, alpha, beta );

Examples

The examples listed below can be copied and pasted into Matlab command window.

  • Example 1. Cumulative distribution function of chi-squared distribution with one degree of freedom at x = 3:

TPC_20({@(t) cf_chi2(t,1)}, 1, 3, 'Tail', false)
ans = 9.167354833364496e-01

  • Example 2. Probability density function of non-central chi-squared distribution with 2 degrees of freedom and non-centrality parameter of 2.48 at x = 6, 7, 8, 10:

>> x = [6, 7, 8, 10];
>> TPC_20({@(t) cf_chi2(t,2, 2.58)}, 1, x, 'Tail', 'pdf')
ans =
Columns 1 through 3
7.319096093357591e-02 5.834372874764804e-02 4.577441920575978e-02
Column 4
2.711995823274830e-02

  • Example 3. The above example when the parameters alpha and beta are variables. In this case it is necessary to build the characteristic function using Matlab function str2func (Matlab function mat2str converts a double precision number into a character string using the full 15 digit precision):

alpha = 1.5;
beta = 2.48;
x = [6, 7, 8, 10];
cf = str2func( ['@(t) cf_IGamma( t,', mat2str( alpha ), ',', mat2str( beta ), ' )'] );
TPC_20({cf}, 1, x, 'Tail', 'pdf')
ans =
Columns 1 through 3
3.305567795487787e-02 2.385190933151373e-02 1.785567710366216e-02
Column 4
1.087495701580865e-02

  • Example 4. Calculate the 0.995 quantile of a linear combination of random
    variables with the following distributions:
    • normal distribution with sigma = 3, coefficient of linear combination is 1, and
    • Student's t distribution with 4 degrees of freedom, coefficient of linear combination is 2:

cf = {@(t) cf_normal( t, 0, 3 ), @(t) cf_t( t, 4 )};
lambda = [1, 2];
TPC_20( cf, lambda, 0.995, 'Tail', 'quant' )
ans = 1.142603635872041e+01


Related

Wiki: Function TPC
Wiki: Home
Wiki: TPC Numerical Methods

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.