Learn R Programming

REPPlab (version 0.9.6)

predict.epplab: Calculates projections for a new Data Object

Description

Calculates the projections of a new data object onto the directions from an existing ebblab object.

Usage

# S3 method for epplab
predict(object, which = 1, data = NULL, ...)

Value

A matrix having in each column the projection onto the direction of a certain run and in each row the projected value.

Arguments

object

Object of class epplab.

which

Onto which direction should the new data be projected.

data

The new data object

...

Additional parameters

Author

Daniel Fischer

Details

The default projection direction is the direction with the best objective criterion. In case that no data is given to the function, the fitted scores for the original data will be returned.

Examples

Run this code

library(tourr)
data(olive)
res <- EPPlab(olive[,3:10], PPalg="PSO", PPindex="KurtosisMin", n.simu=10, maxiter=20)

newData <- matrix(rnorm(80), ncol=8)

# Projection on the best direction
predict(res, data=newData)

# Projection on the best 3 directions
predict(res, which=1:3, data=newData)

# Similar with function fitted() when no data is given:
predict(res)
fitted(res)

Run the code above in your browser using DataLab