I am facing trouble in calculating the calibration factor using minor allele frequency in R.

The research paper related to this calculation is; https://www.nature.com/articles/nprot.2014.071 . It has the formula for calculating the calibration factor but i dont understand how to use it.

Could anyone please let me know that how should i write a script so that i will get the calibration factor of my GWAS summary statistics. Do i have to use average minor allele frequency from the summary statistics? I am following the paper whose link i pasted above. There is a calibration factor for other reference panels in that paper but i need to calculate the calibration factor for TOPMED reference imputation panel. Please help me in this regard.

Thanking you in advance.