Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Knowledge Base

Definitive answers from Designer Desktop experts.

Standard Deviation (Population) Macro

AngelaO
Alteryx Alumni (Retired)
Created

Question

How can you calculate the standard deviation of the population (SDpop) rather than standard deviation on the sample data (SDsample)?

Answer

Please find the attached macro, special thanks to one of our Community users!

 

Standard deviation of the population (SDpop) and standard deviation on the sample (SDsample) are very similar - the only difference is that in SDpop the sum of the squared variances is divided by n instead of n-1 as it is for SD sample (where n is the number of data points in the vector). This macro takes a vector of doubles which needs to be named 'dataVals' and it returns the standard deviation of the population. Accurate out to the 9th or 10th place.

 

sd.png

Attachments
Comments
ctheo
5 - Atom

How could I alter this macro so that it can take multiple columns of data and then have it calculate a SD for each column? I'm not very good with macros and I can't figure this out.

voovovo
8 - Asteroid

Just I want to leave a simple solution my colleague gave me about this.

Use Summarize tool to calculate

Variance

and

CountNonNull of sample

 

then put formula tool to calculate

 

sqrt([Variance] * ([CountNonNull] - 1)  / [CountNonNull])

 (Which is "=STDEV.P()" in excel)