Learn R Programming

AdaptGauss (version 1.2.0)

Chi2testMixtures: Pearson's chi-squared test

Description

Returns a P value and visualizes for chi-square test of Data versus a given Gauss Mixture Model

Usage

Chi2testMixtures(Data,Means,SDs,Weights,IsLogDistribution,PlotIt,UpperLimit,VarName)

Arguments

Data
vector of data points
Means
vector of Means of Gaussians
SDs
vector of standard deviations, estimated Gaussian Kernels
Weights
vector of relative number of points in Gaussians (prior probabilities)
IsLogDistribution
Optional, if IsLogDistribution(i)==1, then mixture is lognormal, default vector of zeros of length 1:L
PlotIt
Optional, Default: FALSE, do a Plot of the compared cdfs and the KS-test distribution (Diff)
UpperLimit
Optional. test only for Data
VarName
If PlotIt=TRUE, the name of the inspected variable, default 'Data'

Value

  • List with
  • PvaluePvalue of a suiting chi-square , Pvalue ==0 if Pvalue <0.001< description="">
  • BinCentersbin centers
  • ObsNrInBinNo. of data in bin
  • ExpectedNrInBinNo. of data that should be in bin according to GMM
  • Chi2Valuethe TestStatistic i.e.: sum((ObsNrInBin(Ind)-ExpectedNrInBin(Ind))^2/ExpectedNrInBin(Ind)) with Ind = find(ExpectedNrInBin>=10)

Details

Let O_i be the observed features and E_i be the expected number E, than the test statistic is defined with T=sum((O_i-E_i)^2/E_i)*1/m, where m the number of data points. The expected number Ei may be derived for each bin with the null hypothesis that the data is from the distribution. Further details, see [Thrun & Ultsch, 2015].

References

Hartung, J., Elpelt, B., and Kloesener, K.H.: Statistik, 8. Aufl. Verlag Oldenburg (1991). Thrun, M. C., Ultsch, A.: Models of Income Distributions for Knowledge Discovery, European Conference on Data Analysis, DOI 10.13140/RG.2.1.4463.0244, pp. 28-29, Colchester 2015.