Trying to understand how to conduct a power analysis of logistic regressions I am have conducted some logistic regressions in R comparing an estimate of ancestry with some other variables. My advisor has asked me to do power analyses on these. I do not have the greatest background in statistics, and I need some help.
Each regression is fairly simple, it is just a logistic regression testing association with one variable in a subset of my data.
I have come across some calculators such as this
https://rdrr.io/cran/WebPower/man/wp.logistic.html or https://webpower.psychstat.org/models/reg02/
and this
https://www.dartmouth.edu/~eugened/power-samplesize.php
but I am very lost. How exactly do I calculate p0 and p1 or a minimum detectable odds ratio?
My ancestry values make up my x-axis (and range from 0 to 1), but none of my ancestry data points are 0 or 1. Are p0 and p1 based on the regression equation calculated by R, or my actual data?
I cannot seem to find a good tutorial for how to conduct these power analyses, so I am coming here for help.
CLARIFICATION
My x-axis variable is a float measure of ancestry ranging from 0 and 1. I am testing whether various binary variables (absence or presence of traits, 0 or 1) are associated with ancestry. Our sample sizes are small, so we want to do a power analysis to determine how likely we could actually detect a true positive.

OK, so this should be fairly straight forward.  Since the outcome (has trait, does not have trait) is a binary variable, you can use logistic regression with the ancestry variable as a predictor.
Because you have a fixed sample size, a better approach is to calculate power but rather to calculate what effects can be reasonable estimated with a specific statistical power.  The formula for this is
$$ \pm \beta_{j}^{a}=\frac{z_{1-\alpha / 2}+z_{\gamma}}{\sigma_{x_{j}} \sqrt{n p(1-p)\left(1-\rho_{j}^{2}\right)}}$$
Here:

*

*$\beta$ is the log odds ratio for the ancestry variable


*$z_{1-\alpha/2}$ is the $1-\alpha/2$ quantile of a standard normal.  If you use a standard false positive rate of $\alpha=0.05$ then $z_{1-\alpha/2} = 1.96$


*$z_\gamma$ is the $\gamma$ quantile of a standard normal, where $\gamma$ is the desired statistical power.  If you use a standard power of $\gamma=0.8$ then $z_\gamma = 0.84$.


*$\sigma_{x}$ is the standard deviation of the ancestry predictor.


*$n$ is the sample size


*$p$ is the marginal probability of the outcome (the sample mean of the outcome ignoring the ancestry variable).


*$1-\rho^2$ is the variance inflation factor, but since you only have a single predictor you can ignore this.
This formula will tell you the log odds ratio you can detect at a given power with your sample.
