matthewwolak / nadiv

R package that constructs (non)additive genetic relationship matrices, and their inverses, from a pedigree to be used in linear mixed effect models (A.K.A. the 'animal model').
17 stars 7 forks source link

Issue in heritability estimation using nadiv #33

Closed sameerjoshi23 closed 3 years ago

sameerjoshi23 commented 3 years ago

Hi, I am fairly new to R. I am using your alfalfa dataset to learn about computing heritability. I got this error, could you please tell me why I am getting this error and how to fix this. Thank you.

H2 <- nadiv:::pin(model1, tmp ~ V1 / (V1 + V2)) Error in names(pframe) <- paste("V", seq(1, length(pframe)), sep = "") : 'names' attribute [2] must be the same length as the vector [0]

matthewwolak commented 3 years ago

Hi, What did you use to produce the model1 object?

Under the current version of nadiv (v2.17.1), the pin() function only works with output from the asreml R package version 3. The currently available version of asreml in R is now version 4 and does not work with the nadiv::pin() function.

Instead, asreml provides their vpredict() function which accomplishes the same thing as nadiv's pin() function.

Alternatively, you can use the free, open source gremlin package (see gremlin on GitHub. You can do univariate models with the current version of gremlin (though, soon multivariate model capability will be implemented) and use gremlin's deltaSE() function to estimate standard errors on linear combinations of variance components (i.e., the delta method used by nadiv::pin() and asreml::vpredict()).

Thus, the nadiv pin() function is deprecated and will be removed from a future version of nadiv.

matthewwolak commented 3 years ago

devel branch of nadiv now indicates the pin() function is deprecated: fe873870c2daa12f4265af2ab16f1096817abac1

sameerjoshi23 commented 3 years ago

Hi Matthew,

Thanks a lot for your explanation. I used vpredict and it worked.

sameerjoshi23 commented 3 years ago

Hi Matthew,

Sorry, I have another query, I am learning to estimate BLUEs and BLUPs. I am getting negative values for BLUEs and BLUPs. Could you please tell me how to deal with these negative values. Thanks in advance.

Cheers Sameer

matthewwolak commented 3 years ago

Hi Sameer, I do not understand, it is perfectly reasonable to expect that both BLUEs and BLUPs contain negative values.

sameerjoshi23 commented 3 years ago

Hi Matthew,

Thanks a lot for your help. Much appreciated.