R/new.penalized.pls.R

`new.penalized.pls` <-
function(ppls,Xtest,ytest=NULL){

  ncomp=ncol(ppls$coefficients)
  
  #if (!is.matrix(Xtest)) Xtest=matrix(Xtest,ncol=1)

  ypred<-Xtest%*%ppls$coefficients +rep(1,nrow(Xtest))%*%t(ppls$intercept)

  mse=NULL

  if (!is.null(ytest)){

    yres=ypred-ytest

    mse=apply(yres^2,2,mean)

  }

  return(list(ypred=ypred,mse=mse))

}

Try the ppls package in your browser

Any scripts or data that you put into this service are public.

ppls documentation built on May 1, 2019, 10:53 p.m.