lamho86 / phylolm

GNU General Public License v2.0
30 stars 12 forks source link

LRT using parametric bootstrap? #30

Closed courtiol closed 3 years ago

courtiol commented 4 years ago

I did not find a way to compare 2 models in the package.

I think that the ability to compare 2 fits of nested models using a Likelihood Ratio Test would be a nice feature to add.

I think that the way to do that properly would be to do it by parametric bootstrap (I would not put much faith in asymptotic tests in this context). I would perform as follows:

  1. extract the difference in logLik between the 2 fits -> diff_obs
  2. simulate the data under the model 1
  3. refit both models on these data
  4. compute the difference in logLik -> diff_sim
  5. redo 2 till 4 boot times (using the future backend for parallel processing) The p-value would be classically (1 + sum(diff_obs >= diff_sim)) / (boot + 1) I don't think that would be much work since a parametric bootstrap is already implemented to test for the coefficients.

What do you think?

Perhaps, it should be decomposed into a few functions. For example having a method simulate() that we could call would be potentially useful for other applications too.

If you are interested, what is your bandwidth at the moment? I could probably PR that but not immediately...

cecileane commented 4 years ago

It looks like great ideas! I have too many unfinished projects at the moment... so no bandwidth to work on this right now, unfortunately.