{"id":1281,"date":"2023-07-27T00:47:36","date_gmt":"2023-07-27T00:47:36","guid":{"rendered":"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/"},"modified":"2023-07-27T00:47:36","modified_gmt":"2023-07-27T00:47:36","slug":"mittlere-absolute-abweichung-in-python","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/","title":{"rendered":"So berechnen sie die absolute mittlere abweichung in python"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Die <strong>mittlere absolute Abweichung<\/strong> misst die Verteilung der <a href=\"https:\/\/statorials.org\/de\/beobachtung-in-der-statistik\/\" target=\"_blank\" rel=\"noopener\">Beobachtungen<\/a> in einem Datensatz.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Dies ist ein besonders n\u00fctzliches Ma\u00df, da es weniger von Ausrei\u00dfern beeinflusst wird als andere Streuungsma\u00dfe wie Standardabweichung und Varianz.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Die Formel zur Berechnung der absoluten mittleren Abweichung, oft als MAD abgek\u00fcrzt, lautet:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>MAD = Median (|x <sub>i<\/sub> \u2013 x <sub>m<\/sub> |)<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Gold:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>x <sub>i<\/sub> :<\/strong> der <sup>i-te<\/sup> Wert des Datensatzes<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>x <sub>m<\/sub> :<\/strong> Der Medianwert im Datensatz<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Die folgenden Beispiele zeigen, wie die mittlere absolute Abweichung in Python mithilfe der Funktion <a href=\"https:\/\/www.statsmodels.org\/stable\/index.html\" target=\"_blank\" rel=\"noopener\">\u201estatsmodels<\/a> <strong>mad\u201c<\/strong> berechnet wird.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 1: Berechnen Sie den MAD f\u00fcr eine Tabelle<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie die mittlere absolute Abweichung f\u00fcr ein einzelnes NumPy-Array in Python berechnet wird:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008000;\">import<\/span> numpy <span style=\"color: #008000;\">as<\/span> np\n<span style=\"color: #008000;\">from<\/span> statsmodels <span style=\"color: #008000;\">import<\/span> robust<\/span>\n\n#define data\n<\/span>data = np. <span style=\"color: #3366ff;\">array<\/span> ([1, 4, 4, 7, 12, 13, 16, 19, 22, 24])\n\n<span style=\"color: #008080;\">#calculate MAD\n<\/span>robust. <span style=\"color: #3366ff;\">mad<\/span> (data)\n\n11.1195\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Die mittlere absolute Abweichung f\u00fcr den Datensatz betr\u00e4gt <strong>11,1195<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Es ist wichtig zu beachten, dass die zur Berechnung des MAD verwendete Formel eine robuste Sch\u00e4tzung der Standardabweichung unter der Annahme einer <a href=\"https:\/\/statorials.org\/de\/die-normalverteilung\/\" target=\"_blank\" rel=\"noopener\">Normalverteilung<\/a> berechnet, indem das Ergebnis um einen Faktor von etwa 0,67 skaliert wird.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Um die Verwendung dieses Skalierungsfaktors zu vermeiden, setzen Sie einfach c = 1 wie folgt:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#calculate MAD without scaling factor\n<\/span>robust. <span style=\"color: #3366ff;\">mad<\/span> (data, c=1)\n\n7.5<\/strong><\/pre>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel 2: Berechnen Sie MAD f\u00fcr einen DataFrame<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Der folgende Code zeigt, wie MAD f\u00fcr eine einzelne Spalte in einem Pandas-DataFrame berechnet wird:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#make this example reproducible\n<\/span>n.p. <span style=\"color: #3366ff;\">random<\/span> . <span style=\"color: #3366ff;\">seeds<\/span> (1)\n\n<span style=\"color: #008080;\">#create pandas DataFrame\n<\/span>data = pd. <span style=\"color: #3366ff;\">DataFrame<\/span> ( <span style=\"color: #3366ff;\">np.random.randint<\/span> (0,10,size=(5,3)),columns <span style=\"color: #3366ff;\">=<\/span> [' <span style=\"color: #008000;\">A<\/span> ',' <span style=\"color: #008000;\">B<\/span> ',' <span style=\"color: #008000;\">C<\/span> '])\n\n<span style=\"color: #008080;\">#view DataFrame\n<\/span>data\n\n        A B C\n0 5 8 9\n1 5 0 0\n2 1 7 6\n3 9 2 4\n4 5 2 4\n\n<span style=\"color: #008080;\">#calculate MAD for column <em>B<\/em>\n<span style=\"color: #000000;\">data[[' <span style=\"color: #008000;\">B<\/span> ']]. <span style=\"color: #3366ff;\">apply<\/span> (robust. <span style=\"color: #3366ff;\">mad<\/span> )\n\nB 2.965204\ndtype:float64<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Die absolute mittlere Abweichung f\u00fcr Spalte <em>B<\/em> betr\u00e4gt <strong>2,965204<\/strong> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen eine \u00e4hnliche Syntax verwenden, um MAD f\u00fcr mehrere Spalten im Pandas DataFrame zu berechnen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\">#calculate MAD for all columns<\/span>\ndata[[' <span style=\"color: #008000;\">A<\/span> ',' <span style=\"color: #008000;\">B<\/span> ',' <span style=\"color: #008000;\">C<\/span> ']]. <span style=\"color: #3366ff;\">apply<\/span> (robust. <span style=\"color: #3366ff;\">mad<\/span> )\n\nAt 0.000000\nB 2.965204\nC 2.965204\ndtype:float64\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Die absolute mittlere Abweichung betr\u00e4gt <b>0<\/b> f\u00fcr Spalte A, <strong>2,965204<\/strong> f\u00fcr Spalte B und <b>2,965204<\/b> f\u00fcr Spalte C.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/de\/python-karte\/\" target=\"_blank\" rel=\"noopener\">So berechnen Sie MAPE in Python<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/smape-python\/\" target=\"_blank\" rel=\"noopener\">So berechnen Sie SMAPE in Python<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/rmse-python\/\" target=\"_blank\" rel=\"noopener\">So berechnen Sie RMSE in Python<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Die mittlere absolute Abweichung misst die Verteilung der Beobachtungen in einem Datensatz. Dies ist ein besonders n\u00fctzliches Ma\u00df, da es weniger von Ausrei\u00dfern beeinflusst wird als andere Streuungsma\u00dfe wie Standardabweichung und Varianz. Die Formel zur Berechnung der absoluten mittleren Abweichung, oft als MAD abgek\u00fcrzt, lautet: MAD = Median (|x i \u2013 x m |) Gold: [&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 absolute mittlere Abweichung in Python<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie die mittlere absolute Abweichung in Python berechnet wird.\" \/>\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\/mittlere-absolute-abweichung-in-python\/\" \/>\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 absolute mittlere Abweichung in Python\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie die mittlere absolute Abweichung in Python berechnet wird.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T00:47:36+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 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/\",\"url\":\"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/\",\"name\":\"So berechnen Sie die absolute mittlere Abweichung in Python\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-27T00:47:36+00:00\",\"dateModified\":\"2023-07-27T00:47:36+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie die mittlere absolute Abweichung in Python berechnet wird.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So berechnen sie die absolute mittlere abweichung in python\"}]},{\"@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 absolute mittlere Abweichung in Python","description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie die mittlere absolute Abweichung in Python berechnet wird.","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\/mittlere-absolute-abweichung-in-python\/","og_locale":"de_DE","og_type":"article","og_title":"So berechnen Sie die absolute mittlere Abweichung in Python","og_description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie die mittlere absolute Abweichung in Python berechnet wird.","og_url":"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/","og_site_name":"Statorials","article_published_time":"2023-07-27T00:47:36+00:00","author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"2 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/","url":"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/","name":"So berechnen Sie die absolute mittlere Abweichung in Python","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-27T00:47:36+00:00","dateModified":"2023-07-27T00:47:36+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand mehrerer Beispiele erl\u00e4utert, wie die mittlere absolute Abweichung in Python berechnet wird.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/mittlere-absolute-abweichung-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So berechnen sie die absolute mittlere abweichung in python"}]},{"@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\/1281"}],"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=1281"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/1281\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=1281"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=1281"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=1281"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}