diff options
| Commit | 1426e4a759655f69f40ca5fa2a41440fdabd1ee3 (patch) | |
|---|---|---|
| Author | 2024-04-17 20:14:40 +0300 | |
| Committer | 2024-04-17 20:14:40 +0300 | |
| Files | 4ca1f718f943d7ae84feea32b047a37ffe39a64c | |
| uni-projects-1426e4a759655f69f40ca5fa2a41440fdabd1ee3.tar uni-projects-1426e4a759655f69f40ca5fa2a41440fdabd1ee3.tar.gz uni-projects-1426e4a759655f69f40ca5fa2a41440fdabd1ee3.zip | ||
| Parent | 5856b28e64b1c3ef39d34c032275f9550e6ac983 (diff) | |
[S/hw1] Updated from dnorm to pnorm
5 files changed, 5 insertions, 5 deletions
| -rw-r--r-- | Year 3/Statistics/hw1-ex2-plot120.png | bin | 10287 -> 18942 bytes | |||
| -rw-r--r-- | Year 3/Statistics/hw1-ex2-plot200.png | bin | 10761 -> 17456 bytes | |||
| -rw-r--r-- | Year 3/Statistics/hw1-ex2-plot30.png | bin | 10232 -> 23147 bytes | |||
| -rw-r--r-- | Year 3/Statistics/hw1.pdf | bin | 85556 -> 111954 bytes | |||
| -rw-r--r-- | Year 3/Statistics/hw1.r | 10 |
diff --git a/Year 3/Statistics/hw1-ex2-plot120.png b/Year 3/Statistics/hw1-ex2-plot120.png Binary files differindex 912a2a7..3c9bb21 100644 --- a/Year 3/Statistics/hw1-ex2-plot120.png +++ b/Year 3/Statistics/hw1-ex2-plot120.png diff --git a/Year 3/Statistics/hw1-ex2-plot200.png b/Year 3/Statistics/hw1-ex2-plot200.png Binary files differindex a806df8..8ab2fee 100644 --- a/Year 3/Statistics/hw1-ex2-plot200.png +++ b/Year 3/Statistics/hw1-ex2-plot200.png diff --git a/Year 3/Statistics/hw1-ex2-plot30.png b/Year 3/Statistics/hw1-ex2-plot30.png Binary files differindex e2b61ce..5f8c1c8 100644 --- a/Year 3/Statistics/hw1-ex2-plot30.png +++ b/Year 3/Statistics/hw1-ex2-plot30.png diff --git a/Year 3/Statistics/hw1.pdf b/Year 3/Statistics/hw1.pdf Binary files differindex eedb714..d9a3a02 100644 --- a/Year 3/Statistics/hw1.pdf +++ b/Year 3/Statistics/hw1.pdf 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) |
