Skip to content

Commit bbb3d52

Browse files
committed
Update play with med.R
1 parent 3e48af9 commit bbb3d52

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

play with med.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
library(effectsize)
22

3+
x <- rnorm(50)
4+
y <- runif(30)
35

6+
# Do x and y come from the same distribution?
7+
ks.test(x, y)
8+
med(x, y)
49

10+
# Is the CDS of x larger than that of y?
11+
ks.test(x, y, alternative = "l")
12+
med(x, y, alternative = "l")
513

14+
plot(ecdf(x), xlim = range(c(x, y)), col = "blue")
15+
lines(ecdf(y), col = "red")
16+
17+
# Does x come from a shifted gamma distribution with shape 3 and rate 2?
18+
ks.test(x+2, "pgamma", 3, 2)
19+
med(x+2, pdf = "pgamma", shape = 3, rate = 2)
20+
21+
plot(ecdf(x + 2), xlim = range(x + 2), col = "blue")
22+
curve(pgamma(x, 3, 2), col = "red", add = TRUE)

0 commit comments

Comments
 (0)