fgvieira/ngsLD

Meaning of --fit_level flag in fit_LDdecay.R script

albinap opened this issue · 2 comments

I have a question about the --fit_level flag and what it means. When I looked at the help for the fit_LDdecay.R script it said
--fit_level=FIT_LEVEL Fitting level 0) no fitting, best of 1) Nelder-Mead, 2) and BFGS, 3) and L-BFGS-B). [1]
but then I see in the issue error when trying to plot LD decay #3 that --fit_level is set at 100 and I don't understand how that could work.
I have been running the script on my data and often get the error
Error in .fun(piece, ...) :
convergence analyses failed. Please try increasing the fit level (--fit_level)
Calls: rbind ... llply -> loop_apply -> .Call -> -> .fun
Execution halted

I have managed to get plots in some cases (only when using --fit_level 2 but not with 1) but they have not been very useful so far. It would be helpful to clarify the meaning of the --fit_level flag and the range of values that it can have.

The --fit_level controls the fitting of the LD decay function:

  1. tries to fit the function using Nelder-Mead (one iteration)
  2. tries to fit the function using both Nelder-Mead and BFGS (one iteration; chooses the best)
  3. tries to fit the function using both Nelder-Mead, BFGS, and L-BFGS-B (one iteration; chooses the best)

From 4 to 9, it will actually do the same as 3 (they are just reserved if I want to add more fitting methods in the future.

if --fit_level >= 10, it will use the three algorithms (same as in 3) but several times (iterations). So, if you specify --fit_level 100, it will run the three algorithms one hundred times and choose the best one.

Hope it makes sense now.

Yes thank you, excellent explanation. Closing the issue