Apl2ToDoStatisticsDescriptiveAlgorithms

This is a sub-page of PhraseBook/ToDo/Apl2Idioms

AVG←(+/N)÷1⌈⍴N ⍝ Average (mean) of N.

AVG3←(3+/NA)÷3 ⍝ Three wise rolling average.

CAVE←(+⌿NM)÷1⌈↑⍴NM ⍝ Column averages of NM.

CAVG←(+⌿NM)÷1⌈+⌿0≠NM ⍝ Column averages of NM. (non-zero)

RAVE←(+/NM)÷1⌈↑⌽⍴NM ⍝ Row averages of NM.

RAVG←(+/NM)÷1⌈+/0≠NM ⍝ Row averages of NM. (non-zero)

WAVG←(N+.×NM)÷+/N ⍝ Weighted average of vector/matrix columns.

WAVG←(NM+.×N)÷+/N ⍝ Weighted average of vector/matrix rows.

MODE←(I=⌈/I←+⌿N∘.=NU)/NU←(∨⌿<\N∘.=N)/N ⍝ Mode(s) of data.

MED←.5×+/N[(⍋N)[⌈.5ׯ1 0+⍴N←,N]] ⍝ Median of non-empty N.

MED←.5×+/N[(⍋N)[⌈.5×0 1+⍴N←,N]] ⍝ Median of non-empty N.

RANGE←(⌈/N)-⌊/N ⍝ Range of non-empty N.

STD←((+/(,A-(+/,A)÷N)*2)÷N←1⌈⍴,A)*.5⍝ Total theoretical standard deviation of A.

STD←((+/(,A-(+/,A)÷1⌈⍴,A)*2)÷1⌈¯1+⍴,A)*.5⍝ Total standard deviation of A.

STD←(((N×+/A*2)-(+/A)*2)*.5)÷N←1⌈↑⌽⍴A ⍝ Row theoretical standard deviation of A.

STD←(((N×+/A*2)-(+/A)*2)÷N×1⌈¯1+N←1⌈↑⌽⍴A)*.5⍝ Row standard deviation of A.

VAR←(+/(,A-(+/,A)÷N)*2)÷N←1⌈⍴,A ⍝ Total theoretical variance of A.

VAR←(+/(,A-(+/,A)÷1⌈⍴,A)*2)÷1⌈¯1+⍴,A ⍝ Total variance of A.

VAR←((N×+/A*2)-(+/A)*2)÷(N←1⌈↑⌽⍴A)*2 ⍝ Row theoretical variance of A.

VAR←((N×+/A*2)-(+/A)*2)÷N×1⌈¯1+N←1⌈↑⌽⍴A ⍝ Row variance of A.

V←X~Y ⍝ Difference of sets. Elements of X not in Y.

V←(XεY)/X ⍝ Intersection of two sets of numbers.

V←Y~Y~X ⍝ Intersection of two sets of numbers.

V←Y,(~XεY)/X ⍝ Union of two sets of numbers.

V←Y,X~Y ⍝ Union of two sets of numbers.

N←+/X∘.=Y ⍝ Frequency of X in Y.

M←2|⌊(⍳2*IS)∘.÷1+2*IS-⍳IS ⍝ Truth table with IS variables.

M←2|⌊(¯1+⍳2*IS)∘.÷2*IS-⍳IS ⍝ Truth table with IS variables.


CategoryPhrasebookToDo

Apl2ToDoStatisticsDescriptiveAlgorithms (last edited 2011-04-25 13:52:39 by KaiJaeger)