Library: | pp |
See also: | ppftind ppsj1ind |
Quantlet: | ppsj2ind | |
Description: | computes the Sibson Jones index which considers the deviations from the normal density for bivariate data |
Usage: | ind = ppsj2ind(x) | |
Input: | ||
x | n x 2 matrix containing the bivariate projected data | |
Output: | ||
ind | scalar, the corresponding Sibson Jones index for bivariate data |
; loads the library pp library("pp") ; initialize random generator randomize(0) ; generate a dataset with mean(x)=0 and cov(x)=I_2 x = normal(100,2) ; compute the index by means of Scott's rule ppsj2ind(x)
Contents of ind [1,] 0.08592
proc()= plotindex2(x, n) p = cols(x) pv = orthonormal(normal(p,2)) xp = x*pv imax = ppsj2ind(xp) disp = createdisplay(1,2) xp = setmask(xp,"green") show(disp,1,2,xp) ; search now for a better projection i = 0 while(i<n) i = i+1 pv = orthonormal(normal(p,2)) xp = x*pv ind = ppsj2ind(xp) show(disp,1,1,xp) if(ind>imax) imax = ind xp = setmask(xp,"green") show(disp,1,2,xp) endif endo endp library("plot") library("math") library("pp") ; read the banknote data x = read("bank2") ; sphere the data x = transform(x, grc.prep.sphere) randomize(0) ; choose number of projections n = 100 plotindex2(x,n)
We see two plots of projections of the data. In the left display the actual projection is shown and in the right display the best projection, which has been found so far (the one with the highest index value) is shown.