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

Test-day model with Legendre polynomials #108

Closed amizeranschi closed 3 years ago

amizeranschi commented 3 years ago

Hello,

I'm trying to implement a single-trait random regression test-day model for somatic cell score measured in monthly test-day milk records, for animals in their first lactation, using Legendre polynomials of third degree to model lactation curves. The model is very similar to the one presented in Appendix E, page 77 in the BLUPF90 manual: http://nce.ads.uga.edu/wiki/lib/exe/fetch.php?media=blupf90_all7.pdf

If my pheno data frame looks like below and I also have a corresponding object for the pedigree (animal, sire, dam), then how could I implement the model mentioned above in BreedR, using the remlf90() function, in order to compute variance components and breeding values?

> str(pheno)
'data.frame':   7791 obs. of  8 variables:
 $ herd          : num  5 5 5 5 5 5 5 5 5 5 ...
 $ herd_year_test: num  75 75 76 75 74 76 76 77 76 77 ...
 $ alpha0        : num  0.707 0.707 0.707 0.707 0.707 ...
 $ alpha1        : num  0.936 0.909 -0.621 0.346 -0.339 ...
 $ alpha2        : num  0.595 0.517 -0.181 -0.602 -0.609 ...
 $ alpha3        : num  -0.0562 -0.1693 0.8134 -0.6868 0.6774 ...
 $ som_cell_score: num  2.62 2.38 1 3.01 3.14 ...
 $ animal        : num  1949 1908 1730 1984 1858 ...

P.S. I've skipped column 7 (weight for residuals) from the BLUPF90 example, as I don't intend to use this.

famuvie commented 3 years ago

Hi,

Sorry, breedR does not do random regression.

I had started working on that, but could not follow up. I attach (Longitudinal.R.zip) some proof-of-concept code where I sketched the inner workings that should be implemented to make it work. If you feel adventurous, feel free to check and adapt to your needs. However, note that these are untested and unsupported procedures that tinker with the internals of breedR.

Hope it helps.

ƒacu.-

amizeranschi commented 3 years ago

Thanks for the reply and sorry to hear that random regression is not supported. You mentioned some attachment but this doesn't seem to appear anywhere, neither in the e-mail I got from GitHub, nor on the Github issue page itself.

By any chance, could you recommend any alternative packages (R or 3rd party) that do random regression and could be used to implement the model that I mentioned? BLUPf90 itself seems a bit difficult to set up properly.

famuvie commented 3 years ago

Sorry, I added the link in the comment above. Concerning the package to implement such a model, I think MCMCglmm would be suitable. But I haven't actually tried.

Don't hesitate to report your findings here, for reference! It can be of help to other people. Thanks in advance for that.

Please, in the future use the discussion group for general questions like this. The GitHub issues is more appropriate for tracking specific problems that need to be tackled. Thank you.