Search
Question: predict.opls() doesn't work when Y is a matrix
0
gravatar for scottericr
4 weeks ago by
scottericr0
scottericr0 wrote:

I'm not sure if this is a bug, or a limitation of predict(), but when I try to use predict() on an PLS object created by opls() where X and Y are both matrices with multiple columns, it throws an error.

library(ropls)

data(sacurine)
attach(sacurine)

train.X <- dataMatrix[1:130, ]
train.Y <- sampleMetadata[1:130, 1:2]
sacurine.pls <- opls(train.X, as.matrix(train.Y))
#> PLS
#> 130 samples x 109 variables and 2 responses
#> standard scaling of predictors and response(s)
#>       R2X(cum) R2Y(cum) Q2(cum) RMSEE pre ort
#> Total    0.203    0.343   0.156  6.19   2   0

test.X <- dataMatrix[131:183, ]
predict(sacurine.pls, test.X)
#> Error in dimnames(predMCNFcVcn) <- list(rownames(newdata), "pred"): length of 'dimnames' [2] not equal to array extent


devtools::session_info()
#> Session info -------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.4.4 (2018-03-15)
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  tz       America/New_York            
#>  date     2018-06-20
#> Packages -----------------------------------------------------------------
#>  package      * version date       source                          
#>  backports      1.1.2   2017-12-13 CRAN (R 3.4.3)                  
#>  base         * 3.4.4   2018-03-15 local                           
#>  Biobase        2.36.2  2017-05-04 Bioconductor                    
#>  BiocGenerics   0.22.1  2017-10-07 Bioconductor                    
#>  compiler       3.4.4   2018-03-15 local                           
#>  datasets     * 3.4.4   2018-03-15 local                           
#>  devtools       1.13.5  2018-02-18 CRAN (R 3.4.3)                  
#>  digest         0.6.15  2018-01-28 CRAN (R 3.4.3)                  
#>  evaluate       0.10.1  2017-06-24 CRAN (R 3.4.0)                  
#>  graphics     * 3.4.4   2018-03-15 local                           
#>  grDevices    * 3.4.4   2018-03-15 local                           
#>  htmltools      0.3.6   2017-04-28 cran (@0.3.6)                   
#>  knitr          1.20    2018-02-20 CRAN (R 3.4.3)                  
#>  magrittr       1.5     2014-11-22 CRAN (R 3.4.0)                  
#>  memoise        1.1.0   2017-04-21 CRAN (R 3.4.0)                  
#>  methods      * 3.4.4   2018-03-15 local                           
#>  parallel       3.4.4   2018-03-15 local                           
#>  Rcpp           0.12.17 2018-05-18 CRAN (R 3.4.4)                  
#>  rmarkdown      1.9     2018-03-01 CRAN (R 3.4.3)                  
#>  ropls        * 1.8.0   2017-04-25 Bioconductor                    
#>  rprojroot      1.3-2   2018-01-03 CRAN (R 3.4.3)                  
#>  stats        * 3.4.4   2018-03-15 local                           
#>  stringi        1.2.2   2018-05-02 CRAN (R 3.4.4)                  
#>  stringr        1.3.1   2018-05-10 CRAN (R 3.4.4)                  
#>  tools          3.4.4   2018-03-15 local                           
#>  utils        * 3.4.4   2018-03-15 local                           
#>  withr          2.1.2   2018-06-07 Github (jimhester/withr@dbcd7cd)
#>  yaml           2.1.19  2018-05-01 CRAN (R 3.4.4)
ADD COMMENTlink modified 4 weeks ago by etienne.thevenot0 • written 4 weeks ago by scottericr0
0
gravatar for etienne.thevenot
4 weeks ago by
France
etienne.thevenot0 wrote:

Thanks for reporting this bug which has been fixed in the 1.13.2 version of ropls (dev).

Etienne.

ADD COMMENTlink written 4 weeks ago by etienne.thevenot0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 232 users visited in the last hour