Post Reply 
Winsorising
01-04-2016, 08:24 PM
Post: #1
Winsorising
hi,
a program to make the winsorising of a data set for statistical purpose.
See here in Wikipedia: «Winsorising or Winsorisation is the transformation of statistics by limiting extreme values in the statistical data to reduce the effect of possibly spurious outliers. It is named after the engineer-turned-biostatistician Charles P. Winsor (1895–1951)...»
Values must be already in Statistic 1var (D1 matrix). The program put the resulting items in D2.

Enjoy!

Salvo Micciché

Code:

EXPORT winsorising(p)
// Data in Statistic 1var; p -> i.e. 90 = 90%, from 5th to 95th percentile)
BEGIN
LOCAL q1, q2, j;
q1 := quantile(D1, (100-p)/100);
q2 := quantile(D1, p/100);
D2 := D1;
FOR j FROM 1 TO size(D1) DO
    IF D1(j) < q1 THEN D2(j):= q1; END;
    IF D1(j) > q2 THEN D2(j):= q2; END;
END;
RETURN D2;
END;

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)