covaruber / sommer

38 stars 25 forks source link

how to add permanent environmental effect in random regression model ? #45

Closed xiahui625649 closed 1 year ago

xiahui625649 commented 2 years ago

Dear Covarrubias: I wonder add a fixed term of random regression coefficient for block effect and a random term of random regression coefficient for permanent environmental effect in the model : ansRR <- mmer(height~1+block, random= ~ vsr(leg(year,2),line), rcov= ~ units, data=df, verbose = FALSE) but I don't know how to do, can u help me? In addition, how can I determine the order of the Legendre polynomial fitted.

covaruber commented 1 year ago

Dear Xiahui, I can see that you're using properly the function so not sure how can I help you? Please look at the vignettes and come up with a more specific question.

On your second question. determining the order of the polynomial can be done using cross validation (leave one approach) so you stick to the order that provides the highest prediction accuracy. There may be other ways but you may want to look at Mrode's chapter on random regression.

Cheers. Eduardo