# How to calculate sample size in a random sampling? [closed]

How one can calculate the sample size in any random sampling? Is it varies with sampling method or it is fixed for all methods? Explain it.

## closed as off-topic by NCh, Namaste, Claude Leibovici, Shailesh, C. FalconJun 8 '17 at 0:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – NCh, Namaste, Claude Leibovici, Shailesh, C. Falcon
If this question can be reworded to fit the rules in the help center, please edit the question.

• sample size($n$) is not fixed for a fixed population,it is given by the number of sample you have, so you can change it by taking more sample from population; but if there is a cost constraint, $n$ will have a upper bound. – MAN-MADE Jun 5 '17 at 15:36

The design of experiments includes planning to have a large enough sample to accomplish the task at hand. Here are two examples of frequently used statistical procedures, and how the sample size for them can be planned in advance.

CI with a desired margin of error. Perhaps the simplest case is to choose the $n$ that will make the margin of error in a confidence interval be of a desired size. For example, if you are sampling from a normal population with known standard deviation $\sigma$ and you want to use a 95% confidence interval (CI) to estimate the unknown sample mean $\mu$ within $\pm E.$

The CI is of the form $\bar X \pm 1.96\sigma/\sqrt{n}.$ So you can set $E = 1.96\sigma/\sqrt{n},$ and solve for $n = (1.96\sigma/E),$ where all the quantities on the right hand side are known. (If this $n$ is not an integer, it is customary to round up to the next larger integer.)

One-sample t test with a certain power. Suppose we plan to use normal data to test $H_0: \mu = 10$ vs $H_a: \mu > 10$ at the 5% level. If the true value of $\mu$ is actually as large as $\mu = 12,$ you would like to reject $H_0$ with probability 95%. In order to get an answer as to the size of $n$, you need to have an estimate of the population SD. (If you knew the exact value of $\sigma$, this would be a z test, not a t test.) Perhaps another similar experiment has been done before or perhaps you have a good idea of the precision of the equipment you will use. Such prior information can help to estimate $\sigma.$

This is a more complicated problem and is often solved using software. Here is an answer from Minitab statistical software. Notice that I guessed that $\sigma \approx 3.$ Then the procedure says I'd need about $n = 26$ observations for this experiment.

Power and Sample Size

1-Sample t Test

Testing mean = null (versus > null)
Calculating power for mean = null + difference
α = 0.05  Assumed standard deviation = 3

Sample  Target
Difference    Size   Power  Actual Power
2      26    0.95      0.951579


Your question is a very good one. In textbook statistics problems you are often given the results of an experiment or study, with little information or opportunity to think about what went before data collection. But experiments and studies need to be planned in advance. It can be a terrible waste of time and money to do an experiment that has too little data for the task at hand. Part of experimental design is to make reasonable assumptions and plan the sample size in advance.