-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathQQNORM
More file actions
23 lines (16 loc) · 751 Bytes
/
QQNORM
File metadata and controls
23 lines (16 loc) · 751 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Apropos of the following posts:
# http://stats.stackexchange.com/q/94106/67822
# http://stats.stackexchange.com/a/183647/67822
# http://stats.stackexchange.com/a/101290/67822
# The presence of asymptotic values in a t distribution really messes up the histogram. This can be addressed by establishing
# limits to the x axis of the histogram, and increasing the number of breaks:
set.seed(99); n <- 1e4; y <- rt(n, df = 2); summary(y);
hist(y, xlim=c(-5,5), breaks=2000)
# However, the qqnorm will still be rather distorted:
qqnorm(y)
# To address this problem, we can get rid of asymptotic values:
y <- y[y > quantile(y, .25) - 1.5 * IQR(y) &
y < quantile(y, .75) + 1.5 * IQR(y)]
summary(y)
hist(y, xlim=c(-5,5), breaks=50)
qqnorm(y)