covaruber / sommer

36 stars 23 forks source link

predict function when spl2D is used #38

Closed GregorDall closed 2 years ago

GregorDall commented 2 years ago

Dear Giovanni and co-authors,

I am recently having issues with the predict function. It seems as if the use of the spl2D() function is causing the issue. Below is an example implemented using one of your example datasets in two versions of sommer. I appreciate any advice.

4.1.2

library(sommer) data(DT_cpdata) DT <- DT_cpdata GT <- GT_cpdata MP <- MP_cpdata A <- A.mat(GT)

works

mix <- mmer(Yield~1, random = ~ id , rcov=~units, data=DT, date.warning = FALSE) iteration LogLik wall cpu(sec) restrained 1 -180.5 14:55:39 0 0 2 -180.5 14:55:39 0 0 3 -180.5 14:55:40 1 0 4 -180.5 14:55:40 1 0 temp <- predict.mmer(object = mix, classify = "id", date.warning = FALSE) iteration LogLik wall cpu(sec) restrained 1 -180.5 14:55:40 0 0 2 -180.5 14:55:40 0 0 3 -180.5 14:55:40 0 0 4 -180.5 14:55:40 0 0

does not work

mix <- mmer(Yield~1, random = ~ id + spl2D(Row,Col), rcov=~units, data=DT, date.warning = FALSE)#spl2D(Row,Col) iteration LogLik wall cpu(sec) restrained 1 -174.166 14:55:40 0 0 2 -167.966 14:55:40 0 0 3 -167.006 14:55:40 0 0 4 -166.955 14:55:41 1 0 5 -166.955 14:55:41 1 0 temp <- predict.mmer(object = mix, classify = "id", date.warning = FALSE) Error in [.data.frame(object$dataOriginal, , x) : undefined columns selected

4.1.5

works

mix <- mmer(Yield~1, random = ~ id , rcov=~units, data=DT, date.warning = FALSE) iteration LogLik wall cpu(sec) restrained 1 -180.5 15:0:4 0 0 2 -180.5 15:0:4 0 0 3 -180.5 15:0:4 0 0 4 -180.5 15:0:5 1 0 temp <- predict.mmer(object = mix, classify = "id", date.warning = FALSE) Version out of date. Please update sommer to the newest version using: install.packages('sommer') in a new session Use the 'date.warning' argument to disable the warning message.iteration LogLik wall cpu(sec) restrained 1 -180.5 15:0:5 0 0 2 -180.5 15:0:5 0 0 3 -180.5 15:0:5 0 0 4 -180.5 15:0:5 0 0 Version out of date. Please update sommer to the newest version using: install.packages('sommer') in a new session Use the 'date.warning' argument to disable the warning message.

does not work

mix <- mmer(Yield~1, random = ~ id + spl2Da(Row,Col), rcov=~units, data=DT, date.warning = FALSE)#spl2D(Row,Col) iteration LogLik wall cpu(sec) restrained 1 -174.166 15:0:13 0 0 2 -167.966 15:0:13 0 0 3 -167.006 15:0:13 0 0 4 -166.955 15:0:13 0 0 5 -166.955 15:0:13 0 0 temp <- predict.mmer(object = mix, classify = "id", date.warning = FALSE) Error in [.data.frame(object$dataOriginal, , x) : undefined columns selected

does not work

mix <- mmer(Yield~1, random = ~ id + spl2Db(Row,Col), rcov=~units, data=DT, date.warning = FALSE)#spl2D(Row,Col) iteration LogLik wall cpu(sec) restrained 1 -164.166 15:0:16 1 0 2 -161.888 15:0:16 1 1 3 -160.526 15:0:16 1 2 4 -160.422 15:0:16 1 3 5 -180.5 15:0:16 1 2 temp <- predict.mmer(object = mix, classify = "id", date.warning = FALSE) Error in [.data.frame(object$dataOriginal, , x) : undefined columns selected

covaruber commented 2 years ago

Dear Gregor thanks for making me aware. I will work on the fix as soon as I have some time available. As you may know the predict function is one of those things that is a bit of a headache :D but I will check what happened.

Cheers, Eduardo

GregorDall commented 2 years ago

Thank you, would be nice to have it back up and running if it is an easy fix.

Cheers Gregor

covaruber commented 2 years ago

Gregor, this has been fixed and hopefully will be available on CRAN in the next days.

Cheers, Eduardo

GregorDall commented 2 years ago

Thanks Eduardo!

Cheers Gregor