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.
cf
... is a cell structure of length n
of function handles of characteristic functions. For more information see below in Noteslambda
... 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.'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.The following two classes of random variables are supported:
The following random variables belong to this class:
sigma > 0
.n
degrees of freedom. -b
and b
.-b
and b
and centre point 0
.The following random variables belong to this class:
n
degrees of freedom and parameter of non-centrality ksi
.alpha > 0
and location parameter beta > 0
. TCP_20
accepts a linear combination of random variables from one classThe 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:
cf_normal( t, 0, sigma )
;cf_t( t, nu )
;cf_uniform( t, -b, b )
;cf_triangular( t, -b, b, 0)
;cf_chi2( t, k, ksi )
;cf_IGamma( t, alpha, beta )
; The examples listed below can be copied and pasted into Matlab command window.
x
= 3:
TPC_20({@(t) cf_chi2(t,1)}, 1, 3, 'Tail', false)
ans = 9.167354833364496e-01
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
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
sigma
= 3, coefficient of linear combination is 1, and
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