# How do I calculate sample size and What is the is the meaning of power in a cross-sectional study?

Here is an example:

Previous research reported that the prevalence of HIV testing among gays is 19.2% . Sample size required to detect this percentage with 95% confidence and .05 precision is 273 (using n = (Z^2 × P(1 – P))/e^2 ). e is precision and Z is the Z score corresponding to 95% i.e. 1.96

Have I done it correctly?

Now what's the importance of having such power: Is it to claim that the sample is representative of that population regarding HIV testing and hence HIV prevalence in my study should be trusted even if it was different from previous research?

Firstly: My calculations yield a required sample size of $239$ (see below for more details).

Secondly: In this context, the concept of power is not needed at all. Power is only needed in the context of statistical testing, where you need to know the distribution of your test statistic under $H_1$. In this context, you are simply interested in "sharpening" your inference made from a sample and don't actually test any hypothesis. The result that you will get can be interpreted as:

"If I gather a sample of size 239, I will be able to conclude with at least 95% probability that the true prevalence of HIV testing amoung homosexuals is within 19.2% $\pm$ 5%." (This holds only if your study also finds a prevalence of 19.2% - see below for more details)

Without going too much into the details (I am sure this is a topic well covered online), we obtain a CI with 1-$\alpha$ probability of covering the proportion $p$ using: $\hat{p} \pm Q^{\mathcal{N} (0,1)}(1-\frac{\alpha}{2})*\sqrt{\frac{\hat{p}*(1-\hat{p})}{n}}$.

If we now decide on a desired "precision" (as you called it) $\delta$, which will reflect half of the width of the obtained CI, we can calculate the required sample size with respect to the chosen $\alpha, \delta$ and $\hat{p}$ as:

$Q^{\mathcal{N} (0,1)}(1-\frac{\alpha}{2})*\sqrt{\frac{\hat{p}*(1-\hat{p})}{n}} \leq \delta$ $\Leftrightarrow$ $n \geq (\frac{Q^{\mathcal{N} (0,1)}(1-\frac{\alpha}{2})}{\delta})^2 * \hat{p}*(1-\hat{p})$.

$Q^{\mathcal{N} (0,1)} (x)$ refers to the $x$ quantile of the $\mathcal{N} (0,1)$ distribution.

In reality, $\hat{p}$ might deviate from the estimated proportion in previous studies (let me call that $\hat{\hat{p}}$). If this is the case, you might not be able to achieve your desired "precision" (In fact you will not be able to achieve your desired precision, if $|\hat{\hat{p}}-0.5| > |\hat{p}-0.5|$) and you will be even more precise if $|\hat{\hat{p}}-0.5| < |\hat{p}-0.5|$.

Now, using the above formula and $\alpha = 0.05$, $\delta = 0.05$ and $p=0.192$, I obtain a required sample size of $239$.