Description Usage Arguments Details Value Author(s) See Also Examples
Classify multivariate observations in conjunction with nlda, and also
project data onto the linear discriminants.
| 1 2 | 
| object | Object of class  | 
| newdata | A matrix or data frame of cases to be classified. | 
| dim2use | The dimension of rotated data set to be used in prediction. | 
| ... | Arguments passed to or from other methods. | 
This function is a method for the generic function predict() for
class nlda. If newdata is omitted, the results of training data 
in nlda object will be returned.
A list with components:
| class | The predicted class (a factor). | 
| x | The projections of test data on discriminant variables. | 
| prob | The posterior probabilities for the predicted classes. | 
| xmeans | The group means obtained from training. | 
| dim2use | The dimension of rotated data set to be used in prediction. | 
David Enot dle@aber.ac.uk and Wanchang Lin wll@aber.ac.uk.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | data(abr1)
cl   <- factor(abr1$fact$class)
dat  <- abr1$pos
## divide data as training and test data
idx <- sample(1:nrow(dat), round((2/3)*nrow(dat)), replace=FALSE) 
## constrcuct train and test data 
train.dat  <- dat[idx,]
train.t    <- cl[idx]
test.dat   <- dat[-idx,]        
test.t     <- cl[-idx] 
## apply NLDA
model    <- nlda(train.dat,train.t)
pred.te  <- predict(model, test.dat)
## confusion matrix
table(test.t,pred.te$class)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.