IntegratedBreedingPlatform / ShinyBrAPPs

0 stars 0 forks source link

STA :: Can't fit RCBD with SpATS #6

Open mcrimi opened 2 years ago

mcrimi commented 2 years ago

Environment

BMS URL: https://www.bms-uat-test.net/ibpworkbench/main/app/#/ STA BrAPP URL: http://34.207.203.223/app/stabrapp CROP: Maize STUDY: 2022 PVT

Steps 1) Query data and fit SpATS for all environments and PH_M_cm

Error

No fitted model found for PH_M_cm in 3177-BASF Namur (BNAM).
second argument must be a list

cc: @leova @jframi ss1

leova commented 2 years ago

I was not able to fix it at this point so I am only adding more precise information concerning the origin of the error.

It occurs for the environment 3177 with any of the 3 traits (PAsp_E_1to5, AleuCol_E_1to5, PH_M_cm). The function SpATS:SpATS() throws the following errors:

The design matrix associated to the random part of the model is not of full rank. Please check that there are no redundant >components in the random part of the model.

The design matrix associated to the fixed part of the model is not of full rank. Please check that there are no redundant >components in the fixed part of the model.

(genotype being fitted successively as fixed then random effect)

I understand that the matrix design is (repId, row, col). For environment 3177, the rank of this matrix is 2 (therefore not full rank) whereas it is 3 for environments 3176 and 3176 (see code below).

@mcrimi @jframi could the rcbd design be wrong for 3177?

> foo$data[studyDbId==3177 & observations.observationVariableName == "PH_M_cm", .(replicate, positionCoordinateX, positionCoordinateY)] %>% as.matrix()
      replicate positionCoordinateX positionCoordinateY
 [1,]         1                   1                   1
 [2,]         1                   1                   2
 [3,]         1                   1                   3
 [4,]         1                   1                   4
 [5,]         1                   1                   5
 [6,]         1                   1                   6
 [7,]         1                   1                   7
 [8,]         1                   1                   8
 [9,]         1                   1                   9
[10,]         1                   1                  10
[11,]         2                   2                   1
[12,]         2                   2                   2
[13,]         2                   2                   3
[14,]         2                   2                   4
[15,]         2                   2                   5
[16,]         2                   2                   6
[17,]         2                   2                   7
[18,]         2                   2                   8
[19,]         2                   2                   9
[20,]         2                   2                  10
> foo$data[studyDbId==3177 & observations.observationVariableName == "PH_M_cm", .(replicate, positionCoordinateX, positionCoordinateY)] %>% as.matrix() %>% rankMatrix()
[1] 2
attr(,"method")
[1] "tolNorm2"
attr(,"useGrad")
[1] FALSE
attr(,"tol")
[1] 4.440892e-15
> foo$data[studyDbId==3176 & observations.observationVariableName == "PH_M_cm", .(replicate, positionCoordinateX, positionCoordinateY)] %>% as.matrix() %>% rankMatrix()
[1] 3
attr(,"method")
[1] "tolNorm2"
attr(,"useGrad")
[1] FALSE
attr(,"tol")
[1] 4.440892e-15
> foo$data[studyDbId==3175 & observations.observationVariableName == "PH_M_cm", .(replicate, positionCoordinateX, positionCoordinateY)] %>% as.matrix() %>% rankMatrix()
[1] 3
attr(,"method")
[1] "tolNorm2"
attr(,"useGrad")
[1] FALSE
attr(,"tol")
[1] 4.440892e-15