# Simulating data to calculate power for a logistic model

I am new to R and would like to follow the answer to this: Simulation of logistic regression power analysis - designed experiments

I would like specifically to know if I have power to detect a contribution to the model in an interacting co-variate term (Combined represents gene*prs_standardised). My data is case/control group with polygenic risk score and a mix of other continuous and binary covariates.

In order to do this I would like to simulate my own dataset, the model summary is below:

Whilst the P-value for combined implied there is no contribution to the model I am doubtful I am powered to detect this signal and would like to check.

In order to simulate a dataset like this do I need to randomly generate tables/models by setting the parameters for the random numbers based of the min/max/sd of each coefficient? I am not too sure how to do that and any help would be greatly appreciated.

Ideally there would be some kind of code that will look at the distribution of each column making up a coefficient of the table and then simulate data based of it's distribution?

• It sounds like you're interested in calculating post-hoc power, which is generally not recommended. See here for more: stats.stackexchange.com/questions/579152/… Commented Mar 15, 2023 at 17:09
• On why "post hoc power" is misleading, I very much recommend Hoenig & Heisey (2001, The American Statistician) on "The Abuse of Power: The Pervasive Fallacy of Power Calculations for Data Analysis". Commented Mar 15, 2023 at 17:16
• Dear both, this is very helpful thanks. In this instance our research group believe that "prs_standardised" and "gene" are acting in independant (and by virtue of the model) additive ways on the phenotype. Therefore, the high p-value for combined is the result we actually want. The reviewer of our paper would like a power calculation irrespective.... Commented Mar 15, 2023 at 20:33
• This is fine. Your bootstrap is a good idea Commented Oct 7, 2023 at 19:37