Guest User

Untitled

a guest
May 2nd, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. times = c("2015-12-30 20:00:00", "2016-01-06 20:00:00",
  2. "2016-01-08 20:00:00", "2016-01-11 20:00:00",
  3. "2016-01-13 20:00:00", "2016-01-14 20:00:00",
  4. "2016-01-15 20:00:00", "2016-01-18 20:00:00",
  5. "2016-01-20 20:00:00", "2016-01-21 20:00:00",
  6. "2016-01-25 20:00:00")
  7. counts = c(7, 14, 61, 1, 2, 66, 10, 35, 1, 304, 2)
  8. df <- data.frame(timestamp = as.POSIXct(times, format="%Y-%m-%d %H:%M:%S",
  9. tz="Pacific/Auckland"),
  10. count = counts)
  11.  
  12. hist(df$count)
  13.  
  14. qqnorm(df$count)
  15. qqline(df$count)
  16.  
  17. lambda <- geoR::boxcoxfit(df$count)$lambda
  18. df$transformed <- car::bcPower(df$count, lambda=lambda)
  19.  
  20. timestamp count transformed zscore
  21. 1 2015-12-30 20:00:00 7 1.7922836 -0.14446864
  22. 2 2016-01-06 20:00:00 14 2.3618561 0.22598616
  23. 3 2016-01-08 20:00:00 61 3.4646761 0.94326978
  24. 4 2016-01-11 20:00:00 1 0.0000000 -1.31018523
  25. 5 2016-01-13 20:00:00 2 0.6729577 -0.87248782
  26. 6 2016-01-14 20:00:00 66 3.5198741 0.97917102
  27. 7 2016-01-15 20:00:00 10 2.0895953 0.04890541
  28. 8 2016-01-18 20:00:00 35 3.0646823 0.68311037
  29. 9 2016-01-20 20:00:00 1 0.0000000 -1.31018523
  30. 10 2016-01-21 20:00:00 304 4.5195550 1.62937200
  31. 11 2016-01-25 20:00:00 2 0.6729577 -0.87248782
Add Comment
Please, Sign In to add comment