# Caclulating Sample Size

#### Junior22

##### New Member
First time posting, long-time reader. I'm sure this is simple for you guys, but I can't figure out how to calculate the sample size needed to detect a specific difference for a retrospective cohort paper.

For example: I wanted to look at the difference between the length of stay for Procedure A done on Monday versus Friday. I can calculate a t-test easy enough, but I don't know how to figure out if my n is large enough to find a significant difference. I know how many roughly are done per year across the country, I know how many are done at our institution per year. I know the average length of stay at our institution as well as nationally. I'm just not sure how to go about this. Any advice would be helpful.

The link below is helpful, but I'm not entirely sure I know how to provide the proper population size.

https://www.qualtrics.com/blog/calculating-sample-size/

#### GretaGarbo

##### Human
Look at this wikipedia page about the power of test at the example section.

With sigma/sqrt(n) you can replace that with (sigma/sqrt(n))*sqrt((N-n)/(N-1)) where N is the populations size. But if N is large (say larger than 1000) and n is small (say 50) then you are essentially dividing 1 by 1. So then, the population size does not matter. Or just enter a guessed large number. But the sample size n matters.

#### j58

##### Active Member
That qualtrics online calculator is inappropriate for a two-sample t-test. Accurate calculation of the required sample size for a t-test employs iterative methods and so really necessitates using software. One (free) option is to install the statistical software program "R" (google it) and then use the 'power.t.test' function to determine your required sample size.