predict.bigsgPLS: predict.sgpls

Description Usage Arguments Examples

View source: R/predict.R

Description

Predicted values based on (sparse or sparse group) PLS models. Regression coefficient and new predictions are given using the new observations.

Usage

1
2
3
## S3 method for class 'bigsgPLS'
predict(object, newX, ng = 1, comps = object$ncomp,
  da = FALSE, ...)

Arguments

object

An object of class bigsgPLS

newX

matrix or big.matrix object to make prediction on.

ng

The number of chuncks used to read in the data and process using parallel computing.

comps

A vector with the number of components to use in the PLS fit.

da

Discriminant analysis argument to provide class estimates.

...

Further arguments passed for methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
set.seed(1)
library(bigmemory)
n <- 15000
p <- 50
X = scale(matrix(rnorm(n*p), ncol = p, nrow = n))
y = X[,1:5] %*% 1:5 + rnorm(n)

X.bm <- as.big.matrix(X)
y.bm <- as.big.matrix(y)

library(doParallel)
registerDoParallel(cores = 2)
getDoParWorkers()
fit.PLS <- bigsgpls(X.bm, y.bm, case = 4, H = 4, ng = 10, keepX = rep(5,4), regularised = "sparse")
pred.fit <- predict(fit.PLS, newX = X, ng = 1)
round(pred.fit$Beta,3)

matt-sutton/bigsgPLS documentation built on May 12, 2020, 2:47 p.m.