Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. library(gdata)
  2. setwd('/Users/akif/Desktop/Dropbox/Courses/ie306/ass2')
  3. d1 <- read.xls('IE306_HW2_data.xls', sheet = 1)
  4. d1 <- d1[[3]]
  5. d1 <- d1[0:-1]
  6.  
  7. print(sprintf("Standard Deviation: %f", sd(d1)))
  8. print(summary(d1))
  9.  
  10. hist(d1, breaks=50, main = "Histogram of Day 1 with 50 breaks")
  11. dev.new()
  12. hist(d1, breaks=100, main = "Histogram of Day 1 with 100 breaks")
  13. dev.new()
  14. hist(d1, breaks=200, main = "Histogram of Day 1 with 200 breaks")
  15.  
  16. expd <-
  17. x2 <- chisq.test(d1, rexp(length(d1), 1/mean(d1)), simulate.p.value=TRUE, B=6, p=rep(1/6,6))
  18. print("H0: Data is exponentially distributed")
  19. if (x2$p.value < qchisq(0.95, 4)) {
  20. print("reject H0")
  21. } else {
  22. print("accept H0")
  23. }
  24.  
  25. r <- 1/mean(d1)
  26. dev.new()
  27. n <- length(d1)
  28. qqplot(rexp(n,r), d1)
  29. qqline(d1, distribution=qexp)
  30.  
  31. dev.new()
  32. plot(diff(d1, lag=1), type="p", col=1)
  33. points(diff(d1, lag=2), col=2, pch="o")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement