{"id":841,"date":"2023-07-28T14:01:36","date_gmt":"2023-07-28T14:01:36","guid":{"rendered":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/"},"modified":"2023-07-28T14:01:36","modified_gmt":"2023-07-28T14:01:36","slug":"teste-exato-de-python-dos-pescadores","status":"publish","type":"post","link":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/","title":{"rendered":"Como realizar o teste exato de fisher em python"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><a href=\"https:\/\/statorials.org\/pt\/teste-exato-de-pescadores\/\" target=\"_blank\" rel=\"noopener\">O teste exato de Fisher<\/a> <span style=\"color: #000000;\">\u00e9 usado para determinar se existe ou n\u00e3o uma associa\u00e7\u00e3o significativa entre duas vari\u00e1veis categ\u00f3ricas.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Geralmente \u00e9 usado como uma alternativa ao<\/span> <a href=\"https:\/\/statorials.org\/pt\/teste-de-independencia-do-qui-quadrado\/\" target=\"_blank\" rel=\"noopener\">teste de independ\u00eancia do qui-quadrado<\/a> <span style=\"color: #000000;\">quando uma ou mais contagens de c\u00e9lulas em uma tabela 2 \u00d7 2 s\u00e3o menores que 5.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Este tutorial explica como realizar o teste exato de Fisher em Python.<\/span><\/p>\n<h3> <strong>Exemplo: teste exato de Fisher em Python<\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Suponhamos que queremos saber se o g\u00e9nero est\u00e1 ou n\u00e3o associado \u00e0 prefer\u00eancia por um partido pol\u00edtico numa determinada faculdade.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Para explorar isso, entrevistamos aleatoriamente 25 alunos no campus. O n\u00famero de estudantes democratas ou republicanos, com base no g\u00eanero, \u00e9 mostrado na tabela abaixo:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<th><\/th>\n<th> <span style=\"color: #000000;\"><strong>Democrata<\/strong><\/span><\/th>\n<th> <span style=\"color: #000000;\"><strong>Republicano<\/strong><\/span><\/th>\n<\/tr>\n<tr>\n<td> <span style=\"color: #000000;\"><strong>F\u00eamea<\/strong><\/span><\/td>\n<td> <span style=\"color: #000000;\">8<\/span><\/td>\n<td> <span style=\"color: #000000;\">4<\/span><\/td>\n<\/tr>\n<tr>\n<td> <span style=\"color: #000000;\"><strong>Macho<\/strong><\/span><\/td>\n<td> <span style=\"color: #000000;\">4<\/span><\/td>\n<td> <span style=\"color: #000000;\">9<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> <span style=\"color: #000000;\">Para determinar se existe uma associa\u00e7\u00e3o estatisticamente significativa entre g\u00eanero e prefer\u00eancia partid\u00e1ria, podemos usar as seguintes etapas para realizar o teste exato de Fisher em Python:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Etapa 1: crie<\/strong> <strong>os dados.<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Primeiro, criaremos uma tabela para armazenar nossos dados:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>data = [[8, 4],\n         [4, 9]]<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Etapa 2: execute o teste exato de Fisher.<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">A seguir, podemos realizar o teste exato de Fisher usando a <a href=\"https:\/\/docs.scipy.org\/doc\/scipy\/reference\/generated\/scipy.stats.fisher_exact.html\" target=\"_blank\" rel=\"noopener\">fun\u00e7\u00e3o fisher_exact<\/a> da biblioteca SciPy, que usa a seguinte sintaxe:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>fisher_exact(tabela, alternativa=&#8217;duas faces&#8217;)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Ouro:<\/span><\/p>\n<ul data-slot-rendered-dynamic=\"true\">\n<li> <span style=\"color: #000000;\"><strong>tabela:<\/strong> Uma tabela de conting\u00eancia 2\u00d72<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>alternativa:<\/strong> define a hip\u00f3tese alternativa. O padr\u00e3o \u00e9 \u201cbilateral\u201d, mas voc\u00ea tamb\u00e9m pode escolher \u201cmenos\u201d ou \u201cmaior\u201d para testes unilaterais.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">O c\u00f3digo a seguir mostra como usar esta fun\u00e7\u00e3o em nosso exemplo espec\u00edfico:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #107d3f;\">import<\/span> scipy.stats <span style=\"color: #107d3f;\">as<\/span> stats\n\nprint(stats.fisher_exact(data))\n\n(4.5, 0.1152)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">O valor p para teste \u00e9 <strong>0,1152<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">O teste exato de Fisher utiliza as seguintes hip\u00f3teses nulas e alternativas:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>H <sub>0<\/sub> : (hip\u00f3tese nula)<\/strong> As duas vari\u00e1veis s\u00e3o independentes.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>H <sub>1<\/sub> : (hip\u00f3tese alternativa)<\/strong> As duas vari\u00e1veis <em>n\u00e3o<\/em> s\u00e3o independentes.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Como este valor p n\u00e3o \u00e9 inferior a 0,05, n\u00e3o rejeitamos a hip\u00f3tese nula.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Portanto, n\u00e3o temos provas suficientes para afirmar que existe uma associa\u00e7\u00e3o significativa entre o g\u00e9nero e as prefer\u00eancias dos partidos pol\u00edticos.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Por outras palavras, as prefer\u00eancias de g\u00e9nero e de partidos pol\u00edticos s\u00e3o independentes.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>O teste exato de Fisher \u00e9 usado para determinar se existe ou n\u00e3o uma associa\u00e7\u00e3o significativa entre duas vari\u00e1veis categ\u00f3ricas. Geralmente \u00e9 usado como uma alternativa ao teste de independ\u00eancia do qui-quadrado quando uma ou mais contagens de c\u00e9lulas em uma tabela 2 \u00d7 2 s\u00e3o menores que 5. Este tutorial explica como realizar o [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-841","post","type-post","status-publish","format-standard","hentry","category-guia"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Como realizar o teste exato de Fisher em Python - Estatoriais<\/title>\n<meta name=\"description\" content=\"Uma explica\u00e7\u00e3o simples sobre como realizar e interpretar o teste exato de Fisher em Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como realizar o teste exato de Fisher em Python - Estatoriais\" \/>\n<meta property=\"og:description\" content=\"Uma explica\u00e7\u00e3o simples sobre como realizar e interpretar o teste exato de Fisher em Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-28T14:01:36+00:00\" \/>\n<meta name=\"author\" content=\"Dr. benjamim anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr. benjamim anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo estimado de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/\",\"url\":\"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/\",\"name\":\"Como realizar o teste exato de Fisher em Python - Estatoriais\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pt\/#website\"},\"datePublished\":\"2023-07-28T14:01:36+00:00\",\"dateModified\":\"2023-07-28T14:01:36+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\"},\"description\":\"Uma explica\u00e7\u00e3o simples sobre como realizar e interpretar o teste exato de Fisher em Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Lar\",\"item\":\"https:\/\/statorials.org\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como realizar o teste exato de fisher em python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/pt\/#website\",\"url\":\"https:\/\/statorials.org\/pt\/\",\"name\":\"Statorials\",\"description\":\"O seu guia para a literacia estat\u00edstica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/pt\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-PT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\",\"name\":\"Dr. benjamim anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. benjamim anderson\"},\"description\":\"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais\",\"sameAs\":[\"https:\/\/statorials.org\/pt\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Como realizar o teste exato de Fisher em Python - Estatoriais","description":"Uma explica\u00e7\u00e3o simples sobre como realizar e interpretar o teste exato de Fisher em Python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/","og_locale":"pt_PT","og_type":"article","og_title":"Como realizar o teste exato de Fisher em Python - Estatoriais","og_description":"Uma explica\u00e7\u00e3o simples sobre como realizar e interpretar o teste exato de Fisher em Python.","og_url":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/","og_site_name":"Statorials","article_published_time":"2023-07-28T14:01:36+00:00","author":"Dr. benjamim anderson","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Dr. benjamim anderson","Tempo estimado de leitura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/","url":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/","name":"Como realizar o teste exato de Fisher em Python - Estatoriais","isPartOf":{"@id":"https:\/\/statorials.org\/pt\/#website"},"datePublished":"2023-07-28T14:01:36+00:00","dateModified":"2023-07-28T14:01:36+00:00","author":{"@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666"},"description":"Uma explica\u00e7\u00e3o simples sobre como realizar e interpretar o teste exato de Fisher em Python.","breadcrumb":{"@id":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pt\/teste-exato-de-python-dos-pescadores\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Lar","item":"https:\/\/statorials.org\/pt\/"},{"@type":"ListItem","position":2,"name":"Como realizar o teste exato de fisher em python"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/pt\/#website","url":"https:\/\/statorials.org\/pt\/","name":"Statorials","description":"O seu guia para a literacia estat\u00edstica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/pt\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-PT"},{"@type":"Person","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666","name":"Dr. benjamim anderson","image":{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr. benjamim anderson"},"description":"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais","sameAs":["https:\/\/statorials.org\/pt"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/comments?post=841"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/841\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/media?parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/categories?post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/tags?post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}