-
Notifications
You must be signed in to change notification settings - Fork 0
/
Var_I.R
135 lines (96 loc) · 2.46 KB
/
Var_I.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#1.1
shapiro <- by(dados$Concentracao, dados$Classe, shapiro.test)
shapiro
bartlett <- bartlett.test(Concentracao ~ Classe, data = dados)
bartlett
anova <- aov(Concentracao ~ Classe, data = dados)
summary(anova)
boxplot(Concentracao ~ Classe, data = dados,
col = RColorBrewer::brewer.pal(4, "Dark2"),
xlab = "Uso da Terra",
ylab = "Concentração de Carbono",
las = 1)
#1.2
kruskal.test(Concentracao ~ Classe, data = dados)
kruskal
#2.1
library(ggplot2)
data(msleep)
boxplot(awake ~ vore, data = msleep,
main = "Horas Acordado por Guilda",
xlab = "Guilda",
ylab = "Horas Acordado",
las = 1,
col = RColorBrewer::brewer.pal(4, "Dark2"))
shapiro <- by(msleep$awake, msleep$vore, shapiro.test)
shapiro
fligner <- fligner.test(awake ~ vore, data = msleep)
fligner
kruskal <- kruskal.test(awake ~ vore, data = msleep)
kruskal
#2.2
anova <- summary(aov(awake ~ vore, data = msleep))
anova
f <- anova[[1]]["F value"]
f <- f[1,1]
f
library(permuco)
permuco::aovperm(awake ~ vore, data = msleep,
np = 10000)
f_cri=qf(0.95, 3, 72)
f_cri
curve(df(x, 3, 72),
xlim = c(0, 20),
bty = "n",
las = 1,
ylab = "Probabilidade",
xlab = "F")
legend(x = "topright",
legend = c("Valor F", "F crítico"),
lty = c(3,1),
lwd = c(1,1),
bty = "n")
abline(v = f, lty=3)
abline(v= f_cri)
coord.x <- c(f, seq(f, 20, 0.01), 20)
coord.y <- c(0, df(seq(f, 20, 0.01), 3, 72), 0)
polygon(coord.x, coord.y, col = "red")
#3.3
f_cri=qf(0.95, 2, 27)
f_cri
f=10.17
curve(df(x, 2, 27),
xlim = c(0, 20),
bty = "n",
las = 1,
ylab = "Probabilidade",
xlab = "F")
legend(x = "topright",
legend = c("Valor F", "F crítico"),
lty = c(3,1),
lwd = c(1,1),
bty = "n")
abline(v = f, lty=3)
abline(v= f_cri)
coord.x <- c(f_cri, seq(f_cri, 20, 0.01), 20)
coord.y <- c(0, df(seq(f_cri, 20, 0.01), 2, 27), 0)
polygon(coord.x, coord.y, col = "red")
f_cri=qf(0.95, 2, 27)
f_cri
f=1.75
curve(df(x, 2, 27),
xlim = c(0, 20),
bty = "n",
las = 1,
ylab = "Probabilidade",
xlab = "F")
legend(x = "topright",
legend = c("Valor F", "F crítico"),
lty = c(3,1),
lwd = c(1,1),
bty = "n")
abline(v = f, lty=3)
abline(v= f_cri)
coord.x <- c(f_cri, seq(f_cri, 20, 0.01), 20)
coord.y <- c(0, df(seq(f_cri, 20, 0.01), 2, 27), 0)
polygon(coord.x, coord.y, col = "red")