{"id":455,"date":"2023-07-29T20:44:21","date_gmt":"2023-07-29T20:44:21","guid":{"rendered":"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/"},"modified":"2023-07-29T20:44:21","modified_gmt":"2023-07-29T20:44:21","slug":"pas-de-gammaverdeling-aan-op-de-dataset-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/","title":{"rendered":"Hoe een gammaverdeling aan een dataset in r past"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">In deze tutorial wordt uitgelegd hoe u een <strong>gammaverdeling<\/strong> aan een dataset in R kunt aanpassen.<\/span><\/p>\n<h2> <strong><span style=\"color: #000000;\">Het passen van een gammaverdeling in R<\/span><\/strong><\/h2>\n<p> <span style=\"color: #000000;\">Stel dat u een dataset <em>z<\/em> hebt gegenereerd met behulp van de onderstaande aanpak:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#generate 50 random values that follow a gamma distribution with shape parameter = 3<\/span>\n<span style=\"color: #008080;\">#and shape parameter = 10 combined with some gaussian noise<\/span>\nz &lt;- rgamma(50, 3, 10) + rnorm(50, 0, .02)\n\n<span style=\"color: #008080;\">#view first 6 values<\/span>\nhead(z)\n[1] 0.07730 0.02495 0.12788 0.15011 0.08839 0.09941<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Om te zien hoe goed een gammaverdeling bij deze dataset <em>z<\/em> past, kunnen we het <strong>fitdistrplus-<\/strong> pakket in R gebruiken:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#install 'fitdistrplus' package if not already installed<\/span>\ninstall. <span style=\"color: #3366ff;\">packages<\/span> ('fitdistrplus')\n\n<span style=\"color: #008080;\">#load package<\/span>\nlibrary(fitdistrplus)<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">De algemene syntaxis die gebruikt moet worden om een distributie aan te passen met behulp van dit pakket is:<\/span><\/p>\n<p> <strong><span style=\"color: #000000;\">fitdist(dataset, distr = \u201cuw distributiekeuze\u201d, method = \u201cuw methode voor het aanpassen van gegevens\u201d)<\/span><\/strong><\/p>\n<p> <span style=\"color: #000000;\">In dit geval passen we de <em>z-<\/em> dataset aan die we eerder hebben gegenereerd met behulp van de gammaverdeling en de maximale waarschijnlijkheidsschatting om in de gegevens te passen:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#fit our dataset to a gamma distribution using mle<\/span>\nfit &lt;- fitdist(z, distr = \"gamma\", method = \"male\")\n\n<span style=\"color: #008080;\">#view the summary of the fit<\/span>\nsummary(fit)<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dit levert het volgende resultaat op:<\/span><\/p>\n<p> <span style=\"color: #000000;\">Vervolgens kunnen we grafieken maken die laten zien hoe goed de gammaverdeling bij de dataset past, met behulp van de volgende syntaxis:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#produce plots<\/span>\nplot(fit)<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dit levert de volgende plots op:<\/span><\/p>\n<p> <span style=\"color: #000000;\">Hier is de volledige code die we hebben gebruikt om een gammaverdeling in een dataset in R te passen:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#install 'fitdistrplus' package if not already installed\n<\/span>install. <span style=\"color: #3366ff;\">packages<\/span> ('fitdistrplus')\n\n<span style=\"color: #008080;\">#load package\n<\/span>library(fitdistrplus)\n\n<span style=\"color: #008080;\">#generate 50 random values that follow a gamma distribution with shape parameter = 3\n<\/span><span style=\"color: #008080;\">#and shape parameter = 10 combined with some gaussian noise\n<\/span>z &lt;- rgamma(50, 3, 10) + rnorm(50, 0, .02)\n\n<span style=\"color: #008080;\">#fit our dataset to a gamma distribution using mle\n<\/span>fit &lt;- fitdist(z, distr = \"gamma\", method = \"male\")\n\n<span style=\"color: #008080;\">#view the summary of the fit\n<\/span>summary(fit)\n\n<span style=\"color: #008080;\">#produce plots to visualize the fit\n<\/span>plot(fit)\n<\/strong><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In deze tutorial wordt uitgelegd hoe u een gammaverdeling aan een dataset in R kunt aanpassen. Het passen van een gammaverdeling in R Stel dat u een dataset z hebt gegenereerd met behulp van de onderstaande aanpak: #generate 50 random values that follow a gamma distribution with shape parameter = 3 #and shape parameter = [&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-455","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>Hoe een gammaverdeling aan een dataset in R - Statorials te passen<\/title>\n<meta name=\"description\" content=\"In deze tutorial wordt uitgelegd hoe u een gammaverdeling aan een dataset in R kunt aanpassen.\" \/>\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\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe een gammaverdeling aan een dataset in R - Statorials te passen\" \/>\n<meta property=\"og:description\" content=\"In deze tutorial wordt uitgelegd hoe u een gammaverdeling aan een dataset in R kunt aanpassen.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-29T20:44:21+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\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/\",\"url\":\"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/\",\"name\":\"Hoe een gammaverdeling aan een dataset in R - Statorials te passen\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-29T20:44:21+00:00\",\"dateModified\":\"2023-07-29T20:44:21+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"In deze tutorial wordt uitgelegd hoe u een gammaverdeling aan een dataset in R kunt aanpassen.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe een gammaverdeling aan een dataset in r past\"}]},{\"@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":"Hoe een gammaverdeling aan een dataset in R - Statorials te passen","description":"In deze tutorial wordt uitgelegd hoe u een gammaverdeling aan een dataset in R kunt aanpassen.","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\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe een gammaverdeling aan een dataset in R - Statorials te passen","og_description":"In deze tutorial wordt uitgelegd hoe u een gammaverdeling aan een dataset in R kunt aanpassen.","og_url":"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/","og_site_name":"Statorials","article_published_time":"2023-07-29T20:44:21+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\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/","url":"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/","name":"Hoe een gammaverdeling aan een dataset in R - Statorials te passen","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-29T20:44:21+00:00","dateModified":"2023-07-29T20:44:21+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"In deze tutorial wordt uitgelegd hoe u een gammaverdeling aan een dataset in R kunt aanpassen.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/pas-de-gammaverdeling-aan-op-de-dataset-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe een gammaverdeling aan een dataset in r past"}]},{"@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\/455","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=455"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/455\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}