## Calculating Control and Test Samples Using One Proportion

Frequent Contributor
Posts: 144

# Calculating Control and Test Samples Using One Proportion

HI all. I am trying to figure out how to write code which will calculate control and sample sizes based off one group of  direct market response rates.  So, I have a list which looks like this:

Response Rate

 0.647% 2.735% 1.778% 0.252% 1.577% 0.061% 0.354% 0.374% 0.250% 0.192% 0.364% 0.801% 0.674% 1.461% 0.315% 0.468% 1.737% 0.207% 0.162% 0.378% 2.439% 0.400% 2.305% 0.929% 0.497% 1.806%

I know how to do this using two group proportions:

proc power;

TwoSampleFreq

Test=Fisher

Dist= Exact_Cond

Method=Walters

Alpha = 0.05

Sides = 2

GroupProportions = p1  p2

Power = 0.8

NTotal = .

;run;

But How would I modify this program so as one to use just one group in order to generate control and test samples.

Any assistance is greatly appreciated!

Posts: 2,655

## Re: Calculating Control and Test Samples Using One Proportion

If you need to generate two groups' sample size (control and test), then you need to use the two group proportions method, with some minor changes.  First, assume that your control group has a specified proportion, and that your test group may have certain other values.  Second, replace NTotal = . with Npergroup = .;

This should give what you need unless I am severely misunderstanding something.

Steve Denham

Frequent Contributor
Posts: 144

## Re: Calculating Control and Test Samples Using One Proportion

Hi Steve--

Thank you so much for getting back to me.

What I am trying to do is calculate sample sizes for A/B testing.   So if I have a creative test response rate  from a previous experiment  of .00023  what is the test and control sample size of a new A/B test ?    Or if I have two groups one with an average response rate of .00291 and one 00208 what is the test and control sample size of a new A/B test?

Any additional feedback is greatly appreciated!

Is this the correct syntax for two groups?

proc power;

TwoSampleFreq

Test=Fisher

Dist= Exact_Cond

Method=Walters

Alpha = 0.05

Sides = 2

GroupProportions = ( .00291 .00208 )

Power = 0.8

Npergroup  = .

;run;

Thanks you!

Posts: 2,655

## Re: Calculating Control and Test Samples Using One Proportion

The syntax is fine.  When I run, I get 58718 per group, which looks about right given that you want to detect a difference of 0.00083.

As far as detecting a difference from 0.00023 (first scenario), the question is "how big of a difference do you want to detect?"  When you know that, then it is just a matter of plugging in that value.

Steve Denham

Frequent Contributor
Posts: 144

## Re: Calculating Control and Test Samples Using One Proportion

Hi Steve--

Lets say I want a lift of 15% from the previous response rate of 0.00023 ? I can't figure out how to write the syntax for that.

Any feedback is appreciated.

Posts: 2,655

## Re: Calculating Control and Test Samples Using One Proportion

Different terminology for different fields, but if you mean to compare 0.00023 to 1.15 * 0.00023 (which is how I would interpret a 15% lift), then it is just a matter of putting in those two values:

proc power;

TwoSampleFreq

Test=Fisher

Dist= Exact_Cond

Method=Walters

Alpha = 0.05

Sides = 2

GroupProportions = ( .00023 .002645 )

Power = 0.8

Npergroup  = .

;run;

This gives an N per group of 3990.

Steve Denham

Frequent Contributor
Posts: 144

## Re: Calculating Control and Test Samples Using One Proportion

Great that make sense. Last just question: why are you using  a 2 sided model as opposed to 1 sided?? Thanks!

Posts: 2,655

## Re: Calculating Control and Test Samples Using One Proportion

My mistake.  Change to Sides = 1 in the above code, and get 3330 per group.

Steve Denham

Frequent Contributor
Posts: 144

## Re: Calculating Control and Test Samples Using One Proportion

Great -  But real quick why do you feel the one sided approach is the way to go?