{"id":455,"date":"2023-07-29T20:32:53","date_gmt":"2023-07-29T20:32:53","guid":{"rendered":"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/"},"modified":"2023-07-29T20:32:53","modified_gmt":"2023-07-29T20:32:53","slug":"zeichnen-sie-die-normalverteilung-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/","title":{"rendered":"So zeichnen sie eine normalverteilung in r auf"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Um eine <a href=\"https:\/\/statorials.org\/de\/die-normalverteilung\/\" target=\"_blank\" rel=\"noopener\">Normalverteilung<\/a> in R darzustellen, k\u00f6nnen wir entweder Basis-R verwenden oder ein anspruchsvolleres Paket wie ggplot2 installieren.<\/span><\/p>\n<h2> <strong><span style=\"color: #000000;\">Verwenden von BaseR<\/span><\/strong><\/h2>\n<p> <span style=\"color: #000000;\">Hier sind drei Beispiele f\u00fcr die Erstellung eines Normalverteilungsdiagramms mit Basis R.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 1: Normalverteilung mit Mittelwert = 0 und Standardabweichung = 1<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Um ein Normalverteilungsdiagramm mit Mittelwert = 0 und Standardabweichung = 1 zu erstellen, k\u00f6nnen wir den folgenden Code verwenden:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#Create a sequence of 100 equally spaced numbers between -4 and 4<\/span>\nx &lt;- seq(-4, 4, length=100)\n\n<span style=\"color: #008080;\">#create a vector of values that shows the height of the probability distribution<\/span>\n<span style=\"color: #008080;\">#for each value in x<\/span>\ny &lt;- dnorm(x)\n\n<span style=\"color: #008080;\">#plot x and y as a scatterplot with connected lines (type = \"l\") and add<\/span>\n<span style=\"color: #008080;\">#an x-axis with custom labels<\/span>\nplot(x,y, type = \"l\", lwd = 2, axes = FALSE, xlab = \"\", ylab = \"\")\naxis(1, at = -3:3, labels = c(\"-3s\", \"-2s\", \"-1s\", \"mean\", \"1s\", \"2s\", \"3s\"))<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dies erzeugt die folgende Darstellung:<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 2: Normalverteilung mit Mittelwert = 0 und Standardabweichung = 1 (weniger Code)<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnten auch ein Normalverteilungsdiagramm erstellen, ohne <em>x<\/em> und <em>y<\/em> zu definieren und einfach die Funktion \u201eKurve\u201c mit dem folgenden Code verwenden:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong>curve(dnorm, -3.5, 3.5, lwd=2, axes = FALSE, xlab = \"\", ylab = \"\")\naxis(1, at = -3:3, labels = c(\"-3s\", \"-2s\", \"-1s\", \"mean\", \"1s\", \"2s\", \"3s\"))<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dies erzeugt genau das gleiche Diagramm:<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 3: Normalverteilung mit benutzerdefiniertem Mittelwert und Standardabweichung<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Um ein Normalverteilungsdiagramm mit benutzerdefiniertem Mittelwert und Standardabweichung zu erstellen, k\u00f6nnen wir den folgenden Code verwenden:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define population mean and standard deviation<\/span>\npopulation_mean &lt;- 50\npopulation_sd &lt;- 5\n\n<span style=\"color: #008080;\">#define upper and lower bound\n<\/span>lower_bound &lt;- population_mean - population_sd\nupper_bound &lt;- population_mean + population_sd\n\n<span style=\"color: #008080;\">#Create a sequence of 1000 x values based on population mean and standard deviation<\/span>\nx &lt;- seq(-4, 4, length = 1000) * population_sd + population_mean\n\n<span style=\"color: #008080;\">#create a vector of values that shows the height of the probability distribution\n<\/span><span style=\"color: #008080;\">#for each value in x<\/span>\ny &lt;- dnorm(x, population_mean, population_sd)\n\n<span style=\"color: #008080;\">#plot normal distribution with customized x-axis labels\n<\/span>plot(x,y, type = \"l\", lwd = 2, axes = FALSE, xlab = \"\", ylab = \"\")\nsd_axis_bounds = 5\naxis_bounds &lt;- seq(-sd_axis_bounds * population_sd + population_mean,\n                    sd_axis_bounds * population_sd + population_mean,\n                    by = population_sd)\naxis(side = 1, at = axis_bounds, pos = 0)<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dies erzeugt die folgende Darstellung:<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Verwendung von ggplot2<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Eine andere M\u00f6glichkeit, ein Normalverteilungsdiagramm in R zu erstellen, ist die Verwendung des Pakets ggplot2. Hier sind zwei Beispiele f\u00fcr die Erstellung eines Normalverteilungsdiagramms mit ggplot2.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 1: Normalverteilung mit Mittelwert = 0 und Standardabweichung = 1<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Um ein Normalverteilungsdiagramm mit Mittelwert = 0 und Standardabweichung = 1 zu erstellen, k\u00f6nnen wir den folgenden Code verwenden:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#install (if not already installed) and load ggplot2<\/span>\nif(!(require(ggplot2))){install.packages('ggplot2')}\n\n<span style=\"color: #008080;\">#generate a normal distribution plot\n<\/span>ggplot(data.frame(x = c(-4, 4)), aes(x = x)) +\nstat_function(fun = dnorm)<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dies erzeugt die folgende Darstellung:<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 2: Normalverteilung mit dem Datensatz \u201emtcars\u201c.<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie eine Normalverteilung f\u00fcr die Spalte <em>\u201eMeilen pro Gallone\u201c<\/em> im eingebetteten R-Datensatz \u201e <em>mtcars<\/em> \u201c erstellt wird:<\/span><\/p>\n<pre style=\"background-color: #e5e5e5; font-size: 15px;\"> <strong>ggplot(mtcars, aes(x = mpg)) +\nstat_function(\nfun = dnorm,\nargs = with(mtcars, c(mean = mean(mpg), sd = sd(mpg)))\n) +\nscale_x_continuous(\"Miles per gallon\")<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dies erzeugt die folgende Darstellung:<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Um eine Normalverteilung in R darzustellen, k\u00f6nnen wir entweder Basis-R verwenden oder ein anspruchsvolleres Paket wie ggplot2 installieren. Verwenden von BaseR Hier sind drei Beispiele f\u00fcr die Erstellung eines Normalverteilungsdiagramms mit Basis R. Beispiel 1: Normalverteilung mit Mittelwert = 0 und Standardabweichung = 1 Um ein Normalverteilungsdiagramm mit Mittelwert = 0 und Standardabweichung = 1 [&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 zeichnen Sie eine Normalverteilung in der R-Statorials auf<\/title>\n<meta name=\"description\" content=\"In diesem einfachen Tutorial wird erkl\u00e4rt, wie man eine Normalverteilung in R mithilfe von Basis R und ggplot2 darstellt.\" \/>\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\/zeichnen-sie-die-normalverteilung-r\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So zeichnen Sie eine Normalverteilung in der R-Statorials auf\" \/>\n<meta property=\"og:description\" content=\"In diesem einfachen Tutorial wird erkl\u00e4rt, wie man eine Normalverteilung in R mithilfe von Basis R und ggplot2 darstellt.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-29T20:32:53+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=\"3 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/\",\"url\":\"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/\",\"name\":\"So zeichnen Sie eine Normalverteilung in der R-Statorials auf\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-29T20:32:53+00:00\",\"dateModified\":\"2023-07-29T20:32:53+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem einfachen Tutorial wird erkl\u00e4rt, wie man eine Normalverteilung in R mithilfe von Basis R und ggplot2 darstellt.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So zeichnen sie eine normalverteilung in r auf\"}]},{\"@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 zeichnen Sie eine Normalverteilung in der R-Statorials auf","description":"In diesem einfachen Tutorial wird erkl\u00e4rt, wie man eine Normalverteilung in R mithilfe von Basis R und ggplot2 darstellt.","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\/zeichnen-sie-die-normalverteilung-r\/","og_locale":"de_DE","og_type":"article","og_title":"So zeichnen Sie eine Normalverteilung in der R-Statorials auf","og_description":"In diesem einfachen Tutorial wird erkl\u00e4rt, wie man eine Normalverteilung in R mithilfe von Basis R und ggplot2 darstellt.","og_url":"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/","og_site_name":"Statorials","article_published_time":"2023-07-29T20:32:53+00:00","author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"3 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/","url":"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/","name":"So zeichnen Sie eine Normalverteilung in der R-Statorials auf","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-29T20:32:53+00:00","dateModified":"2023-07-29T20:32:53+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem einfachen Tutorial wird erkl\u00e4rt, wie man eine Normalverteilung in R mithilfe von Basis R und ggplot2 darstellt.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/zeichnen-sie-die-normalverteilung-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So zeichnen sie eine normalverteilung in r auf"}]},{"@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\/455"}],"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=455"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/455\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}