Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
5 files changed, 5 insertions, 5 deletions
-rw-r--r--Year 3/Statistics/hw1-ex2-plot120.pngbin10287 -> 18942 bytes
-rw-r--r--Year 3/Statistics/hw1-ex2-plot200.pngbin10761 -> 17456 bytes
-rw-r--r--Year 3/Statistics/hw1-ex2-plot30.pngbin10232 -> 23147 bytes
-rw-r--r--Year 3/Statistics/hw1.pdfbin85556 -> 111954 bytes
-rw-r--r--Year 3/Statistics/hw1.r10
diff --git a/Year 3/Statistics/hw1-ex2-plot120.png b/Year 3/Statistics/hw1-ex2-plot120.png
index 912a2a7..3c9bb21 100644
--- a/Year 3/Statistics/hw1-ex2-plot120.png
+++ b/Year 3/Statistics/hw1-ex2-plot120.png
Binary files differ
diff --git a/Year 3/Statistics/hw1-ex2-plot200.png b/Year 3/Statistics/hw1-ex2-plot200.png
index a806df8..8ab2fee 100644
--- a/Year 3/Statistics/hw1-ex2-plot200.png
+++ b/Year 3/Statistics/hw1-ex2-plot200.png
Binary files differ
diff --git a/Year 3/Statistics/hw1-ex2-plot30.png b/Year 3/Statistics/hw1-ex2-plot30.png
index e2b61ce..5f8c1c8 100644
--- a/Year 3/Statistics/hw1-ex2-plot30.png
+++ b/Year 3/Statistics/hw1-ex2-plot30.png
Binary files differ
diff --git a/Year 3/Statistics/hw1.pdf b/Year 3/Statistics/hw1.pdf
index eedb714..d9a3a02 100644
--- a/Year 3/Statistics/hw1.pdf
+++ b/Year 3/Statistics/hw1.pdf
Binary files differ
diff --git a/Year 3/Statistics/hw1.r b/Year 3/Statistics/hw1.r
index ec9f021..afb1be3 100644
--- a/Year 3/Statistics/hw1.r
+++ b/Year 3/Statistics/hw1.r
@@ -19,7 +19,7 @@ ex1 <- function(total = 24, marked = 4, boxes = 4, iterations = 10000) {
ex1()
ex2 <- function(n, lambda = 1/5, N = 10000, mu = 5, sigma = 5 / sqrt(n)) {
- x <- function() rexp(n, rate=lambda)
+ x <- function() rexp(n, rate=lambda)
xdash <- replicate(N, sum(x()) / n)
fchapeau <- function(t) {
@@ -28,12 +28,12 @@ ex2 <- function(n, lambda = 1/5, N = 10000, mu = 5, sigma = 5 / sqrt(n)) {
return (1/N * sum(I(xdash <= t)))
}
- t <- seq(0, 10, by=0.1)
+ t <- seq(2, 8, by=0.1)
Fpoints <- sapply(t, fchapeau)
- Npoints <- sapply(t, function(t) dnorm(t, mu, sigma))
+ Npoints <- sapply(t, function(t) pnorm(t, mu, sigma))
- plot (t, Fpoints, type="l", ylim=c(0, 1.1))
- lines(t, Npoints, lty=2)
+ plot (t, Fpoints, type="l")
+ lines(t, Npoints, lty=2, col="darkred")
}
ex2(30)