# 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])
#Linear Discriminant Analysis, assuming that Mid-Points are independent of LogRanges
# (Configuration C4)
ChinaldaC4 <- lda(ChinaT,ChinaTemp$GeoReg,Config=4)
cat("China linear discriminant analysis results =\n") ; print(ChinaldaC4)
cat("lda Prediction results:\n")
print(predict(ChinaldaC4,ChinaT)$class)
#Estimate error rates by three-fold cross-validation, replicated five times
CVldaC4 <- DACrossVal(ChinaT,ChinaTemp$GeoReg,TrainAlg=lda,Config=4,kfold=3,CVrep=5)
summary(CVldaC4[,,"Clerr"])
glberrors <-
apply(CVldaC4[,,"Nk"]*CVldaC4[,,"Clerr"],1,sum)/apply(CVldaC4[,,"Nk"],1,sum)
cat("Average global classification error =",mean(glberrors),"\n")
Run the code above in your browser using DataLab