Newsgroups: comp.lang.apl
Path: watmath!ljdickey
From: ljdickey@math.uwaterloo.ca (L.J. Dickey)
Subject: Re: Stat workspaces for APL/J wanted
Message-ID: <BuuM3t.GA4@math.uwaterloo.ca>
Keywords: apl,stat,j
Organization: University of Waterloo
References: <russur.716752568@convex.convex.com> <1992Sep17.213736.20142@csi.jpl.nasa.gov>
Date: Sat, 19 Sep 1992 23:19:05 GMT

In article <russur.716752568@convex.convex.com>, russur@convex.com (Russ Urquhart) writes:
> If any has any apl/j workspaces containing statistics functions that are
> either in the public domian or that they would be willing to share, I'b be
> very grateful.


Here are some elementary functions written by Keith Smillie,
Professor Emeritus of Computing Science at the University of Alberta.
These functions appear in a forthcoming article called
"Statistics and J" which goes much beyond the functions given here.
	

 am     =. +/ % #               NB. arithmetic mean 
 gm     =. # %: */              NB. geometric mean
 hm     =. % @ am @ %           NB. harmonic mean

 dev    =. - am                 NB. deviation
 ss     =. +/ @ *: @ dev        NB. sum of squares
 var    =. ss % <: @ #          NB. variance

 sd     =. %: @ var             NB. standard deviation
 sp     =. +/ @ (*~ dev)        NB. sum of products
 cov    =. sp % <: @ # @ ]      NB. covariance

 corr   =. cov % *~ & sd        NB. correlation

-- 
Prof. Leroy J. Dickey, Faculty of Mathematics, U of Waterloo, Canada  N2L 3G1
   Internet:      ljdickey@math.UWaterloo.ca
                  ljdickey@math.waterloo.edu
   UUCP:          ljdickey@watmath.UUCP
