#library(verification,lib.loc="/home/paulb/R/x86_64-redhat-linux-gnu-library/2.15"); source("/Volumes/shared_data/paulb/R/Functions/verify_mod.R") #I modified the function "verify" of the package to add the computation of ACC #Parameters of the program you can change ######################################################################## XXX<-"MultiModel" # WCT, MAC, AM, ABP or multiModel. Select the model to be tested ens<-"ensemble" # choose "single" or "ensemble" cor<-"corrected" # choose "corrected" or "uncorrected" method<-"SMC" if (cor=="uncorrected"){correct<-cor} if (cor=="corrected"){correct<-paste(cor,"_",method,sep="")} Directory_Communication<-"/Volumes/shared_data/paulb/Results/Communication/Verification/" Directory_Output<-"/Volumes/shared_data/paulb/Results/Results/Skills/" #Directory where you want your output to be stocked. ################### # Lauch on scilab : # exec('~/Scilab/infectedVerification/infected_XXX') and # exec('~/Scilab/infectedVerification/Climatology.sci') ################### # Computation of the scores for the monthly mean values Names<-c("Scores","MAE","ME","MSE","MSE baseline","MSE persistence","SS baseline","ACC","bias") #Names<-c("Scores","MAE","ME","MSE","bias") Summary<-NULL; for (k in 1:12) { SummaryMonth<-NULL; for (l in 0:2) { predic<- as.vector(as.matrix(read.csv(paste(Directory_Communication,XXX,"_",ens,"_",correct,"_MonthlyMean_Start_Month_",k,"_Pred_Month_",k+l,"_SimulatedCases.csv",sep=""),sep=",",header=FALSE))) pred<-NULL; for (y in 1:24){ pred[y]=mean(predic[y:(y+9-1)]); # Take the mean of the model outputs } obs<-as.vector(as.matrix(read.csv(paste(Directory_Communication,XXX,"_",ens,"_",correct,"_MonthlyMean_Start_Month_",k,"_Pred_Month_",k+l,"_PositiveCases.csv",sep=""),sep=",",header=FALSE))) baseline <- as.vector(as.matrix(read.csv(paste(Directory_Communication,XXX,"_",ens,"_",correct,"_MonthlyMean_Start_Month_",k,"_Pred_Month_",k+l,"_BaselineCases.csv",sep=""),sep=",",header=FALSE))) A<- verify(obs, pred, baseline = baseline, frcst.type = "cont", obs.type = "cont") Skills<-c(A$MAE,A$ME,A$MSE,A$MSE.baseline,A$MSE.pers,A$SS.baseline,A$ACC,A$bias) # Skills<-c(A$MAE,A$ME,A$MSE,A$bias) SummaryMonth<-cbind(SummaryMonth,Skills) } SummaryMonth<-rbind(c(k,k+1,k+2),SummaryMonth) SummaryMonth<-cbind(Names,SummaryMonth) Summary<-rbind(Summary,SummaryMonth) } write.table(Summary,file=paste(Directory_Output,XXX,"_",ens,"_",cor,"_",method,"_MonthlyMean_Continuous_Skill_Scores_3_Month_Predictions.csv",sep=""),quote=FALSE,sep=",") # #Computation of the scores for the anomalies # Names_A<-c("Scores","MAE","ME","MSE","MSE baseline","SS baseline","bias") # Summary_A<-NULL; # for (k in 1:12) { # SummaryMonth_A<-NULL; # for (l in 0:2) { # pred_A<- as.vector(as.matrix(read.csv(paste(Directory_Communication,XXX,"_",ens,"_",cor,"_mean_Anomalies_Start_Month_",k,"_Pred_Month_",k+l,"_SimulatedCases.csv",sep=""),sep=",",header=FALSE))) # obs_A<-as.vector(as.matrix(read.csv(paste(Directory_Communication,XXX,"_",ens,"_",cor,"_mean_Anomalies_Start_Month_",k,"_Pred_Month_",k+l,"_PositiveCases.csv",sep=""),sep=",",header=FALSE))) # baseline_A<-as.vector(as.matrix(read.csv(paste(Directory_Communication,XXX,"_",ens,"_",cor,"_mean_Anomalies_Start_Month_",k,"_Pred_Month_",k+l,"_BaselineCases.csv",sep=""),sep=",",header=FALSE))) # A<- verify(obs_A, pred_A, baseline=baseline_A, frcst.type = "cont", obs.type = "cont") # Skills_A<-c(A$MAE,A$ME,A$MSE,A$MSE.baseline,A$SS.baseline,A$bias) # SummaryMonth_A<-cbind(SummaryMonth_A,Skills_A) # } # SummaryMonth_A<-rbind(c(k,k+1,k+2),SummaryMonth_A) # SummaryMonth_A<-cbind(Names_A,SummaryMonth_A) # Summary_A<-rbind(Summary_A,SummaryMonth_A) # } # write.table(Summary_A,file=paste(Directory_Output,XXX,"_",ens,"_",cor,"_mean_Anomalies_Continuous_Skill_Scores_3_Month_Predictions.csv",sep=""),quote=FALSE,sep=",")