khabbazian / l1ou

Detection of evolutionary shifts in Ornstein-Uhlenbeck models
GNU General Public License v2.0
19 stars 7 forks source link

bug fix, efficiencies in fit _OU_model, doc in estimat_convergent_regimes #13

Closed cecileane closed 8 years ago

cecileane commented 8 years ago

My last 2 commits are improvements on the earlier 2 commits by Sabrina.

In fit_OU_model, there is still a problem with "refit", because alpha should not be re-estimated. Instead, the shift values should be rescaled: divided by 1-exp(-alpha * age of shift)

Which internal function should be used to find the age of the shifts, given a particular configuration? If you don't already have a specific function to do that, please let me know, and I would be happy to write one. I will probably use pruningwise.branching.times from phylolm for instance.

After this problem is fixed, we can check the distribution of contrasts again.

khabbazian commented 8 years ago

Thank you Cecile. generate_design_matrix(tr, "apprX") returns a matrix with ages. So something like this would do the job. apply( generate_design_matrix(tr, "apprX")[ ,edgeIndices] , 2, max)