We would like to confirm a previous result by establishing a new cohort of patients.
I compared the distribution of patients among 2 ordinal variables (figure below). One is a biomarker in 3 categories and the other is a response to treatment in 5 levels. I found a significant association between these 2 variables with a linear-by-linear association test from lbl_test function in R coin package. To confirm this result, I would like to know how many patients I should include in a new study with a power of 90%. I couldn't found how to do it with an R package or PASS software.
Inspired by this post written by gwern, I tried to make power simulation by repeating 2000 times resampling n patients from my datasets until I reach 90% of power. As I'm not a statistician, I'm not sure at all this is the right thing to do...
Is the simulation the good method or is there already an other one to resolve this problem?
Thank you very much for your help.
Code to make sampling and get power:
sim_lbl=function(data.in.ini,n,nb.tot){
#data.in.ini = tables where each row is a patient and the 2 variables are in columns
row.nbs=sample.int(nb.tot, size = n, replace = TRUE) #sampling rows
data.in=data.in.ini[row.nbs,]
pval.lbl=pvalue(lbl_test(table(data.in),alternative = "less"))
pval.lbl
}
nb.tot=nrow(data.in.ini)# nb of patients
n=235
out=replicate(2000,sim_lbl(data.in.ini,n,nb.tot))
mean( out < 0.05 )