Page 1 of 1

Fractiles in sstats and statistics does not accept weights?

Posted: Wed Apr 08, 2020 8:41 am
by MarcB
Hi everybody,
I try to calculate fractiles with weighted samples. However, both sstats and statistics do not seem to accept my weights given as time series.

Code: Select all

allocate 20
set x = t
display %fractiles(x,.90)
     18.10000
statistics(nomoments,fractiles,noprint) x
display %fract90
     18.10000

set weights = 1
sstats(frac=0.90) / x>>sfrac
display sfrac
     18.10000
display %wfractiles(x,weights,.90)
     18.00000

clear weights 
set weights = 1.0/t
sstats / weights>>norm
set(scratch) weights = weights/norm

statistics(nomoments,fractiles,weight=weights,noprint) x
display %fract90
     18.10000
display %wfractiles(x,weights,.90)
     14.00000
sstats(weight=weights,frac=.90) / x>>sfrac
display sfrac
     18.10000
Many thanks for your help.