{"id":861,"date":"2023-07-28T12:33:00","date_gmt":"2023-07-28T12:33:00","guid":{"rendered":"https:\/\/statorials.org\/nl\/f-testpython\/"},"modified":"2023-07-28T12:33:00","modified_gmt":"2023-07-28T12:33:00","slug":"f-testpython","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/f-testpython\/","title":{"rendered":"Hoe een f-test uit te voeren in python"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Een <strong>F-toets<\/strong> wordt gebruikt om te testen of twee populatievarianties gelijk zijn. De nul- en alternatieve hypothesen van de test zijn als volgt:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>H <sub>0<\/sub> :<\/strong> \u03c3 <sub>1<\/sub> <sup>2<\/sup> = \u03c3 <sub>2<\/sub> <sup>2<\/sup> (populatievarianties zijn gelijk)<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>H <sub>1<\/sub> :<\/strong> \u03c3 <sub>1<\/sub> <sup>2<\/sup> \u2260 \u03c3 <sub>2<\/sub> <sup>2<\/sup> (populatievarianties zijn <em>niet<\/em> gelijk)<\/span><\/p>\n<p> <span style=\"color: #000000;\">In deze tutorial wordt uitgelegd hoe u een F-test uitvoert in Python.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Voorbeeld: F-test in Python<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Stel dat we de volgende twee voorbeelden hebben:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>x = [18, 19, 22, 25, 27, 28, 41, 45, 51, 55]<\/strong>\n<strong>y = [14, 15, 15, 17, 18, 22, 25, 25, 27, 34]<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">We kunnen de volgende functie gebruiken om een F-test uit te voeren om te bepalen of de twee populaties waar deze steekproeven vandaan komen gelijke varianties hebben:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #107d3f;\">import<\/span> numpy <span style=\"color: #107d3f;\">as<\/span> np\n\n<span style=\"color: #008080;\">#define F-test function<\/span>\n<span style=\"color: #008000;\">def<\/span> f_test(x, y):\n    x = np.array(x)\n    y = np.array(y)\n    f = np.var(x, ddof=1)\/np.var(y, ddof=1) <span style=\"color: #008080;\">#calculate F test statistic<\/span>\n    dfn = x.size-1 <span style=\"color: #008080;\">#define degrees of freedom numerator<\/span>\n    dfd = y.size-1 <span style=\"color: #008080;\">#define degrees of freedom denominator<\/span>\n    p = 1-scipy.stats.f.cdf(f, dfn, dfd) <span style=\"color: #008080;\">#find p-value of F test statistic<\/span>\n    <span style=\"color: #008000;\">return<\/span> f,p\n\n<span style=\"color: #008080;\">#perform F-test\n<\/span>f_test(x, y)\n\n(4.38712, 0.019127)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">De F-teststatistiek is <strong>4,38712<\/strong> en de overeenkomstige p-waarde is <strong>0,019127<\/strong> . Omdat deze p-waarde kleiner is dan 0,05, zouden we de nulhypothese verwerpen. Dit betekent dat we voldoende bewijs hebben om te zeggen dat de twee populatievarianties <em>niet<\/em> gelijk zijn.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Opmerkingen<\/strong><\/span><\/h3>\n<ul>\n<li> <span style=\"color: #000000;\">De F-teststatistiek wordt berekend als s <sub>1<\/sub> <sup>2<\/sup> \/ s <sub>2<\/sub> <sup>2<\/sup> . Standaard berekent <a href=\"https:\/\/numpy.org\/doc\/stable\/reference\/generated\/numpy.var.html#:~:text=Compute%20the%20variance%20along%20the,the%20spread%20of%20a%20distribution.\" target=\"_blank\" rel=\"noopener noreferrer\">numpy.var<\/a> de populatievariantie. Om de steekproefvariantie te berekenen, moeten we <strong>ddof=1<\/strong> opgeven.<\/span><\/li>\n<li> <span style=\"color: #000000;\">De p-waarde komt overeen met 1 \u2013 cdf van de verdeling F met vrijheidsgraden in de teller = n <sub>1<\/sub> -1 en vrijheidsgraden in de noemer = n <sub>2<\/sub> -1.<\/span><\/li>\n<li> <span style=\"color: #000000;\">Deze functie werkt alleen als de variantie van de eerste steekproef groter is dan de variantie van de tweede steekproef. Stel dus beide voorbeelden in om met de functie te werken.<\/span><\/li>\n<\/ul>\n<h3> <span style=\"color: #000000;\"><strong>Wanneer moet u de F-test gebruiken?<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">De F-test wordt doorgaans gebruikt om een van de volgende vragen te beantwoorden:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>1.<\/strong> Komen twee steekproeven uit populaties met gelijke varianties?<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>2.<\/strong> Vermindert een nieuwe behandeling of proces de variabiliteit van een huidige behandeling of proces?<\/span><\/p>\n<p> <span style=\"color: #000000;\"><b>Gerelateerd:<\/b> <a href=\"https:\/\/statorials.org\/nl\/f-test-in-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">Een F-test uitvoeren in R<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Een F-toets wordt gebruikt om te testen of twee populatievarianties gelijk zijn. De nul- en alternatieve hypothesen van de test zijn als volgt: H 0 : \u03c3 1 2 = \u03c3 2 2 (populatievarianties zijn gelijk) H 1 : \u03c3 1 2 \u2260 \u03c3 2 2 (populatievarianties zijn niet gelijk) In deze tutorial wordt uitgelegd [&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-861","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Een F-test uitvoeren in Python - Statorials<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe u een F-test uitvoert voor gelijke varianties in 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\/nl\/f-testpython\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Een F-test uitvoeren in Python - Statorials\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe u een F-test uitvoert voor gelijke varianties in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/f-testpython\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-28T12:33:00+00:00\" \/>\n<meta name=\"author\" content=\"Dr.benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/f-testpython\/\",\"url\":\"https:\/\/statorials.org\/nl\/f-testpython\/\",\"name\":\"Een F-test uitvoeren in Python - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-28T12:33:00+00:00\",\"dateModified\":\"2023-07-28T12:33:00+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe u een F-test uitvoert voor gelijke varianties in Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/f-testpython\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/f-testpython\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/f-testpython\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe een f-test uit te voeren in python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Een F-test uitvoeren in Python - Statorials","description":"In deze tutorial wordt uitgelegd hoe u een F-test uitvoert voor gelijke varianties in 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\/nl\/f-testpython\/","og_locale":"de_DE","og_type":"article","og_title":"Een F-test uitvoeren in Python - Statorials","og_description":"In deze tutorial wordt uitgelegd hoe u een F-test uitvoert voor gelijke varianties in Python.","og_url":"https:\/\/statorials.org\/nl\/f-testpython\/","og_site_name":"Statorials","article_published_time":"2023-07-28T12:33:00+00:00","author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/f-testpython\/","url":"https:\/\/statorials.org\/nl\/f-testpython\/","name":"Een F-test uitvoeren in Python - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-28T12:33:00+00:00","dateModified":"2023-07-28T12:33:00+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe u een F-test uitvoert voor gelijke varianties in Python.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/f-testpython\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/f-testpython\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/f-testpython\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe een f-test uit te voeren in python"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/861","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=861"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/861\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=861"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=861"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=861"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}