User:Daniel Gregoire/dstat with mode
Jump to navigation
Jump to search
I hand-jammed my own overly verbose versions of the dstat
verb for years before I discovered that it already existed in Addons/stats/base/univariate.
Once I found it, I noted it didn't have a calculation for the mode.
So I went searching, found an implementation of mode here on the J wiki, and then extended dstat
with it to create the terribly named dstatfull
:
require'stats/base/univariate'
NB. =========================================================
NB.*mode v member of largest category (Johann Hibschman)
NB. Taken from: https://code.jsoftware.com/wiki/User:Devon_McCormick/mystats.ijs
mode=:~. {~ [: (i. >./) #/.~
NB. =========================================================
NB.*dstatfull v descriptive statistics
NB. table of formatted descriptive statistics
dstatfull=: 3 : 0
t=. '/sample size/minimum/maximum/median/mean/mode'
t=. t,'/std devn/skewness/kurtosis'
t=. ,&': ' ;._1 t
v=. $,min,max,median,mean,mode,stddev,skewness,kurtosis
t,. ": ,. v y
)