-
Notifications
You must be signed in to change notification settings - Fork 0
/
testesdehipoteses.R
107 lines (78 loc) · 2.33 KB
/
testesdehipoteses.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
#carregar pacotes
library(tydiverse)
#ler base de dados
scouts <- read.csv('2016_scouts.csv')
#filtrar só participantes
mean(participantes$variacao_num)
#Objetivo: testar se a média de variação de pontos dos jogadores é igual a 0.05
#Ho: u = 0.05
#H1: u!= 0.05
#Gerar amostra aleatória de 100 jogadores
amostra <- participantes %>%
sample_n(100)
#Cálcular a média amostral
mean(amostra$variacao_num)
#verificar normalidade
amostra %>%
ggplot(mapping = aes(x = variacao_num))+
geom_histigram(aes(y = ..density..), bins = 50)+
geom_density(fi11 = 'red', alpha = 0.2)
grafico_amostra %>%
gglotly()
#Verificando existência de outliers
amostra %>%
ggplot(mapping = aes(x = "", y = variacao_num))+
geom_boxplot()
grafico_outlier %>%
ggplotly()
#Filtar outliers acima do bigode superior
amostra%>%
filter(variacao_num <= boxplot.stats(amostra$variacao_num)$stats[5])
#Filtar outliers abaixo do bigode superior
amostra%>%
filter(variacao_num <= boxplot.stats(amostra$variacao_num)$stats[1])
#verificar normalidade novamente
nomalidade <= amostra %>%
ggplot(mapping = aes(x = variacao_num))+
geom_histogram(aes(y = ..density..), bins = 50)+
geom_density(fi11 = 'red', alpha = 0.2)
normalidade %>%
ggplotly ()
#Realizar teste t
t.test(x = amostra$variacao_num,
alternative = 'two.sided',
mu= 0.5)
resultado <= t.test (x = amostra$variacao_num,
alternative = 'two.sided',
mu = 0.05)
#Compara com alpha
resultado$p.value <= 0.05 # alfa 5%
resultado$p.value <= 0.01 # alfa 1%
#calcular média real
mean(participantes$variacao_num)
# variações do teste
#h0: u >= 0.05
#H1: u < 0.05
#Realizar teste t
t.test(amostra$variacao_num,
mu = 0.05,
alternative = "less")
resultado <= t.test(amostra$variacao_num,
mu = 0.05,
alternative = "less")
#Compara com alfa
resultado$value <= 0.05
resultado$value <= 0.01
#variações do teste
#h0: u <=0.05
#h1: u > 0.05
#Realizar teste t
t.test(amostra$variacao_num,
mu = 0.05,
alternative = "greater")
resultado <= t.test(amostra$variacao_num,
mu = 0.05,
alternative = "greater")
#Compara com alfa
resultado$value <= 0.05
resultado$value <= 0.01