{ From user Lonnie, Model Untitled at Wed, Sep 05, 2007 3:32 PM}
Softwareversion 4.0.0
Linklibrary Data_stats_lib5
Title: Data Statistics Library
Description: This library contains functions for calculating statistic~~
al quantities for numerical data over an explicit index other than Ru~~
n. ~
~
The function names match those in the Statistics library, with _d app~~
ended, and with an extra second index parameter. They are generally ~~
equivalent when the sample(data) is used for the first parameter and ~~
Run is used for the second, e.g., ~
~
SDeviation_d(sample(data),Run)~
is equivalent to~
SDeviation(data)~
~
*** This library is obsolete in Analytica 3.2 and later ***~
Built-in statistical functions can now be used over a specified runni~~
ng index. For example: SDeviation( data, J )
Author: Lonnie Chrisman & Max Henrion~
~
An earlier version of this library was written by George Ferguson, an~~
d iis included in the Legacy submodule for backward compatibility.
Date: Wed, May 3, 1995 10:39 AM
Saveauthor: Lonnie
Savedate: Wed, Sep 05, 2007 3:32 PM
Defaultsize: 48,24
Nodesize: 48,32
Nodeinfo: 1,1,0,1,1,1,0,0,0,0
Diagstate: 1,24,14,706,525,17
Windstate: 2,356,108,611,548
Nodecolor: 19661,33649,65535
Fileinfo: 0,Linklibrary Data_stats_lib5,2,2,0,0,C:\Src\AnalyticaDevelo~~
pment\Analytica\ExecDebug\Libraries\Data Statistics Library.ana
Module Data_statistics_exam
Title: Data Statistics Examples
Description: This module includes a sample list of numbers, and an exa~~
mple for each of the functions.
Author: lynda
Date: Thu, Feb 15, 1996 10:20 AM
Defaultsize: 48,24
Nodelocation: 272,256,1
Nodesize: 48,32
Diagstate: 1,425,173,661,581,17
Nodecolor: 19661,33649,65535
Variable Demo_of_mean_d
Title: Mean
Description: Example of the meand function.
Definition: Mean_d( Ex_data_X, Ex_Sample_Index)
Nodelocation: 224,32,1
Nodesize: 52,24
Valuestate: 1,72,82,224,138,0,MIDM
Variable Demo_of_variance_d
Title: Variance
Description: Example of the Varianced function.
Definition: Variance_d( Ex_data_X, Ex_Sample_Index )
Nodelocation: 224,88,1
Nodesize: 52,24
Valuestate: 1,88,98,224,138,0,MIDM
Variable Demo_of_sdeviation_d
Title: Standard Deviation
Description: Example of the Sdeviationd function.
Definition: Sdeviation_d( Ex_data_X, Ex_Sample_Index )
Nodelocation: 360,88,1
Nodesize: 52,24
Valuestate: 1,207,189,224,138,0,MIDM
Variable Demo_of_kurtosis_d
Title: Kurtosis
Description: Example of the Kurtosisd function.
Definition: Kurtosis_d( Ex_data_X, Ex_Sample_Index)
Nodelocation: 360,144,1
Nodesize: 52,24
Valuestate: 1,120,130,224,138,0,MIDM
Variable Demo_of_skewness_d
Title: Skewness
Description: Example of the Skewnessd function.
Definition: Skewness_d( Ex_data_X, Ex_Sample_Index)
Nodelocation: 224,144,1
Nodesize: 52,24
Valuestate: 1,136,146,224,138,0,MIDM
Index Ex_sample_index
Title: Ex Sample Index
Definition: 1..20
Nodelocation: 64,56,1
Nodesize: 48,24
{!40000|Att_previndexvalue: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17~~
,18,19,20]}
Variable Ex_data_x
Title: Ex Data X
Definition: Table(Ex_sample_index)(~
-0.899999999999999,-8.3,-9.3,-1.9,8.9,-8.7,-7.9,-7.1,-5.3,-4.7,3.9,2.~~
9,-7.3,-7.7,-4.3,2.1,5.1,7.9,-3.5,-9.5)
Nodelocation: 80,120,1
Nodesize: 48,24
Defnstate: 2,384,196,433,527,0,MIDM
Variable Ex_data_y
Title: Ex Data Y
Definition: Table(Ex_sample_index)(~
6.3,-2.9,-3.1,-0.699999999999999,1.7,3.1,-6.7,-0.0999999999999979,-4.~~
9,-3.7,1.5,4.5,-5.1,0.0999999999999979,2.3,9.5,0.899999999999999,-1.3~~
,-2.5,-6.9)
Nodelocation: 80,224,1
Nodesize: 48,24
Variable Demo_correlation_d
Title: Correlation
Definition: Correlation_d(Ex_Data_X,Ex_Data_Y,Ex_Sample_Index)
Nodelocation: 224,256,1
Nodesize: 52,24
Variable Demo_rank_correl_d
Title: RankCorrel
Definition: RankCorrel_d(Ex_Data_X,Ex_Data_Y,Ex_Sample_Index)
Nodelocation: 360,256,1
Nodesize: 52,24
Valuestate: 2,404,89,380,204,0,MIDM
Variable Demo_of_getfract_d
Title: GetFract
Definition: index fractile := [0.10,0.25,0.50,0.75,0.90] Do~
getfract_d(Ex_Data_X,Ex_Sample_Index,fractile)
Nodelocation: 360,32,1
Nodesize: 52,24
Windstate: 2,134,269,476,224
Variable Demo_probability_d
Title: Probability
Definition: Probability_d(Ex_Data_X > Ex_Data_Y,Ex_Sample_Index)
Nodelocation: 360,200,1
Nodesize: 52,24
Windstate: 2,141,470,476,224
Variable Demo_of_covar_d
Title: CoVar
Definition: CoVar_d(Ex_Data_X,Ex_Data_Y,Ex_Sample_Index)
Nodelocation: 224,200,1
Nodesize: 52,24
Close Data_statistics_exam
Module Legacy_versions_of_d
Title: Legacy Versions of Data Statistics
Description: This module contains versions of the data statistics func~~
tions that were included in the Data Statistics Library pre-Analytica~~
3.0 releases. They are still included here for backward compatibilit~~
y. They are harder to use, especially in an array-abstractable fashi~~
on, than the newer ones, since they require the data to be in a vecto~~
r (un-indexed) form. The newer replacement functions require the sam~~
pling index to be explictly given as a parameter. [Lonnie]~
~
This library contains functions for calculating statistical quantitie~~
s for numerical data (i.e. a list of numbers): the Mean, Standard Dev~~
iation, Kurtosis, Skewness, and Variance.~
~
Since these functions will only give understandable results for a li~~
st of numbers (a one-dimensional array), arrays of greater than one d~~
imension should be converted to a one-dimensional array before perfor~~
ming these functions on them. The "Slice" and "Sum" functions can be~~
used for reducing a multi-dimensional array to one dimension. For ex~~
ample, to find the mean of a 2-dimensional numerical Array: Meand(su~~
m(Array))~
Consult the Analytica User's Guide for information on the Slice and S~~
um functions.
Author: George Ferguson
Date: Tue, Sep 02, 2003 4:00 PM
Defaultsize: 48,24
Nodelocation: 448,304,1
Nodesize: 60,36
Diagstate: 1,453,104,550,300,17
Windstate: 2,233,241,502,565
Nodecolor: 19661,33649,65535
Function Meand(Data:Vector)
Title: Mean of Data
Description: Deprecated. Use Mean_d instead.~
~
Computes the mean (average) value of an list of numeric values. ~
(The system "Mean" function returns the mean of a single *probabalist~~
ic* variable.)~
~
If the data list has N elements, the formula is Meand = (sum(Data))/N~~
.
Definition: (sum(Data))/(size(Data))
Nodelocation: 72,48,0
Nodesize: 44,24
Windstate: 2,102,90,677,432
Nodecolor: 0,-13108,-13108
Paramnames: Data
Function Sdeviationd(Data:Vector)
Title: Std Deviation of Data
Description: Deprecated. Use SDeviation_d instead.~
~
Computes the Standard Deviation of Data (a list of numbers).~
If the data list has N elements, the formula is Standard Deviation(Da~~
ta) = sqrt(sum(sqr(Data-Mean(Data)))/(N -1)).
Definition: Sqrt((Sum(Sqr((Data-Meand(Data))))/(Size(Data)-1)))
Nodelocation: 176,48,0
Nodesize: 44,24
Nodecolor: 0,-13108,-13108
Paramnames: Data
Function Skewnessd(Data:Vector)
Title: Skewness of Data
Description: Deprecated. Use Skewness_d instead.~
~
This statistical function measures the asymmetry of Data consisting o~~
f a list of numbers-- i.e., how equally distributed the values are ab~~
out their collective mean. Positive skewness indicates a distributio~~
n with an asymmetric tail extending towards more positive values, neg~~
ative the contrary.~
If the data list has N elements, the formula is Skewness(Data) = sum(~~
((Data - Mean(Data))/StdDev(Data))^3)/(N)
Definition: (Sum((((Data-Meand(Data))/Sdeviationd(Data))^3))/Size(Data~~
))
Nodelocation: 288,48,0
Nodesize: 44,24
Nodecolor: 0,-13108,-13108
Paramnames: Data
Function Kurtosisd(Data:Vector)
Title: Kurtosis of Data
Description: Deprecated. Use Kurtosis_d instead.~
~
Returns the Kurtosis of Data consisting of a list of numbers. A meas~~
ure of the boxiness of a distribution, Kurtosis characterizes the rel~~
ative peakedness or flatness of a distribution relative to the normal~~
distribution. ~
Positive kurtosis indicates a distribution with relatively more conce~~
ntration in a central peak. Negative kurtosis indicates a relatively~~
flat distribution.~
~
Likewise, A distribution with long thin tails has a positive kurtosis~~
. A distribution with short tails and high shoulders (such as the n~~
ormal distribution) has a negative kurtosis.
Definition: ((Sum((((Data-Meand(Data))/Sdeviationd(Data))^4))/Size(Dat~~
a))-3)
Nodelocation: 296,112,0
Nodesize: 44,24
Windstate: 2,149,12,476,224
Nodecolor: 0,-13108,-13108
Paramnames: Data
Function Varianced(Data:Vector)
Title: Variance of Data
Description: Deprecated. Use Variance_d instead.~
~
This function calculates the variance of data consisting of a list of~~
numerical values (i.e. a one-dimensional array).~
If the data list has N elements, the formula is Variance(Data) = sum~~
(sqr(Data-Mean(Data)))/(N -1).
Definition: Sqr(Sdeviationd(Data))
Nodelocation: 176,112,0
Nodesize: 44,24
Nodecolor: 0,-13108,-13108
Paramnames: Data
Close Legacy_versions_of_d
Function Variance_d(d; i: IndexType)
Title: Variance_d(d, i)
Description: Estimates the variance of data d over index i.
Definition: Sum((d -Average(d, i)) ^2, i) / (Size(i)-1)
Nodelocation: 112,80,1
Nodesize: 76,16
Windstate: 2,647,316,476,224
Paramnames: d,i
Function Mean_d(d; i: IndexType)
Title: Mean_d(d, i)
Description: Computes the mean of data d over index i.
Definition: ::Average(d,i)~
Nodelocation: 112,40,1
Nodesize: 76,16
Windstate: 2,589,79,476,224
Paramnames: d,i
Function Covar_d(d1, d2; i: IndexType)
Title: Covar_d(d1, d2, i)
Description: Estimates the covariance of variables d1 and d2 over inde~~
x i. d1 and d2 should be indexed by i.
Definition: Sum((d1 - Mean_d(d1, i)) * (d2 - Mean_d(d2, i)), i)/ (Size~~
(i) - 1)
Nodelocation: 296,40,1
Nodesize: 88,16
Paramnames: d1,d2,i
Function Correlation_d(d1, d2; i: IndexType)
Title: Correlation_d(d1, d2, i)
Description: Computes the correlation (Pearson Product moment coeffici~~
ent) between variables d1 and d2 over index i. ~
d1 and d2 should be indexed by i.
Definition: Covar_d(d1, d2, i) /~
(Sqrt(Variance_d(d1, i) * Variance_d(d2, i)) )
Nodelocation: 296,80,1
Nodesize: 88,16
Windstate: 2,652,130,492,351
Paramnames: d1,d2,i
Function Sdeviation_d(d; i: IndexType)
Title: Sdeviation_d(d, i)
Description: Estimates the standard deviation of data d over index i.
Definition: Sqrt(Variance_d(d, i))
Nodelocation: 112,120,1
Nodesize: 80,16
Windstate: 2,664,123,476,224
Paramnames: d,i
Function Skewness_d(d; i: IndexType)
Title: Skewness_d(d, i)
Description: Estimates the skewness of data d over index i.~
~
This statistical function measures the asymmetry of d along dimension~~
i -- i.e., how equally distributed the values are about their collec~~
tive mean. Positive skewness indicates a distribution with an asymme~~
tric tail extending towards more positive values, negative the contra~~
ry.~
Definition: Mean_d((d - Mean_d(d, i))^3, i)/ Variance_d(d, i)^1.5
Nodelocation: 112,160,1
Nodesize: 80,16
Paramnames: d,i
Function Kurtosis_d(d; i: IndexType)
Title: Kurtosis_d(d, i)
Description: Estimates the kurtosis of data d over index i.~
~
Kurtosis is a measure of the boxiness of a distribution and character~~
izes the relative peakedness or flatness of a distribution relative t~~
o the normal distribution. ~
Positive kurtosis indicates a distribution with relatively more conce~~
ntration in a central peak. Negative kurtosis indicates a relatively~~
flat distribution.~
~
Likewise, A distribution with long thin tails has a positive kurtosis~~
. A distribution with short tails and high shoulders (such as the n~~
ormal distribution) has a negative kurtosis.
Definition: Mean_d((d - Mean_d(d, i))^4, i)/ Variance_d(d, i)^2 - 3
Nodelocation: 112,200,1
Nodesize: 80,16
Paramnames: d,i
Function Rankcorrel_d(d1, d2; i: IndexType)
Title: RankCorrel_d(d1, d2, i)
Description: Computes the rank-order correlation (Spearman's rank corr~~
elation coefficient) between variables d1 and d2 over index i. ~
d1 and d2 should be indexed by i.~
~
It is computed as the correlation of the ranks of the variables over ~~
i.
Definition: Correlation_d( Rank(d1, i), Rank(d2, i), i)
Nodelocation: 296,120,1
Nodesize: 88,16
Windstate: 2,36,13,492,351
Paramnames: d1,d2,i
Function Getfract_d(d; i: IndexType; p)
Title: Getfract_d(d, i, p)
Description: Estimates the pth fractile (quantile or 100p'th percentil~~
e) from data d over index i. ~
~
It corresponds with built-in function GetFract(x, p) but allows an ar~~
bitrary index i for d, instead of insisting on index Run.
Definition: USING probVals := Array(i, Sequence(0, Size(i)-1)/(Size(i)~~
-1) ) DO~
USING dsorted := d[i=SortIndex(d, i)] DO~
Linearinterp(probVals, dsorted, p, i)
Nodelocation: 112,240,1
Nodesize: 80,16
Windstate: 2,650,40,492,351
Paramnames: d,i,p
Function Probability_d(d; i: IndexType)
Title: Probability_d(d, i)
Description: Computes the fraction of elements that are true (not equa~~
l zero) of array d over index i.
Definition: Sum(d<>0, i) / Size(i)~
Nodelocation: 112,280,1
Nodesize: 80,16
Paramnames: d,i
Function Frequency_d(D : Array[I] ; A,I : IndexType)
Title: Frequency_d(d,a,i)
Description: Returns the number of times each element of A occurs in D~~
, where the data D is indexed along I.
Definition: sum( D=A,I)
Nodelocation: 296,160,1
Nodesize: 88,16
Paramnames: D,A,I
Text Datastatwarntext
Description: This library is now obsolete in Analytica 4.0 and later.~~
The built-in statistical functions will all now accept an index par~~
ameter to use in place of Run. So, instead of using Mean_d, you can ~~
use:~
Mean( d, i )~
~
This library remains here for legacy support.
Nodelocation: 512,112,-1
Nodesize: 96,92
Nodeinfo: 1,0,0,1,1,1,0,,0,
Close Data_stats_lib5