Should I calculate sample size before collecting data? Or I should calculate sample size after collecting some data (probably can collect more if needed)?

It is because I would like to do logistic regression, but I am not quite sure the statistics about the prevalence etc. What should I do?

It would be great if you could also share the equation/ formula for calculating sample size for multiple logistic regression.



1 Answer 1


You definitely calculate sample size before collecting the sample. The problem with calculating the sample size afterward is that you would be using the same preliminary data to test an effect size as to find the power to detect that effect. If the null were indeed true, this could lead to a dog-chasing-its-own-tail scenario where you need an N of 100 to have 80% power to detect an OR of 0.5, N of 200 to have 80% power to detect an OR of 0.75, and so on and so forth...

Sometimes a post-hoc power calculation is presented after a main analysis. This is mostly to convince the readers that even a very statistically significant result is less than incidental.

It is of course impossible to know the exact power of a proposed analysis without any preliminary data on the subject. When we don't know prevalence(s), associations, effect size and such, we make reasonable guesses based on a range of possibilities that must be both 1) plausible and 2) scientifically interesting. For instance, if I find a new drug and claim it cures cancer completely, 100% survival, I would only need a sample of like 10 people, but it would be unethical to conduct that study unless there were other scientific reasons to actually believe the drug did as much.

Lastly (in my experience) we do power for multivariate models the same way we do them in univariate models. We use for power calculation the (log) odds ratio and its SE that would be obtained in a multivariate model and adjust the degrees of freedom of the test.

  • $\begingroup$ Thank you for your reply. May I know more about the last sentence in your answer? In particular, I would like to know how to derive the degree of freedom of the test. $\endgroup$ Jun 5, 2018 at 5:07
  • $\begingroup$ The degrees of freedom is a function of the number of parameters in a model. That should be specified a priori. $\endgroup$
    – AdamO
    Jun 5, 2018 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.