famuvie / breedR

Statistical methods for forest genetic resources analysts
http://famuvie.github.io/breedR/
GNU General Public License v3.0
31 stars 24 forks source link

Extend `competition` to the case without coordinates #111

Open timflutre opened 2 years ago

timflutre commented 2 years ago

Hi Facundo,

I hope you are going well!

I would like to use both competition models from Muir (2005). The first one corresponds to the "tree" case as implemented by you in breedR, thanks! The second one corresponds to the "animal" case in the paper. I am interested in trying the latter but for that we need to drop the "coordinate" requirements of the competition and additive_genetic_competition functions. Instead we need a "group" ("pen") argument indicating which phenotypic data comes from which genotype in which "group". And in plants, a genotype may be in several different groups...

Does it sound simple to do for you? If yes, by any chance, would you have the time to do it? Otherwise, can I try to do it and submit a pull request?

Best, Tim

famuvie commented 2 years ago

Hi Tim! nice to hear from you. I can see what you are willing to do. In principle, it should not be too complicated to do. It reduces to some argument checking and triggering a new function for building the corresponding incidence matrices. The most annoying part would be to update all the argument checking and testing. Still, I won't be able to work on it at least before September or even October. A pull-request would be most welcome. I can provide assistance for understanding the structure of the code if needed. ƒacu.-

timflutre commented 2 years ago

Thanks for your quick answer. I will try...!

I forked the repo, created a new branch (compet-without-coord) and started to add tests in a new file test-competition-without-coord.R. For these new tests to pass (as well as the old ones), I added a group argument which should correspond to a column of data and contain the group membership of any individual. You can see the commit here: https://github.com/famuvie/breedR/compare/master...timflutre:compet-without-coord. I think that the competition function should not return an object inheriting from spatial anymore, at least not when group is supplied.

What do you think? Did I start in the right direction?

famuvie commented 2 years ago

Tim, this is extremely well headed. I've only skimmed through the changes, but I think you've correctly identified the key functions that need to be modified.