# Create an Interval-Data object containing the intervals for 899 observations
# on the temperatures by quarter in 60 Chinese meteorological stations.
ChinaT <- IData(ChinaTemp[1:8],VarNames=c("T1","T2","T3","T4"))
#Linear Discriminant Analysis
ChinaT.lda <- lda(ChinaT,ChinaTemp$GeoReg)
cat("Temperatures of China -- linear discriminant analysis results:\n")
print(ChinaT.lda)
ldapred <- predict(ChinaT.lda,ChinaT)$class
cat("lda Prediction results:\n")
print(ldapred )
cat("Resubstition confusion matrix:\n")
ConfMat(ChinaTemp$GeoReg,ldapred)
if (FALSE) {
#Estimate error rates by ten-fold cross-validation replicated 20 times
CVlda <- DACrossVal(ChinaT,ChinaTemp$GeoReg,TrainAlg=lda,CovCase=CovCase(ChinaT.lda))
summary(CVlda[,,"Clerr"])
}
Run the code above in your browser using DataLab