Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(gdata)
- setwd('/Users/akif/Desktop/Dropbox/Courses/ie306/ass2')
- d1 <- read.xls('IE306_HW2_data.xls', sheet = 1)
- d1 <- d1[[3]]
- d1 <- d1[0:-1]
- print(sprintf("Standard Deviation: %f", sd(d1)))
- print(summary(d1))
- hist(d1, breaks=50, main = "Histogram of Day 1 with 50 breaks")
- dev.new()
- hist(d1, breaks=100, main = "Histogram of Day 1 with 100 breaks")
- dev.new()
- hist(d1, breaks=200, main = "Histogram of Day 1 with 200 breaks")
- expd <-
- x2 <- chisq.test(d1, rexp(length(d1), 1/mean(d1)), simulate.p.value=TRUE, B=6, p=rep(1/6,6))
- print("H0: Data is exponentially distributed")
- if (x2$p.value < qchisq(0.95, 4)) {
- print("reject H0")
- } else {
- print("accept H0")
- }
- r <- 1/mean(d1)
- dev.new()
- n <- length(d1)
- qqplot(rexp(n,r), d1)
- qqline(d1, distribution=qexp)
- dev.new()
- plot(diff(d1, lag=1), type="p", col=1)
- points(diff(d1, lag=2), col=2, pch="o")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement