Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > # Percentage Error
- > df<-data.frame(mydata$maxtp[742:927],finalforecastvalues)
- > col_headings<-c("Actual Weather","Forecasted Weather")
- > names(df)<-col_headings
- > attach(df)
- The following objects are masked from df (pos = 4):
- Actual Weather, Forecasted Weather
- The following objects are masked from df (pos = 6):
- Actual Weather, Forecasted Weather
- The following objects are masked from df (pos = 7):
- Actual Weather, Forecasted Weather
- The following objects are masked from df (pos = 8):
- Actual Weather, Forecasted Weather
- The following objects are masked from df (pos = 11):
- Actual Weather, Forecasted Weather
- > percentage_error=((df$`Actual Weather`-df$`Forecasted Weather`)/(df$`Actual Weather`))
- > percentage_error
- [1] 0.1221641965 0.1550726506 0.0027798558 0.0269008361
- [5] 0.0141587687 0.0138431605 0.1383544854 0.1270658764
- .....
- [181] 0.1014693353 0.1019379867 0.0170029142 -0.0102615539
- [185] -0.0103016944 -0.1361414900
- > mean(percentage_error)
- [1] -0.00337078
- > percentage_error=data.frame(abs(percentage_error))
- > accuracy=data.frame(percentage_error[percentage_error$abs.percentage_error. < 0.1,])
- > frequency=as.data.frame(table(accuracy))
- > sum(frequency$Freq)/186
- [1] 0.7043011
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement