Greetings,

I have been exploring the use of the caret package to conduct some plsda
modeling.  Previously, I have come across methods that result in a R2 and
Q2 for the model.  Using the 'iris' data set, I wanted to see if I could
accomplish this with the caret package.  I use the following code:

library(caret)
data(iris)

#needed to convert to numeric in order to do regression
#I don't fully understand this but if I left as a factor I would get an
error following the summary function
iris$Species=as.numeric(iris$Species)
inTrain1=createDataPartition(y=iris$Species,
    p=.75,
    list=FALSE)

training1=iris[inTrain1,]
testing1=iris[-inTrain1,]

ctrl1=trainControl(method="cv",
    number=10)

plsFit2=train(Species~.,
    data=training1,
    method="pls",
    trControl=ctrl1,
    metric="Rsquared",
    preProc=c("scale"))

data(iris)
training1=iris[inTrain1,]
datvars=training1[,1:4]
dat.sc=scale(datvars)

n=nrow(dat.sc)
dat.indices=seq(1,n)

timematrix=with(training1,
        classvec2classmat(Species[dat.indices]))

pls.dat=plsr(timematrix ~ dat.sc,
    ncomp=3, method="oscorespls", data=training1)

x=crossval(pls.dat, segments=10)

summary(x)
summary(plsFit2)

I see two different R2 values and I cannot figure out how to get the Q2
value.  Any insight as to what my errors may be would be appreciated.

Regards,

-- 
Charles

	[[alternative HTML version deleted]]

