{"id":1243,"date":"2023-07-27T04:01:05","date_gmt":"2023-07-27T04:01:05","guid":{"rendered":"https:\/\/statorials.org\/de\/varianz-in-r\/"},"modified":"2023-07-27T04:01:05","modified_gmt":"2023-07-27T04:01:05","slug":"varianz-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/varianz-in-r\/","title":{"rendered":"So berechnen sie die stichproben- und populationsvarianz in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\"><strong>Varianz<\/strong> ist eine Methode zur Messung, wie gut Datenwerte um den Mittelwert verteilt sind.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Die Formel zum Ermitteln der Varianz einer <a href=\"https:\/\/statorials.org\/de\/population-vs.-stichprobe\/\" target=\"_blank\" rel=\"noopener noreferrer\">Grundgesamtheit<\/a> lautet:<\/span><\/p>\n<p style=\"text-align: center;\"> <span style=\"color: #000000;\"><strong>\u03c3 <sup>2<\/sup><\/strong> = \u03a3 (x <sub>i<\/sub> \u2013 \u03bc) <sup>2<\/sup> \/ N<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dabei ist \u03bc der Mittelwert der Grundgesamtheit, x <sub>i<\/sub> das i <sup>-te<\/sup> Element der Grundgesamtheit, N die Grundgesamtheitsgr\u00f6\u00dfe und \u03a3 nur ein ausgefallenes Symbol, das \u201eSumme\u201c bedeutet.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Die Formel zum Ermitteln der Varianz einer <a href=\"https:\/\/statorials.org\/de\/stichprobenmittelwert-im-vergleich-zum-populationsmittelwert\/\" target=\"_blank\" rel=\"noopener noreferrer\">Stichprobe<\/a> lautet:<\/span><\/p>\n<p style=\"text-align: center;\"> <span style=\"color: #000000;\"><strong>s <sup>2<\/sup><\/strong> = \u03a3 (x <sub>i<\/sub> \u2013 <span style=\"text-decoration: overline;\">x<\/span> ) <sup>2<\/sup> \/ (n-1)<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dabei ist <span style=\"text-decoration: overline;\">x<\/span> der Stichprobenmittelwert, x <sub>i<\/sub> das i <sup>-te<\/sup> Stichprobenelement und n die Stichprobengr\u00f6\u00dfe.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel: Berechnen Sie die Stichproben- und Populationsvarianz in R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Angenommen, wir haben den folgenden Datensatz in R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define dataset<\/span>\ndata &lt;- c(2, 4, 4, 7, 8, 12, 14, 15, 19, 22)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen die <strong>Stichprobenvarianz<\/strong> mithilfe der Funktion <strong>var()<\/strong> in R berechnen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#calculate sample variance<\/span>\nvar(data)\n\n[1] 46.01111\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Und wir k\u00f6nnen die <strong>Populationsvarianz<\/strong> berechnen, indem wir einfach die Stichprobenvarianz mit (n-1)\/n wie folgt multiplizieren:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#determine length of data\n<span style=\"color: #000000;\">n &lt;- <span style=\"color: #3366ff;\">length<\/span> (data)<\/span>\n\n#calculate population variance<\/span>\nvar(data) * (n-1)\/n\n\n[1] 41.41\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Beachten Sie, dass die Populationsvarianz immer geringer ist als die Stichprobenvarianz.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In der Praxis berechnen wir Stichprobenvarianzen normalerweise f\u00fcr Datens\u00e4tze, da es ungew\u00f6hnlich ist, Daten f\u00fcr eine gesamte Grundgesamtheit zu sammeln.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel: Berechnen Sie die Varianz einer Stichprobe aus mehreren Spalten<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Angenommen, wir haben den folgenden Datenrahmen in R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create data frame\n<span style=\"color: #000000;\">data &lt;- data.frame(a=c(1, 3, 4, 4, 6, 7, 8, 12),\n                   b=c(2, 4, 4, 5, 5, 6, 7, 16),\n                   c=c(6, 6, 7, 8, 8, 9, 9, 12))\n\n<span style=\"color: #008080;\">#view data frame<\/span>\ndata\n\n   ABC\n1 1 2 6\n2 3 4 6\n3 4 4 7\n4 4 5 8\n5 6 5 8\n6 7 6 9\n7 8 7 9\n8 12 16 12<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Mit der Funktion <a href=\"https:\/\/statorials.org\/de\/eine-anleitung-zum-auftragen-von-lapply-sapply-und-tapply-in-r\/\" target=\"_blank\" rel=\"noopener noreferrer\">sapply()<\/a> k\u00f6nnen wir die Stichprobenvarianz jeder Spalte im Datenrahmen berechnen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#find sample variance of each column\n<span style=\"color: #000000;\">sapply(data, var)\n\n        ABC\n11.696429 18.125000 3.839286<\/span>\n<\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Und wir k\u00f6nnen den folgenden Code verwenden, um die Stichprobenstandardabweichung jeder Spalte zu berechnen, die einfach die Quadratwurzel der Stichprobenvarianz ist:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#find sample standard deviation of each column\n<span style=\"color: #000000;\">sapply(data, sd)\n\n       ABC\n3.420004 4.257347 1.959410<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><em>Weitere R-Tutorials finden Sie <a href=\"https:\/\/statorials.org\/de\/die-statistik-erklart-konzepte-auf-einfache-und-direkte-weise.-wir-erleichtern-das-erlernen-von-statistiken\/\" target=\"_blank\" rel=\"noopener noreferrer\">hier<\/a> .<\/em><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Varianz ist eine Methode zur Messung, wie gut Datenwerte um den Mittelwert verteilt sind. Die Formel zum Ermitteln der Varianz einer Grundgesamtheit lautet: \u03c3 2 = \u03a3 (x i \u2013 \u03bc) 2 \/ N Dabei ist \u03bc der Mittelwert der Grundgesamtheit, x i das i -te Element der Grundgesamtheit, N die Grundgesamtheitsgr\u00f6\u00dfe und \u03a3 nur [&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":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>So berechnen Sie die Stichproben- und Populationsvarianz in R<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie Stichprobenvarianz und Populationsvarianz in R berechnet werden.\" \/>\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\/de\/varianz-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So berechnen Sie die Stichproben- und Populationsvarianz in R\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie Stichprobenvarianz und Populationsvarianz in R berechnet werden.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/varianz-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T04:01:05+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=\"1 Minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/varianz-in-r\/\",\"url\":\"https:\/\/statorials.org\/de\/varianz-in-r\/\",\"name\":\"So berechnen Sie die Stichproben- und Populationsvarianz in R\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-27T04:01:05+00:00\",\"dateModified\":\"2023-07-27T04:01:05+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie Stichprobenvarianz und Populationsvarianz in R berechnet werden.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/varianz-in-r\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/varianz-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/varianz-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So berechnen sie die stichproben- und populationsvarianz in r\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/de\/#website\",\"url\":\"https:\/\/statorials.org\/de\/\",\"name\":\"Statorials\",\"description\":\"Ihr Leitfaden f\u00fcr statistische Kompetenz !\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/de\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de-DE\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\",\"name\":\"Dr. Benjamin Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de-DE\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. Benjamin Anderson\"},\"description\":\"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen\",\"sameAs\":[\"https:\/\/statorials.org\/de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"So berechnen Sie die Stichproben- und Populationsvarianz in R","description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie Stichprobenvarianz und Populationsvarianz in R berechnet werden.","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\/de\/varianz-in-r\/","og_locale":"de_DE","og_type":"article","og_title":"So berechnen Sie die Stichproben- und Populationsvarianz in R","og_description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie Stichprobenvarianz und Populationsvarianz in R berechnet werden.","og_url":"https:\/\/statorials.org\/de\/varianz-in-r\/","og_site_name":"Statorials","article_published_time":"2023-07-27T04:01:05+00:00","author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"1 Minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/varianz-in-r\/","url":"https:\/\/statorials.org\/de\/varianz-in-r\/","name":"So berechnen Sie die Stichproben- und Populationsvarianz in R","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-27T04:01:05+00:00","dateModified":"2023-07-27T04:01:05+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie Stichprobenvarianz und Populationsvarianz in R berechnet werden.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/varianz-in-r\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/varianz-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/varianz-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So berechnen sie die stichproben- und populationsvarianz in r"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/de\/#website","url":"https:\/\/statorials.org\/de\/","name":"Statorials","description":"Ihr Leitfaden f\u00fcr statistische Kompetenz !","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/de\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de-DE"},{"@type":"Person","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0","name":"Dr. Benjamin Anderson","image":{"@type":"ImageObject","inLanguage":"de-DE","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","caption":"Dr. Benjamin Anderson"},"description":"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen","sameAs":["https:\/\/statorials.org\/de"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1243"}],"collection":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/comments?post=1243"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1243\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=1243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=1243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=1243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}