The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information.... |
Home MathPack Statis Interface of SDL_Statis | |
Interface of SDL_Statis |
|
const {$IFDEF PAIDVERS} SDLVersionInfo = 'statis_r1200_full'; IsLightEd = false; {$ELSE} SDLVersionInfo = 'statis_r1200_lighted'; IsLightEd = true; {$ENDIF} Release = 1200; type ESDLStatisError = class(ESDLError); { exception type to indicate errors } TSignifLevel = (Dot20, Dot15, Dot10, Dot05, Dot01); TSignifLevelEx = (Dot001, Dot002, Dot005, Dot010, Dot020, Dot050, Dot100, Dot200, Dot500); TtTestVersion = (ttPaired, ttHomoScedastic, ttHeteroScedastic); TRegModelType = (rmMLR, rmLDA, rmRR); TRandGen = class (TComponent) private FLowBorder : double; FHighBorder : double; FResolution : integer; FDistVec : array of double; procedure SetResolution (res: integer); function GetProbability (Idx: integer): double; function GetRandNum: double; function GetLambda (ix: integer): double; procedure SetProbability (Idx: integer; Value: double); public constructor Create (AOwner: TComponent); override; destructor Destroy; override; property Lambda[ix: integer]: double read GetLambda; procedure Normalize; function Standardize: boolean; procedure NormalDistri (m, s: double); property Probability[ix: integer]: double read GetProbability write SetProbability; property Random: double read GetRandNum; function IndexOfLambda (Lambda: double): integer; procedure tDistri (df: integer); procedure Chi2Distri (df: integer); procedure FDistri (df1, df2: integer); procedure UniformDistri; procedure WeibullDistri (beta, eta: double); published property HighBorder: double read FHighBorder write FHighBorder; property LowBorder: double read FLowBorder write FLowBorder; property Resolution: integer read FResolution write SetResolution; end; TOnModelApplyRequestEvent = procedure (Sender: TObject; PercentDone: integer; Predictors: TDoubleArray; var Response, Thresh: TDoubleArray) of object; TOnModelCreateRequestEvent = procedure (Sender: TObject; PercentDone: integer; ObjectList: TIntArray; var Success: boolean) of object; TCrossValidator = class(TComponent) private FTestSize : integer; FPress : TVector; FIsRunning : boolean; FTPCnt : TIntVector; // true positive count FFPCnt : TIntVector; // false positive count FTNCnt : TIntVector; // true negative count FFNCnt : TIntVector; // false negative count FXMat : TMatrix; // pointer to external descriptor matrix (X) FYMat : TMatrix; // pointer to external response matrix (Y) FOnModelApplyRequest : TOnModelApplyRequestEvent; FOnModelCreateRequest : TOnModelCreateRequestEvent; FOnCheckAbort : TOnCheckAbortEvent; procedure SetTestSize (size: integer); function GetRMSEP(ix: integer): double; function GetMCC(ix: integer): double; function GetFNCnt (ix: integer): integer; function GetFPCnt (ix: integer): integer; function GetTNCnt (ix: integer): integer; function GetTPCnt (ix: integer): integer; function GetTPRate(ix: integer): double; function GetFPRate(ix: integer): double; function GetTNRate(ix: integer): double; function GetFNRate(ix: integer): double; public constructor Create (AOwner: TComponent); override; destructor Destroy; override; function Execute: boolean; property IsExecuting: boolean read FIsRunning; property RMSEP[varix: integer]: double read GetRMSEP; property TPCnt [varix: integer]: integer read GetTPCnt; property TNCnt [varix: integer]: integer read GetTNCnt; property FPCnt [varix: integer]: integer read GetFPCnt; property FNCnt [varix: integer]: integer read GetFNCnt; property TPRate [varix: integer]: double read GetTPRate; property FPRate [varix: integer]: double read GetFPRate; property TNRate [varix: integer]: double read GetTNRate; property FNRate [varix: integer]: double read GetFNRate; property MatthewsCorr [varix: integer]: double read GetMCC; published property XMat: TMatrix read FXMat write FXMat; property YMat: TMatrix read FYMat write FYMat; property SizeTestSet: integer read FTestSize write SetTestSize; property OnModelApplyRequest: TOnModelApplyRequestEvent read FOnModelApplyRequest write FOnModelApplyRequest; property OnModelCreateRequest: TOnModelCreateRequestEvent read FOnModelCreateRequest write FOnModelCreateRequest; property OnCheckAbort: TOnCheckAbortEvent read FOnCheckAbort write FOnCheckAbort; end; {$IFDEF PAIDVERS} TMLRModel = class(TComponent) private FXData : TMatrix; // independent variables FYData : TVector; // target variable FInVarNames : TStrArray; // input variable names FOutVarName : string; // name of output variable FWeights : TDoubleArray; // weights of model FSiglev : TDoubleArray; // p value of coefficients FTVal : TDoubleArray; // p value of coefficients FFitR2 : double; // goodness of fit of model FStatistic : double; // F-value of model FForceZeroIcpt : boolean; // TRUE: force model through origin Fdfreg, // ANOVA params of the regression model Fdfres, Fdftotal : integer; FSSE, FSSR, FSST, FMSE, FMSR : double; FDWstat : double; // Durbin-Watson statistic FResiduals : TDoubleArray; // residuals FStddevRes : double; // standard dev. of the residuals FCooksD : TDoubleArray; // Cook's distance FMLRTRange : TMatrix; // list of training data range FRegModType : TRegModelType; // type of regression model FLDAThresh : double; // LDA threshold FLDAV1, FLDAV2 : double; // LDA values FLambda : double; // lambda of ridge regression FRRStdCoeffs : boolean; // TRUE: standardized coeffs in ridge reg FROCCoords : TDouble2DArray; // ROC values for LDA models FBestROC : integer; // optimum ROC value FAUC : double; // AUC FThreshMMC : double; // opt. threshold obtained via MMC FThreshAcry : double; // opt. threshold via accuracy FThreshInfo : double; // opt. threshold via informedness function GetInVarName (varix: integer): TNameStr; procedure SetInVarName (varix: integer; Name: TNameStr); procedure GetMeanVarOfTarget (var Mean, Vari: double); procedure GetMeanVarOfVar (ColNr: integer; var Mean, Vari: double); procedure GetMinMaxOfTarget (var Mini, Maxi: double); procedure GetMinMaxOfVar (ColNr: integer; var Mini, Maxi: double); function GetWeight (varix: integer): double; function GetROCFPRate (ix: integer): double; function GetROCTPRate (ix: integer): double; function GetROCThresh (ix: integer): double; function GetCooksD (objix: integer): double; function GetResiduals (objix: integer): double; function GetSigLevel (varix: integer): double; function GetTValue (varix: integer): double; function GetROCLength: integer; function GetBestROC: integer; procedure SetLamda (Value: double); procedure SetMeanVarOfTarget (Mean, Vari: double); procedure SetMeanVarOfVar (ColNr: integer; Mean, Vari: double); procedure SetMinMaxOfTarget (Mini, Maxi: double); procedure SetMinMaxOfVar (ColNr: integer; Mini, Maxi: double); procedure SetRegModType (RegModType: TRegModelType); procedure XDataResize (Sender: TObject); procedure YDataResize (Sender: TObject); public constructor Create (AOwner: TComponent); destructor Destroy; property AUC: double read FAUC; property BestROC: integer read GetBestROC; property CooksD [objix: integer]: double read GetCooksD; property DWStat: double read FDWStat; property FitR2: double read FFitR2; property ForceZeroIcpt: boolean read FForceZeroIcpt write FForceZeroIcpt; property FStat: double read FStatistic; property InVarName[varix: integer]: TNameStr read GetInvarName write SetInVarName; property Lambda: double read FLambda write SetLamda; property LDAThreshold: double read FLDAThresh write FLDAThresh; property LDAV1: double read FLDAV1; property LDAV2: double read FLDAV2; property ModelType: TRegModelType read FRegModType write FRegModType; property pValue[varix: integer]: double read GetSigLevel; property RegCoeffs[varix: integer]: double read GetWeight; property Residuals[objix: integer]: double read GetResiduals; property ROCFPRate[ix: integer]: double read GetROCFPRate; property ROCLength: integer read GetROCLength; property ROCThresh[ix: integer]: double read GetROCThresh; property ROCTPRate[ix: integer]: double read GetROCTPRate; property StdDevRes: double read FStdDevRes; property TgVarName: string read FOutVarName write FOutVarName; property ThreshAcry: double read FThreshAcry; property ThreshInfo: double read FThreshInfo; property ThreshMMC: double read FThreshMMC; property tStat[varix: integer]: double read GetTValue; property XData: TMatrix read FXData write FXData; property YData: TVector read FYData write FYData; function ApplyModel (Sensor: TVector; var yHat: double): integer; function CalculateModel: integer; procedure GetAnovaPars (var dfreg, dfres, dftotal, SSE, SSR, SST, MSE, MSR, FStat: double); function LoadModel (FName: String): integer; procedure StoreModel (FName: String); published end; {$ENDIF} TPLSSclMode = (scmCenter, scmStandardize); {$IFDEF PAIDVERS} TPLSModel = class(TComponent) private FScoreX : TMatrix; FScoreY : TMatrix; FLoadX : TMatrix; FLoadY : TMatrix; FWgtX : TMatrix; FOrthoLd : TMatrix; FVarX : TVector; FVarY : TVector; FCvdRmsEP : TVector; FCvdMCC : TVector; FCvdFPRate : TVector; FCvdTPRate : TVector; FCfThresh : TVector; FIsDAModel : boolean; FXMat : TMatrix; FYMat : TMatrix; FNFact : integer; FRegCoeffs : TMatrix; FXNames : array of TDTNameStr; // names of predictors FYNames : array of TDTNameStr; // names of response variables FScalMod : TPLSSclMode; FObjNames : array of TDTNameStr; // names of objects FObjAtt : array of byte; // attributes of objects FObjTag : array of integer; // numeric tag of objects FOnPercentDone : TOnPercentDoneEvent; FOnCheckCVDAbort: TOnCheckAbortEvent; function GetPredName (ix: integer): string; procedure SetPredName (ix: integer; value: string); function GetRespoName (ix: integer): string; procedure SetCFThresholds (YHat: TMatrix); procedure SetRespoName (ix: integer; value: string); function GetObjName (ix: integer): string; procedure SetObjName (ix: integer; value: string); function GetObjAtt (ix: integer): byte; procedure SetObjAtt (ix: integer; value: byte); function GetObjTag (ix: integer): integer; procedure SetObjTag (ix: integer; value: integer); procedure CVDModelApplyRequest(Sender: TObject; PercentDone: integer; Predictors: TDoubleArray; var Response, Thresh: TDoubleArray); procedure CVDModelCreateRequest(Sender: TObject; PercentDone: integer; ObjectList: TIntArray; var Success: Boolean); procedure CVDModelCheckAbort (Sender: TObject; var AbortProcess: boolean); procedure SetNFactors (nfac: integer); procedure PercDone (Sender: TObject; Percent: longint); procedure FXMatResize (Sender: TObject); public constructor Create (AOwner: TComponent); override; destructor Destroy; override; property ScoreX: TMatrix read FScoreX; property ScoreY: TMatrix read FScoreY; function LoadModelCoefficients (FileName: string; var Comment: string): integer; property LoadX: TMatrix read FLoadX; property LoadY: TMatrix read FLoadY; property NamePredictor[ix: integer]: string read GetPredName write SetPredName; property NameResponse[ix: integer]: string read GetRespoName write SetRespoName; property OrthoLd: TMatrix read FOrthoLd; property WgtX: TMatrix read FWgtX; property VarX: TVector read FVarX; property VarY: TVector read FVarY; property ClassifThreshold: TVector read FCfThresh; property RegCoeff: TMatrix read FRegCoeffs; procedure SaveModelCoefficients (FileName, Comment: string); procedure AppendModelParamsToFile (var OFile: TextFile; Comment: string); property XMat: TMatrix read FXMat write FXMat; property YMat: TMatrix read FYMat write FYMat; property NameObj[ix: integer]: string read GetObjName write SetObjName; property ObjAttrib[ix: integer]: byte read GetObjAtt write SetObjAtt; property ObjTag[ix: integer]: integer read GetObjTag write SetObjTag; procedure CalculateModel; function MaxFactors: integer; procedure Predict (XData: TDoubleArray; var YHat: TDoubleArray); overload; procedure Predict (XData: TMatrix; var YHat: TMatrix); overload; procedure SetObjAttribs (Attrib: byte); procedure SetObjTags (Tag: integer); property CvdRmsEP: TVector read FCvdRmsEP; property CvdMCC: TVector read FCvdMCC; property CvdFPRate: TVector read FCvdFPRate; property CvdTPRate: TVector read FCvdTPRate; function CrossValidateModel (SizeTestSet: integer): double; published property Factors: integer read FNFact write SetNFactors; property IsDiscriminantModel: boolean read FIsDAModel write FIsDAModel; property ScalingMode: TPLSSclMode read FScalMod write FScalMod; property OnCheckCVDAbort: TOnCheckAbortEvent read FOnCheckCVDAbort write FOnCheckCVDAbort; property OnPercentDone: TOnPercentDoneEvent read FOnPercentDone write FOnPercentDone; end; {$ENDIF} TCFEvaluator = class(TComponent) private FTrueVec : TDoubleArray; // true values FEstVec : TDoubleArray; // estimated values FIsSorted : boolean; Ftp, Ffp, Ftn, Ffn : int64; // counts of confusion matrix FCFThresh : double; // threshold used for calc. the confusion matrix FIsDicho : boolean; FDichoV1 : double; FDichoV2 : double; function GetNData: integer; function GetTrueData (ix: integer): double; procedure SetTrueData (ix: integer; value: double); function GetEstimData (ix: integer): double; procedure SetEstimData (ix: integer; value: double); procedure SetNData (value: integer); function SortEstimated: integer; public constructor Create (AOwner: TComponent); override; destructor Destroy; override; function Accuracy: double; function CalcConfusionMatrix (CFThresh: double): integer; function OptimizeThresholds (var ROCCoords: TDouble2DArray; var BestROC: integer; var AUC, ThreshMMC, ThreshAccuracy, ThreshInformedness: double): integer; function CopyTrueFromMatrix (Col: integer; SrcMat: TMatrix): integer; function CopyEstFromMatrix (Col: integer; SrcMat: TMatrix): integer; property DichoV1: double read FDichoV1; property DichoV2: double read FDichoV2; property EstimData [ix: integer]: double read GetEstimData write SetEstimData; function F1Score: double; function FpRate: double; function FnRate: double; function GetActualDichoValues (var v1, v2: double): boolean; function GetConfMatValues (var tp, fp, tn, fn: integer; var Thresh: double): integer; function Informedness: double; function MatthewsCorr: double; property NData: integer read GetNData write SetNData; function NegPredVal: double; function Precision: double; function ThreatScore: double; function UncertCoeff: double; property Threshold: double read FCFThresh; function TnRate: double; function TpRate: double; property TrueData [ix: integer]: double read GetTrueData write SetTrueData; published end; const NUMERICSIGLEVEL : array[TSignifLevelEx] of double = (0.001, 0.002, 0.005, 0.010, 0.020, 0.050, 0.100, 0.200, 0.500); NUMERICSIGNIFLEVEL : array[TSignifLevel] of double = (0.20, 0.15, 0.10, 0.05, 0.01); function AdjustedRandIx (ContTab : TInt2DArray) { contingency table } : double; { adjusted Rand index } function AkaikeInfCrit (nobs, { number of observations } nvars : integer; { number of variables } SSE: double) { sum of squared residuals } : double; function BinomCoeff (n : integer; { total number of elements } k : integer) { number of drawn elements } : longint; { binomial coefficient } function Anova1F (Data : TVector; { collection of data to be analyzed } TmLevel : TIntVector; { level of treatment of each data point } var SSTm, SSErr, SSTotal : double; { sum of squares } var DFTm, DFErr, DFTotal : integer; { degrees of freedom } var FSTat : double) { F value } : double; { p-value } function BartlettTest (Data : TDouble2DArray; { two dimensional dataset } NSampleData : TIntArray; { number of data points for each sample } var Chi2 : double) { the corresponding chi-square value } : double; { p-value } function BinomDistriDensity (SampleSize : integer; { sample size drawn from infinite population } FractionA : double; { fraction of items marked "A" } k : integer) { k drawn items marked "A" (out of SampleSize) } : double; { density of the binomial distribution } function BinomDistriIntegral (SampleSize : integer; { sample size drawn from infinite population } FractionA : double; { fraction of items marked "A" } k : integer) { k drawn items marked "A" (out of SampleSize) } : double; { integral of the binomial distribution } function BinomDistriQuantile (SampleSize : integer; { sample size drawn from infinite population } FractionA : double; { fraction of items marked "A" } p : double; { probability } var ActualProb : double){ actual probability assoc. with returned quantile } : integer; { quantile of binomial distribution } function BinomSignTest (Data : TBoolArray; { binary data to be tested } p1 : double) { expected probability of TRUE values } : double; { probability of H0 } function CalcAndTestKurtosis (Data : TDoubleArray; { data to be tested } OneSided : boolean; { one sided / two sided tests } var m4, { fourth moment } Gamma, { gamma = kurtosis } zStatistic : double) { normally distributed statistic for test } : double; { probability } function CalcAndTestSkewness (Data : TDoubleArray; { data to be tested } OneSided : boolean; { one sided / two sided tests } var m3, { third moment } Gamma, { gamma = skewness } zStatistic : double) { normally distributed statistic for test } : double; { probability } function CalcFishQ (m1,m2, { mean values, class 1 & 2 } s1,s2 : double) { standard deviations } : double; { Fisher ratio } function CFAccuracy (tp, fp, { true and false positive counts } tn, fn : integer) { true and false negative counts } : double; { classifier accuracy } function CFInformedness (tp, fp, { true and false positive counts } tn, fn : integer) { true and false negative counts } : double; { Informedness } function CFMatthewsCorr (tp, fp, { true and false positive counts } tn, fn : integer) { true and false negative counts } : double; { Matthews correlation } function Chi2DistriDensity (chi2 : double; { chi square quantile } df : integer) { degrees of freedom } : double; { density of chi square distribution } function chi2DistriIntegral (chi2 : double; { chi square quantile } df : integer) { degrees of freedom } : double; { probability } function chi2DistriQuantile (p : double; { probability } df : integer) { degrees of freedom } : double; { quantile of chi2-distribution } function Chi2OfContTab (ContTab : TInt2DArray; { contingency table } var chisq, { calculated chi-square } p : double) { corresponding probability } : integer; { error code } function Chi2OfContTabYates (ContTab : TInt2DArray; { 2x2 contingency table } var chisq, { calculated chi-square } p : double) { corresponding probability } : integer; { error code } function CorrTest (Data1, Data2 : TDoubleArray; { data to be tested } RefCorr : double; { reference correlation } var rxy : double; { corr. coeff. } var pvalue : double) { p value } : integer; { error code } function ConfidenceInterval (alpha : double; { level of significance } StdDev : double; { standard deviation } NumData : integer) { sample size } : double; { confidence interval } function DeanDixonCriticalValues (NData : integer; { number of data } SigLevel : TSignifLevelEx) { level of significance } : double; { critical value } function DeanDixonTest (Data : TVector; { data to be tested } SigLevel : TSignifLevelEx; { level of significance } var Statistic : double) { test statistic } : integer; overload; { index of outlier } function DeanDixonTest (Data : TDoubleArray; { data to be tested } SigLevel : TSignifLevelEx; { level of significance } var Statistic : double) { test statistic } : integer; overload; { index of outlier } function DurbinWatsonCrit5pct (NData, { number of data points } NParam : integer; { number of variables involved } var dLower, dUpper : double) { critical values at the 5% significance level } : boolean; { TRUE if crit. values are valid } function DurbinWatson (Residuals : TDoubleArray) { data to be tested } : double; { Durbin-Watson statistic } function Erf (x : double) { parameters } : double; { function result } function ErfApprox (x : double) { parameters } : double; { function result } function EstimateProbDensity (const SampleData : TVector; { sample data } var Probability : TVector; { resulting prob. density } LowBorder, { lower border of estimation } HighBorder, { upper border of estimation } Smoothing : double; { width of the Gaussian kernel } WindowWidth : double; { width of local density estimation } Resolution : integer; { resolution of the prob. density } var MinDensIx, { minium density } MaxDensIx : integer; { maximum density } Feedback : TOnPercentDoneEvent) { feedback routine } : integer; function ExtractClassifPerformance (clix : integer; { class index } ConfMat : TIntMatrix; { multi-class confusion matrix } var tp, fp, { true/false positive count } tn, fn : integer) { true/false negative count } : integer; overload; function ExtractClassifPerformance (clix : integer; { class index } ConfMat : TInt2DArray; { multi-class confusion matrix } var tp, fp, { true/false positive count } tn, fn : integer) { true/false negative count } : integer; overload; function FDistriDensity (F : double; { F quantile } df1, df2 : integer) { degrees of freedom } : double; { density of F distribution } function FDistriIntegral (F : double; { F quantile } df1 : integer; { degrees of freedom } df2 : integer) { degrees of freedom } : double; { probability } function FDistriQuantile (p : double; { probability } df1 : integer; { degrees of freedom } df2 : integer) { degrees of freedom } : double; { quantile } function FisherExactTest (FreqTab : TInt2DArray; { 2x2 frequency table } var ProbLow, { cumulative prob. of lower tail } ProbHigh, { cumulative prob. of upper tail } Prob2Tail : double) { cumulative prob. of two-tailed test } : integer; { error code } function FisherTransform (x : double) { argument } : double; { Fisher's transform } function FisherTransformInv (x : double) { argument } : double; { inverse Fisher transform } function FriedmanTest (Data : TMatrix; { data to be tested } var Chi2Stat : double) { chi2 value } : double; { p value } function GiniCoeff (Data : TDoubleArray) { data array } : double; { Gini coefficient } function GrubbsCriticalValues (NData : integer; { number of data points } alpha : double; { level of significance } twosided : boolean) { TRUE: two-sided test } : double; { critical value for 2-sided Grubbs test } function GrubbsTest (Data : TVector; { data to be tested } SigLevel : double; { level of significance } var Statistic : double; { test statistic } var Outlier : integer) { index of outlier } : integer; overload; { error code } function GrubbsTest (Data : TDoubleArray; { data to be tested } SigLevel : double; { level of significance } var Statistic : double; { test statistic } var Outlier : integer) { index of outlier } : integer; overload; { error code } function HyperGeoDistriDensity (p : double; { probability of interesting cases } npop : integer; { total number of cases } nsample : integer; { no. of samples drawn } k : integer) { no. of interesting cases to be expected } : double; { probab. to observe exactly k interesting cases } function IncompleteBeta (x : double; { quantile } a, b : double) { parameters } : double; { function result } function IncompleteGamma (x, a : double): { parameters } double; { function result } function KolmogSmir1SampleTestStat (SampleSize : integer; { size of sample to be tested } alpha : TSignifLevel) { level of significance } : double; { critical KS value } function KSPValue (NumData : integer; { sample size } KSD : double) { Kolmogorov-Smirnov test statistic } : double; { p-value corresponding to KSD } function KSQuantile (NumData : integer; { sample size } alpha : TSignifLevel) { level of significance } : double; { critical value } function Lambda (ContTab : TInt2DArray; { contingency table } var LambdaRow, { lambda, rows contain the dependent variable } LambdaCol : double) { lambda, columns contain the dependent variable } : integer; { error number } function LeveneTest (Data : TVector; { collection of data to be analyzed } TmLevel : TIntVector; { level of treatment of each data point } var FStat : double) { F value } : double; { p value } function LillieforsPValue (NumData : integer; { sample size } KSD : double) { Lilliefors test statistic } : double; { p-value corresponding to KSD } function LillieforsQuantile (NumData : integer; { sample size } alpha : double) { level of significance } : double; { critical value } function LnBeta (z,w : double) { arguments of beta function } : double; { Beta(z,w) } function LnBinomCoeff (n : integer; { total number of elements } k : integer) { number of drawn elements } : double; { logarithm of binomial coefficient } function LnGamma (x : double) { argument of gamma function } : double; { ln(gamma(x)) } function LoadPLSModelComment (FileName : string; { filename of PLS model } var Comment : string) { comment } : integer; { error code } function MedianTest (DataGrp1, { data of sample 1 } DataGrp2 : TDoubleArray; { data of sample 2 } var Chi2, { chi-square value } pChi2, { corresponding probability } Chi2Yates, { chi-square value, corrected after Yates } pChi2Yates, { corresponding probability, corrected after Yates } pExact : double) { Fisher's exact probability } : integer; { error code } function nDistriDensity (u : double) { critical value } : double; { density of normal distribution } function nDistriIntegral (u : double) { argument } : double; {integral of norm.dens.funct.} function nDistriQuantile (p : double) { probability } : double; { normal distribution } function PearsonCorrCoeff (Data1, Data2 : TDoubleArray; { data to be correlated } var CorrCoeff : double) { correlation coefficient } : integer; { error code } function PercentileOfArray (Data : TDoubleArray; { 1D data array } prob : double; { probability } FirstIx, LastIx : integer;{ first and last index of region to be checked } var Percentile : double) { calculated percentile } : integer; { error code } function Perform1SampleChi2Test (Data : TDoubleArray; { data points of the two samples } RefStdDev : double; { reference standard dev. } OneSided : boolean; { TRUE: one sided probability } var Mean, { means of the two samples } StdDev, { standard deviations of the two samples } Chi2Statistic : double; { chi2-statistic } var df : integer) { degrees of freedom } : double; overload; { probability } function Perform1SampleTTest (Data : TDoubleArray; { data points of the sample } RefMean : double; { reference mean } OneSided : boolean; { TRUE: one sided probability } var Mean, { mean of the sample } StdDev, { standard deviation of the sample } tStatistic : double; { t-statistic } var df : integer) { degrees of freedom } : double; overload; { probability } function Perform2SampleTTest (Data1, Data2 : TVector; { data points of the two samples } TestType : TtTestVersion; { kind of t-test to be performed } OneSided : boolean) { TRUE: one sided probability } : double; overload; { probability } function Perform2SampleTTest (Data1, Data2 : TVector; { data points of the two samples } TestType : TtTestVersion; { kind of t-test to be performed } OneSided : boolean; { TRUE: one sided probability } var Mean1, Mean2, { means of the two samples } Stdv1, Stdv2, { standard deviations of the two samples } MeanDiff, { mean of difference of sample pairs } StdDiff, { standard deviation of difference of sample pairs } tStatistic : double; { t-statistic } var df : integer) { degrees of freedom } : double; overload; { probability } function Perform2SampleTTest (Data1, Data2 : TDoubleArray; { data points of the two samples } TestType : TtTestVersion; { kind of t-test to be performed } OneSided : boolean; { TRUE: one sided probability } var Mean1, Mean2, { means of the two samples } Stdv1, Stdv2, { standard deviations of the two samples } MeanDiff, { mean of difference of sample pairs } StdDiff, { standard deviation of difference of sample pairs } tStatistic : double; { t-statistic } var df : integer) { degrees of freedom } : double; overload; { probability } function PerformChi2DistComp (CountObserved, { array of observed counts } CountExpected : TIntArray; { array of expected counts } var Chi2 : double; { chi-square value } var p : double; { corresponding p value } var df : integer; { degrees of freedom } var nObs, nExp : integer) { number of observations in the count arrays } : integer; { error code } function PerformFTest (Data1, Data2 : TDoubleArray; { data points of the two samples } OneSided : boolean; { TRUE: one sided probability } var Mean1, Mean2, { means of the two samples } Stdv1, Stdv2, { standard deviations of the two samples } FStatistic : double; { t-statistic } var df1, df2 : integer) { degrees of freedom } : double; { probability } function PerformKSNormalityTest (Data : TVector; { sample observations } IsSorted : boolean) { TRUE: vector is already sorted in asc. order } : double; overload; { KS statistic } function PerformKSNormalityTest (Data : TDoubleArray; { sample observations } IsSorted : boolean) { TRUE: vector is already sorted in asc. order } : double; overload; { KS statistic } function PerformLillieforsTest (Data : TVector; { sample observations } IsSorted : boolean) { TRUE: vector is already sorted in asc. order } : double; overload; { Lilliefors statistic } function PerformLillieforsTest (Data : TDoubleArray; { sample observations } IsSorted : boolean) { TRUE: vector is already sorted in asc. order } : double; overload; { Lilliefors statistic } function PerformMannWhitneyUTest (Data1, Data2 : TVector; { data points of the two samples } OneSided : boolean; { TRUE: one sided probability } var UStatistic : double) { U-statistic } : double; overload; { probability } function PerformMannWhitneyUTest (Data1, Data2 : TDoubleArray; { data points of the two samples } OneSided : boolean; { TRUE: one sided probability } var UStatistic : double) { U-statistic } : double; overload; { probability } function PerformSiegelTukeyTest (Data1, Data2 : TDoubleArray; { data points of the two samples } var UStatistic : double) { U-statistic } : double; { probability } function Prob2x2Contingency (FreqTab : TInt2DArray; { 2x2 frequency table } var Prob : double) { probability } : integer; { error code } function ExactRunsTest (gs1, gs2 : integer; { group sizes } observed : integer) { number of observed runs } : double; { propability to find the observed number of runs } function RunsTest (Data : TBitFld; { binary data } var p : double) { associated level of significance } : boolean; overload; { TRUE: sequence is non-random } function RunsTest (Data : TBoolArray; { binary data } var p : double) { associated level of significance } : boolean; overload; { TRUE: sequence is non-random } function RunsTestSerial (Data : TVector; { data to be tested for serial randomness } var p : double) { associated level of significance } : boolean; overload; { TRUE: sequence is non-random } function RunsTestSerial (Data : TDoubleArray; { data to be tested for serial randomness } var p : double) { associated level of significance } : boolean; overload; { TRUE: sequence is non-random } function tDistriDensity (t : double; { t value } df : integer) { degrees of freedom } : double; { density of t distribution } function tDistriIntegral (t : double; { t value } df : integer) { degrees of freedom } : double; { probability } function tDistriQuantile (p : double; { probability } df : integer) { degrees of freedom } : double; { quantile of t-distribution } function UDistriDensity (U : integer; { U statistic } M, N : integer) { number of data of each distribution } : double; { density of the U distribution } function UDistriIntegral (U : integer; { U statistic } M, N : integer) { number of data of each distribution } : double; { probability } function UDistriQuantile (m, n : integer; { number of data of each distribution } prob : double) { probability } : integer; { quantile of U-distribution } function WeibullDensity (x : double; { argument } beta : double; { parameters of Weibull distribution } eta : double) : double; { density } function WilcoxonSignedRankTest (Data1, Data2 : TDoubleArray; { data points of the two samples } alpha : double; { level of significance } OneSided : boolean; { TRUE: one sided test } var mdiff, { median of differences } WStat, { Wilcoxon statistic } WCritLow, { lower critical limit } WCritHigh : double) { upper critical limit } : integer; { error code } function WilcoxonSRQuantile (NData : integer; { number of data points } alpha : double; { level of significance } twosided : boolean) { TRUE: two-sided test } : integer; { critical value for Wilcoxon signed rank test } function ShapiroWilkTest (Data : TVector; { data vector } NCens : integer; { number of right censored data } var pW : double; { p-value of WStat } var WStat : double) { W statistics } : integer; overload; { error number } function ShapiroWilkTest (Data : TDoubleArray; { data vector } NCens : integer; { number of right censored data } var pW : double; { p-value of WStat } var WStat : double) { W statistics } : integer; overload; { error number } function ShapiroWilkIntegral (WStat : double; { W statistic of the Shapiro-Wilk test } NDat, { number of data } NCens : integer) { number of censored data } : double; { integral } function TheilSenEstimator (DataX, { data to be used - x axis } DataY : TDoubleArray; { data to be used - y axis } var slope : double; { slope } var Intercept : double; { intercept } var slopeLL : double; { lower limit of slope } var slopeUL : double; { upper limit of slope } var iceptLL : double; { lower limit of intercept } var iceptUL : double) { upper limit of intercept } : integer; { error number }
|