Chidf: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
imported>Bob
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
===Purpose===
===Purpose===
Chi-squared distribution.
Chi-squared distribution.
===Synopsis===
===Synopsis===
:prob = chidf(function,x,a)
:prob = chidf(function,x,a)
===Description===
===Description===
Estimates cumulative distribution function (cumulative, cdf), probability density function (density, pdf), quantile (inverse of cdf), or random numbers for a Chi-sqared distribution.  
Estimates cumulative distribution function (cumulative, cdf), probability density function (density, pdf), quantile (inverse of cdf), or random numbers for a Chi-sqared distribution.  
The chi-squared distribution usually models data that are positive (such as the sum of physical measurements). With integer degrees of freedom parameter v, it is equal to the sum of v normally distributed variates. This toolbox does not require that the degrees of freedom be integral and will ignore negative values in a sample. Chi-squared distributions have variance equal to twice the mean.
The chi-squared distribution usually models data that are positive (such as the sum of physical measurements). With integer degrees of freedom parameter v, it is equal to the sum of v normally distributed variates. This toolbox does not require that the degrees of freedom be integral and will ignore negative values in a sample. Chi-squared distributions have variance equal to twice the mean.
 
====INPUTS====
::<math>f(x) = \frac {x^{\left (a-2 \right)/2 }\, exp \left( -x/2 \right)} {2^{a/2}\, \Gamma \left (a/2 \right )}</math>
 
====Inputs====
 
* '''function''' =  [ {'cumulative'} | 'density' | 'quantile' | 'random' ], defines the functionality to be used. Note that the function recognizes the first letter of each string so that the string could be: [ 'c' | 'd' | 'q' | 'r' ].
* '''function''' =  [ {'cumulative'} | 'density' | 'quantile' | 'random' ], defines the functionality to be used. Note that the function recognizes the first letter of each string so that the string could be: [ 'c' | 'd' | 'q' | 'r' ].
* '''x''' = matrix in which the sample data is stored, in the interval (0,inf).  
* '''x''' = matrix in which the sample data is stored, in the interval (0,inf).  
*  '''for''' function=quantile - matrix with values in the interval (0,1).
 
*  '''for''' function=random - vector indicating the size of the random matrix to create.
:: for function=quantile - matrix with values in the interval (0,1).
:: for function=random - vector indicating the size of the random matrix to create.
 
* '''a''' = degrees of freedom parameter (positive integer).
* '''a''' = degrees of freedom parameter (positive integer).
'''Note''': If inputs (x, a, and b) are not equal in size, the function will attempt to resize all inputs to the largest input using the RESIZE function.  
'''Note''': If inputs (x, a, and b) are not equal in size, the function will attempt to resize all inputs to the largest input using the RESIZE function.  
'''Note''': Functions will typically allow input values outside of the acceptable range to be passed but such values will return NaN in the results.
'''Note''': Functions will typically allow input values outside of the acceptable range to be passed but such values will return NaN in the results.
===Examples===
===Examples===
====Cumulative:====
 
>> prob = chidf('c',[3.7942 4.6052],2)
====Cumulative====
 
<pre>>> prob = chidf('c',[3.7942 4.6052],2)
prob =
prob =
     0.8500    0.9000
     0.8500    0.9000
>> x = 0:0.1:8;
>> x = 0:0.1:8;
>> plot(x,chidf('c',x,2),'b',x,chidf('c',x,0.5),'r')
>> plot(x,chidf('c',x,2),'b',x,chidf('c',x,0.5),'r')</pre>
====Density:====
 
>> prob = chidf('d',[3.7942 4.6052],2)
====Density====
 
<pre>>> prob = chidf('d',[3.7942 4.6052],2)
prob =
prob =
     0.0750    0.0500
     0.0750    0.0500
>> x = 0:0.1:8;
>> x = 0:0.1:8;
>> plot(x,chidf('d',x,2),'b',x,chidf('d',x,0.5),'r')
>> plot(x,chidf('d',x,2),'b',x,chidf('d',x,0.5),'r')</pre>
====Quantile:====
 
>> prob = chidf('q',[0.85 0.9],2)
====Quantile====
 
<pre>>> prob = chidf('q',[0.85 0.9],2)
prob =
prob =
     3.7942    4.6052
     3.7942    4.6052</pre>
====Random:====
 
>> prob = chidf('r',[4 1],2)
====Random====
 
<pre>>> prob = chidf('r',[4 1],2)
prob =
prob =
     0.1023
     0.1023
Line 39: Line 62:
     0.9990
     0.9990
     1.4432
     1.4432
</pre>
===See Also===
===See Also===
[[betadr]], [[cauchydf]], [[expdf]], [[gammadf]], [[gumbeldf]], [[laplacedf]], [[logisdf]], [[lognormdf]], [[normdf]], [[paretodf]], [[raydf]], [[triangledf]], [[unifdf]], [[weibulldf]]
[[betadr]], [[cauchydf]], [[expdf]], [[gammadf]], [[gumbeldf]], [[laplacedf]], [[logisdf]], [[lognormdf]], [[normdf]], [[paretodf]], [[raydf]], [[triangledf]], [[unifdf]], [[weibulldf]]

Latest revision as of 06:04, 10 October 2008

Purpose

Chi-squared distribution.

Synopsis

prob = chidf(function,x,a)

Description

Estimates cumulative distribution function (cumulative, cdf), probability density function (density, pdf), quantile (inverse of cdf), or random numbers for a Chi-sqared distribution.

The chi-squared distribution usually models data that are positive (such as the sum of physical measurements). With integer degrees of freedom parameter v, it is equal to the sum of v normally distributed variates. This toolbox does not require that the degrees of freedom be integral and will ignore negative values in a sample. Chi-squared distributions have variance equal to twice the mean.

Inputs

  • function = [ {'cumulative'} | 'density' | 'quantile' | 'random' ], defines the functionality to be used. Note that the function recognizes the first letter of each string so that the string could be: [ 'c' | 'd' | 'q' | 'r' ].
  • x = matrix in which the sample data is stored, in the interval (0,inf).
for function=quantile - matrix with values in the interval (0,1).
for function=random - vector indicating the size of the random matrix to create.
  • a = degrees of freedom parameter (positive integer).

Note: If inputs (x, a, and b) are not equal in size, the function will attempt to resize all inputs to the largest input using the RESIZE function.

Note: Functions will typically allow input values outside of the acceptable range to be passed but such values will return NaN in the results.

Examples

Cumulative

>> prob = chidf('c',[3.7942 4.6052],2)
prob =
    0.8500    0.9000
>> x = 0:0.1:8;
>> plot(x,chidf('c',x,2),'b',x,chidf('c',x,0.5),'r')

Density

>> prob = chidf('d',[3.7942 4.6052],2)
prob =
    0.0750    0.0500
>> x = 0:0.1:8;
>> plot(x,chidf('d',x,2),'b',x,chidf('d',x,0.5),'r')

Quantile

>> prob = chidf('q',[0.85 0.9],2)
prob =
     3.7942    4.6052

Random

>> prob = chidf('r',[4 1],2)
prob =
    0.1023
    2.9295
    0.9990
    1.4432

See Also

betadr, cauchydf, expdf, gammadf, gumbeldf, laplacedf, logisdf, lognormdf, normdf, paretodf, raydf, triangledf, unifdf, weibulldf