-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatistical Analysis 101 - Painters Dataset.R
50 lines (34 loc) · 1.52 KB
/
Statistical Analysis 101 - Painters Dataset.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
library(MASS) # load the MASS package
painters
painters$School
head(faithful)
duration = faithful$eruptions # the eruption durations
mean(duration) # apply the mean function
median(duration) # apply the median function
quantile(duration) # apply the quantile function
quantile(duration, c(.32, .57, .98))
IQR(duration) # apply the IQR function
boxplot(duration, horizontal=TRUE) # horizontal box plot
var(duration) # apply the var function
sd(duration) # apply the sd function
duration = faithful$eruptions # eruption durations
waiting = faithful$waiting # the waiting period
cov(duration, waiting) # apply the cov function
cor(duration, waiting) # apply the cor function
library(e1071) # load e1071
skewness(duration) # apply the skewness function
kurtosis(duration) # apply the kurtosis function
dbinom(4, size=12, prob=0.2)
dbinom(0, size=12, prob=0.2) +
+ dbinom(1, size=12, prob=0.2) +
+ dbinom(2, size=12, prob=0.2) +
+ dbinom(3, size=12, prob=0.2) +
+ dbinom(4, size=12, prob=0.2)
ppois(16, lambda=12) # lower tail
ppois(16, lambda=12, lower=FALSE) # upper tail
runif(10, min=1, max=3)
pexp(2, rate=1/3)
pnorm(84, mean=72, sd=15.2, lower.tail=FALSE)
qchisq(.95, df=7) # 7 degrees of freedom
qt(c(.025, .975), df=5) # 5 degrees of freedom
qf(.95, df1=5, df2=2)