Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Calculation 95/5 Sampling

jferrone
8 - Asteroid

I am trying and failing to replicate this calculation in Alteryx and Excel.

 

Your recommended sample size is: 225
The sample size (n) is calculated according to the formula: n = [z2 * p * (1 - p) / e2] / [1 + (z2 * p * (1 - p) / e2 * N)]

Where: z = 1.96 for a confidence level (α) of 95%, p = proportion (expressed as a decimal), N = population size, e = margin of error.

z = 1.96, p = 0.5, N = 542, e = 0.05

n = [1.962 * 0.5 * (1 - 0.5) / 0.052] / [1 + (1.962 * 0.5 * (1 - 0.5) / 0.052 * 542)]

n = 384.16 / 1.7088 = 224.815

n ≈ 225

The sample size (with finite population correction) is equal to 225

 

https://goodcalculators.com/sample-size-calculator/

 

---

 

I have 4 Formulas in Alteryx at the moment and a constant for record count (542 in this case)

 

a2 = POW(1.96,2) 

e2 = POW(0.05,2)

Calculation P1 = ([a2]*0.5*(1-0.5)/[e2])

Calculation P2 = 1 + ([a2] * 0.5 * (1 - 0.5) / [e2] * [Count])

 

The first 3 calculations match the expected results but Calculation P2 is incorrect. I received similar results in Excel. The final result should be Calculation P1 / Calculation P2.

 

Any idea what I am doing wrong? 

 

Calculation.PNG

5 REPLIES 5
Claje
14 - Magnetar

Hi,


I think you're just missing a set of parentheses around the denominator for Calculation P2 (I also think that the website this is coming from is missing the same parentheses).

 

If I run calculation P2 as 1 + [a2] * 0.5 * (1 - 0.5) /( [e2] * 542)

 

I get to the Final result of 225.

Kenda
16 - Nebula
16 - Nebula

Hi @jferrone 

 

I think your denominator is just missing some parenthesis. For your Calculation P2, change it to 

1 + (([a2] * 0.5 * (1 - 0.5)) / ([e2] * [Count]))

 and see if that gets you what you're looking for. 

jferrone
8 - Asteroid

Thank you both for your help, I appreciate the quick response 

bbpogs
5 - Atom

Hi sir,

 

Hope you could share the updated workflow. 

andrewsh
5 - Atom

in case someone else finds this like I did and got stumped by the answer.

((pow(1.96,2) * 0.5 * (1 - 0.5)) / (pow(.05,2))/
(1 + ((pow(1.96,2) * 0.5 * (1 - 0.5)) / (pow(.05,2) * 542))))

 

That is how it looks in alteryx formulas. 

there were a few more parentheses I had to add to make it work. 

 

Labels
Top Solution Authors