# NOT RUN {
# }
# NOT RUN {
# 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"))
# Skew-Normal based discriminant analysis, asssuming that the different regions differ
# only in location parameters
ChinaT.locsnda <- snda(ChinaT,ChinaTemp$GeoReg,Mxt="Loc")
cat("Temperatures of China -- SkewNormal location model discriminant analysis results:\n")
print(ChinaT.locsnda)
#Estimate error rates by three-fold cross-validation without replication
CVlocsnda <- DACrossVal(ChinaT,ChinaTemp$GeoReg,TrainAlg=snda,Mxt="Loc",
CovCase=CovCase(ChinaT.locsnda),kfold=3,CVrep=1)
summary(CVlocsnda[,,"Clerr"])
glberrors <-
apply(CVlocsnda[,,"Nk"]*CVlocsnda[,,"Clerr"],1,sum)/apply(CVlocsnda[,,"Nk"],1,sum)
cat("Average global classification error =",mean(glberrors),"\n")
# Skew-Normal based discriminant analysis, asssuming that the different regions may differ
# in all SkewNormal parameters
ChinaT.gensnda <- snda(ChinaT,ChinaTemp$GeoReg,Mxt="Gen")
cat("Temperatures of China -- SkewNormal general model discriminant analysis results:\n")
print(ChinaT.gensnda)
#Estimate error rates by three-fold cross-validation without replication
CVgensnda <- DACrossVal(ChinaT,ChinaTemp$GeoReg,TrainAlg=snda,Mxt="Gen",
CovCase=CovCase(ChinaT.gensnda),kfold=3,CVrep=1)
summary(CVgensnda[,,"Clerr"])
glberrors <-
apply(CVgensnda[,,"Nk"]*CVgensnda[,,"Clerr"],1,sum)/apply(CVgensnda[,,"Nk"],1,sum)
cat("Average global classification error =",mean(glberrors),"\n")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab