predict.gpls: A prediction method for gpls.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/glpls1a.R

Description

A simple prediction method for gpls objects.

Usage

1
2
## S3 method for class 'gpls'
predict(object, newdata, ...)

Arguments

object

A gpls object, typically obtained from a call to gpls

newdata

New data, for which predictions are desired.

...

Other arguments to be passed on

Details

The prediction method is straight forward. The estimated coefficients from object are used, together with the new data to produce predicted values. These are then split, according to whether the predicted values is larger or smaller than 0.5 and predictions returned.

The code is similar to that in glpls1a.train.test.error except that in that function both the test and train matrices are centered and scaled (the covariates) by the same values (those from the test data set).

Value

A list of length two:

class

The predicted classes; one for each row of newdata.

predicted

The estimated predictors.

Author(s)

B. Ding and R. Gentleman

See Also

gpls

Examples

1
2
  example(gpls)
  p1 = predict(m1)

gpls documentation built on May 31, 2017, 11:33 a.m.