Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. > # Percentage Error
  2. > df<-data.frame(mydata$maxtp[742:927],finalforecastvalues)
  3. > col_headings<-c("Actual Weather","Forecasted Weather")
  4. > names(df)<-col_headings
  5. > attach(df)
  6. The following objects are masked from df (pos = 4):
  7.  
  8. Actual Weather, Forecasted Weather
  9.  
  10. The following objects are masked from df (pos = 6):
  11.  
  12. Actual Weather, Forecasted Weather
  13.  
  14. The following objects are masked from df (pos = 7):
  15.  
  16. Actual Weather, Forecasted Weather
  17.  
  18. The following objects are masked from df (pos = 8):
  19.  
  20. Actual Weather, Forecasted Weather
  21.  
  22. The following objects are masked from df (pos = 11):
  23.  
  24. Actual Weather, Forecasted Weather
  25.  
  26. > percentage_error=((df$`Actual Weather`-df$`Forecasted Weather`)/(df$`Actual Weather`))
  27. > percentage_error
  28. [1] 0.1221641965 0.1550726506 0.0027798558 0.0269008361
  29. [5] 0.0141587687 0.0138431605 0.1383544854 0.1270658764
  30. .....
  31. [181] 0.1014693353 0.1019379867 0.0170029142 -0.0102615539
  32. [185] -0.0103016944 -0.1361414900
  33. > mean(percentage_error)
  34. [1] -0.00337078
  35. > percentage_error=data.frame(abs(percentage_error))
  36. > accuracy=data.frame(percentage_error[percentage_error$abs.percentage_error. < 0.1,])
  37. > frequency=as.data.frame(table(accuracy))
  38. > sum(frequency$Freq)/186
  39. [1] 0.7043011
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement