Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the astra-sites domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the jetpack domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: A função _load_textdomain_just_in_time foi chamada incorretamente. O carregamento da tradução para o domínio astra foi ativado muito cedo. Isso geralmente é um indicador de que algum código no plugin ou tema está sendo executado muito cedo. As traduções devem ser carregadas na ação init ou mais tarde. Leia como Depurar o WordPress para mais informações. (Esta mensagem foi adicionada na versão 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":6462,"date":"2020-03-31T13:00:49","date_gmt":"2020-03-31T16:00:49","guid":{"rendered":"https:\/\/site.statplace.com.br\/?p=6462"},"modified":"2024-10-02T14:43:42","modified_gmt":"2024-10-02T14:43:42","slug":"qual-o-melhor-teste-para-a-comparacao-de-medias","status":"publish","type":"post","link":"https:\/\/site.statplace.com.br\/blog\/qual-o-melhor-teste-para-a-comparacao-de-medias\/","title":{"rendered":"Qual o melhor teste para a compara\u00e7\u00e3o de m\u00e9dias?"},"content":{"rendered":"\n

Se voc\u00ea faz pesquisa cient\u00edfica ent\u00e3o com certeza j\u00e1 precisou comparar m\u00e9dias para analisar os resultados obtidos. O problema \u00e9 que existem muitos testes estat\u00edsticos poss\u00edveis e cada um deles \u00e9 aplicado para uma situa\u00e7\u00e3o diferente. <\/p>\n\n\n\n

Ent\u00e3o, como saber qual o melhor para os dados da sua pesquisa? Para responder essa pergunta \u00e9 preciso saber qual o tipo de dado que voc\u00ea tem em m\u00e3os. <\/p>\n\n\n\n

As vari\u00e1veis da sua pesquisa podem ser: quantitativas ou\nqualitativas, apresentar ou n\u00e3o distribui\u00e7\u00e3o normal, ser pareadas ou n\u00e3o e ter\nmais ou menos de dois n\u00edveis. Essas caracter\u00edsticas ser\u00e3o as respons\u00e1veis pela\nescolha dos testes.<\/p>\n\n\n\n

Continue lendo para saber mais sobre cada um dos testes e a sua aplicabilidade.<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

Quantitativa n\u00e3o apresenta distribui\u00e7\u00e3o normal<\/h2>\n\n\n\n

Teste de Wilcoxon\/ Mann-Whitney<\/h3>\n\n\n\n

Este \u00e9 um teste n\u00e3o param\u00e9trico baseado nos postos dos valores obtidos combinando 2 amostras, sendo que a utiliza\u00e7\u00e3o dele \u00e9 ideal para a compara\u00e7\u00e3o de 2 amostras n\u00e3o pareadas. Exemplo:<\/p>\n\n\n\n

GrupoA1 <- c(1, 2, 3, 2, 3, 4, 5, 4, 3, 2, 2, 2, 3, 2, 3, 2)\nGrupoA2 <- c(3, 4, 4, 4, 5, 5, 3, 3, 2, 3, 3, 4, 2, 4)\n\nMedidasA <- c(GrupoA1, GrupoA2)\n\nMedidasA %>% \n  shapiro.test()# N\u00e3o segue distribui\u00e7\u00e3o normal\n## \n##  Shapiro-Wilk normality test\n## \n## data:  .\n## W = 0.90592, p-value = 0.01176\nGruposA <- c(rep(\"G1\", length(GrupoA1)), \n             rep(\"G2\", length(GrupoA2))) %>% \n  as.factor()\n\nwilcox.test(MedidasA ~ GruposA, exact = FALSE)# exact: quando n\u00e3o tem empate nos postos\n## \n##  Wilcoxon rank sum test with continuity correction\n## \n## data:  MedidasA by GruposA\n## W = 61.5, p-value = 0.03053\n## alternative hypothesis: true location shift is not equal to 0\nwhitney.abg(MedidasA, GruposA)\n##     N  M\u00e9dia      E.P. 1\u00ba Q. 2\u00ba Q. 3\u00ba Q.    Valor-p\n## G1 16 2.6875 0.2536196     2   2.5     3 0.03052584\n## G2 14 3.5000 0.2513699     3   3.5     4 0.03052584<\/code><\/pre>\n\n\n\n

Teste de Kruskall-Wallis<\/h3>\n\n\n\n

O teste de Kruskal-Wallis <\/a>\u00e9 uma extens\u00e3o do de Wilcoxon\/Mann-Whitney. \u00c9 um teste n\u00e3o param\u00e9trico utilizado para comparar 3 ou mais amostras n\u00e3o pareadas. Ele \u00e9 usado para testar a hip\u00f3tese nula de que todas as popula\u00e7\u00f5es possuem m\u00e9dias iguais contra a hip\u00f3tese alternativa de que ao menos duas das popula\u00e7\u00f5es possuem m\u00e9dias diferentes quanto \u00e0 uma vari\u00e1vel quantitativa. Exemplo:<\/p>\n\n\n\n

GrupoB1 <- c(1, 1, 3, 2, 2, 4, 4, 4, 2, 2, 3, 2, 1, 2, 3, 2)\nGrupoB2 <- c(4, 5, 4, 4, 5, 5, 3, 3, 2, 5, 3, 4)\nGrupoB3 <- c(5, 4, 4, 4, 3, 5, 4, 4, 5, 5, 3, 3, 2, 3, 3, 4, 2, 4)\n\nMedidasB <- c(GrupoB1, GrupoB2, GrupoB3)\n\nMedidasB %>% \n  shapiro.test()# N\u00e3o segue distribui\u00e7\u00e3o normal\n## \n##  Shapiro-Wilk normality test\n## \n## data:  .\n## W = 0.90793, p-value = 0.001482\nGruposB <- c(rep(\"G1\", length(GrupoB1)), \n             rep(\"G2\", length(GrupoB2)), \n             rep(\"G3\", length(GrupoB3))) %>% \n  as.factor()\n\nkruskal.test(MedidasB ~ GruposB)\n## \n##  Kruskal-Wallis rank sum test\n## \n## data:  MedidasB by GruposB\n## Kruskal-Wallis chi-squared = 14.47, df = 2, p-value = 0.0007208\nkruskal.abg(MedidasB, GruposB)$tabela\n##     N    M\u00e9dia      E.P. 1\u00ba Q. 2\u00ba Q. 3\u00ba Q.      Valor-p\n## G1 16 2.375000 0.2561738     2     2     3 0.0007207691\n## G2 12 3.916667 0.2875796     3     4     5 0.0007207691\n## G3 18 3.722222 0.2258688     3     4     4 0.0007207691<\/code><\/pre>\n\n\n\n

Quando o teste de Kruskall-Wallis verifica diferen\u00e7a significativa, utiliza-se o de Nemenyi, que \u00e9 um post-hoc, para a verifica\u00e7\u00e3o de diferen\u00e7as par-a-par (compara\u00e7\u00f5es m\u00faltiplas). Exemplo:<\/p>\n\n\n\n

if(!require(PMCMR)){ install.packages(\"PMCMR\"); require(PMCMR) }\n\nposthoc.kruskal.nemenyi.test(MedidasB ~ GruposB, dist = \"Chisq\")# M\u00e9todo para determinar o valor-p (defaut tukey)\n## \n##  Pairwise comparisons using Nemenyi-test with Chi-squared    \n##                        approximation for independent samples \n## \n## data:  MedidasB by GruposB \n## \n##    G1     G2    \n## G2 0.0039 -     \n## G3 0.0059 0.9018\n## \n## P value adjustment method: none\nkruskal.abg(MedidasB, GruposB)$C.Multiplas\n##             G1        G2\n## G2 0.003937787        NA\n## G3 0.005871800 0.9018024<\/code><\/pre>\n\n\n\n

Teste de Wilcoxon pareado<\/h3>\n\n\n\n

O teste de Wilcoxon pareado \u00e9 utilizado para comparar se as medidas de posi\u00e7\u00e3o de 2 amostras s\u00e3o iguais no caso em que as amostras s\u00e3o dependentes (pareadas)<\/a>. Exemplo:<\/p>\n\n\n\n

GrupoC1 <- c(2, 2, 1, 3, 1, 3, 2, 2, 3, 3, 3, 3, 2, 1, 1, 2, 4, 2)\nGrupoC2 <- c(3, 4, 3, 3, 2, 3, 3, 4, 3, 3, 3, 3, 3, 4, 2, 2, 4, 2)\n\nMedidasC <- c(GrupoC1, GrupoC2)\n\nMedidasC %>% \n  shapiro.test()# N\u00e3o segue distribui\u00e7\u00e3o normal\n## \n##  Shapiro-Wilk normality test\n## \n## data:  .\n## W = 0.87325, p-value = 0.0006849\nGruposC <- c(rep(\"G1\", length(GrupoC1)), \n             rep(\"G2\", length(GrupoC2))) %>% \n  as.factor()\n\nwilcox.test(MedidasC ~ GruposC, exact = FALSE, paired = TRUE)\n## \n##  Wilcoxon signed rank test with continuity correction\n## \n## data:  MedidasC by GruposC\n## V = 0, p-value = 0.007745\n## alternative hypothesis: true location shift is not equal to 0\nwilcox.abg(GrupoC1, GrupoC2)\n##           N_validos      M\u00e9dia       E.P 1\u00baQ  2\u00baQ 3\u00baQ     Valor-P\n## diferen\u00e7a        18 -0.7777778 0.2222222  -1 -0.5   0 0.007744715<\/code><\/pre>\n\n\n\n

Teste de Friedman<\/h3>\n\n\n\n

Esse \u00e9 um teste n\u00e3o-param\u00e9trico utilizado para comparar 3 ou mais amostras pareadas quanto \u00e0 uma vari\u00e1vel quantitativa. Exemplo:<\/p>\n\n\n\n

GrupoD1 <- c(2, 2, 1, 3, 1, 3, 2, 2, 3, 3, 3, 3, 2, 1, 1, 2, 4, 2)\nGrupoD2 <- c(3, 4, 3, 3, 2, 3, 3, 4, 3, 3, 3, 3, 3, 4, 2, 2, 4, 2)\nGrupoD3 <- c(2, 5, 4, 4, 3, 4, 4, 5, 4, 4, 2, 4, 2, 5, 3, 3, 4, 2)\n\nMedidasD <- c(GrupoD1, GrupoD2, GrupoD3)\n\nMedidasD %>%\n  shapiro.test()# N\u00e3o segue distribui\u00e7\u00e3o normal\n## \n##  Shapiro-Wilk normality test\n## \n## data:  .\n## W = 0.91304, p-value = 0.0008227\nMatriz <- cbind(GrupoD1, GrupoD2, GrupoD3)\n\nMatriz %>%\n  friedman.test()\n## \n##  Friedman rank sum test\n## \n## data:  .\n## Friedman chi-squared = 16.836, df = 2, p-value = 0.0002208<\/code><\/pre>\n\n\n\n

Quando o teste de Friedman verifica diferen\u00e7a significativa, utiliza-se o de Nemenyi, que \u00e9 um post-hoc, para a verifica\u00e7\u00e3o de diferen\u00e7as par-a-par (compara\u00e7\u00f5es m\u00faltiplas). Exemplo:<\/p>\n\n\n\n

Matriz %>% \n  posthoc.friedman.nemenyi.test()# Pacote PMCMR\n## \n##  Pairwise comparisons using Nemenyi multiple comparison test \n##              with q approximation for unreplicated blocked data \n## \n## data:  . \n## \n##         GrupoD1 GrupoD2\n## GrupoD2 0.21810 -      \n## GrupoD3 0.00099 0.13394\n## \n## P value adjustment method: none<\/code><\/pre>\n\n\n\n

Quantitativa apresenta distribui\u00e7\u00e3o normal<\/h2>\n\n\n\n

Teste t<\/h3>\n\n\n\n
\n