{"id":4171,"date":"2023-07-13T02:55:29","date_gmt":"2023-07-13T02:55:29","guid":{"rendered":"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/"},"modified":"2023-07-13T02:55:29","modified_gmt":"2023-07-13T02:55:29","slug":"r-extrahieren-sie-den-p-wert-aus-lm","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/","title":{"rendered":"So extrahieren sie p-werte aus der funktion lm() in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Sie k\u00f6nnen die folgenden Methoden verwenden, um p-Werte aus der <a href=\"https:\/\/statorials.org\/de\/lm-funktion-in-r\/\" target=\"_blank\" rel=\"noopener\">Funktion lm()<\/a> in R zu extrahieren:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Methode 1: Extrahieren Sie den Gesamt-P-Wert aus dem Regressionsmodell<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define function to extract overall p-value of model<\/span>\noverall_p &lt;- <span style=\"color: #008000;\">function<\/span> (my_model) {\n    f &lt;- summary(my_model)$fstatistic\n    p &lt;- pf(f[1],f[2],f[3],lower. <span style=\"color: #3366ff;\">tail<\/span> =F)\n    attributes(p) &lt;- NULL\n    <span style=\"color: #008000;\">return<\/span> (p)\n}\n\n<span style=\"color: #008080;\">#extract overall p-value of model<\/span>\noverall_p(model)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\"><strong>Methode 2: Extrahieren Sie einzelne P-Werte f\u00fcr Regressionskoeffizienten<\/strong><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>summary(model)$coefficients[,4]<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Das folgende Beispiel zeigt, wie diese Methoden in der Praxis eingesetzt werden k\u00f6nnen.<\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Beispiel: P-Werte aus lm() in R extrahieren<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">Angenommen, wir passen das folgende <a href=\"https:\/\/statorials.org\/de\/multiple-lineare-regression\/\" target=\"_blank\" rel=\"noopener\">multiple lineare Regressionsmodell<\/a> in R an:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (rating=c(67, 75, 79, 85, 90, 96, 97),\n                 points=c(8, 12, 16, 15, 22, 28, 24),\n                 assists=c(4, 6, 6, 5, 3, 8, 7),\n                 rebounds=c(1, 4, 3, 3, 2, 6, 7))\n\n<span style=\"color: #008080;\">#fit multiple linear regression model\n<\/span>model &lt;- lm(rating ~ points + assists + rebounds, data=df)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen die Funktion <strong>summary()<\/strong> verwenden, um die vollst\u00e4ndige Zusammenfassung des Regressionsmodells anzuzeigen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#view model summary\n<\/span>summary(model)\n\nCall:\nlm(formula = rating ~ points + assists + rebounds, data = df)\n\nResiduals:\n      1 2 3 4 5 6 7 \n-1.5902 -1.7181 0.2413 4.8597 -1.0201 -0.6082 -0.1644 \n\nCoefficients:\n            Estimate Std. Error t value Pr(&gt;|t|)   \n(Intercept) 66.4355 6.6932 9.926 0.00218 **\npoints 1.2152 0.2788 4.359 0.02232 * \nassists -2.5968 1.6263 -1.597 0.20860   \nrebounds 2.8202 1.6118 1.750 0.17847   \n---\nSignificant. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 3.193 on 3 degrees of freedom\nMultiple R-squared: 0.9589, Adjusted R-squared: 0.9179 \nF-statistic: 23.35 on 3 and 3 DF, p-value: 0.01396\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Ganz unten im Ergebnis k\u00f6nnen wir sehen, dass der Gesamt-p-Wert des Regressionsmodells <strong>0,01396<\/strong> betr\u00e4gt.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wenn wir nur diesen p-Wert aus dem Modell extrahieren m\u00f6chten, k\u00f6nnen wir dazu eine benutzerdefinierte Funktion definieren:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define function to extract overall p-value of model<\/span>\noverall_p &lt;- <span style=\"color: #008000;\">function<\/span> (my_model) {\n    f &lt;- summary(my_model)$fstatistic\n    p &lt;- pf(f[1],f[2],f[3],lower. <span style=\"color: #3366ff;\">tail<\/span> =F)\n    attributes(p) &lt;- NULL\n    <span style=\"color: #008000;\">return<\/span> (p)\n}\n\n<span style=\"color: #008080;\">#extract overall p-value of model<\/span>\noverall_p(model)\n\n[1] 0.01395572\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Beachten Sie, dass die Funktion denselben p-Wert zur\u00fcckgibt wie die Modellausgabe oben.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Um p-Werte f\u00fcr einzelne Regressionskoeffizienten aus dem Modell zu extrahieren, k\u00f6nnen wir die folgende Syntax verwenden:<\/span><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#extract p-values for individual regression coefficients in model\n<span style=\"color: #000000;\">summary(model)$coefficients[,4] \n\n(Intercept) points assists rebounds \n0.002175313 0.022315418 0.208600183 0.178471275<\/span><\/span>\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Beachten Sie, dass die hier angezeigten p-Werte denen in der Spalte <strong>Pr(&gt; |t|)<\/strong> in der obigen Regressionsausgabe entsprechen.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Verwandt:<\/strong> <a href=\"https:\/\/statorials.org\/de\/extrahiere-r-quadrat-aus-lm-in-r\/\" target=\"_blank\" rel=\"noopener\">So extrahieren Sie das R-Quadrat aus der Funktion lm() in R<\/a><\/span><\/p>\n<h2> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h2>\n<p> <span style=\"color: #000000;\">In den folgenden Tutorials wird erl\u00e4utert, wie Sie andere h\u00e4ufige Aufgaben in R ausf\u00fchren:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/de\/einfache-lineare-regression-in-r\/\" target=\"_blank\" rel=\"noopener\">So f\u00fchren Sie eine einfache lineare Regression in R durch<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/multiple-lineare-regression-r\/\" target=\"_blank\" rel=\"noopener\">So f\u00fchren Sie eine multiple lineare Regression in R durch<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/restspur-r\/\" target=\"_blank\" rel=\"noopener\">So erstellen Sie ein Residuendiagramm in R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sie k\u00f6nnen die folgenden Methoden verwenden, um p-Werte aus der Funktion lm() in R zu extrahieren: Methode 1: Extrahieren Sie den Gesamt-P-Wert aus dem Regressionsmodell #define function to extract overall p-value of model overall_p &lt;- function (my_model) { f &lt;- summary(my_model)$fstatistic p &lt;- pf(f[1],f[2],f[3],lower. tail =F) attributes(p) &lt;- NULL return (p) } #extract overall p-value [&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 extrahieren Sie P-Werte aus der Funktion lm() in R \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand eines Beispiels erkl\u00e4rt, wie man p-Werte aus der Ausgabe der Funktion lm() in R extrahiert.\" \/>\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\/r-extrahieren-sie-den-p-wert-aus-lm\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So extrahieren Sie P-Werte aus der Funktion lm() in R \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand eines Beispiels erkl\u00e4rt, wie man p-Werte aus der Ausgabe der Funktion lm() in R extrahiert.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-13T02:55:29+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\/r-extrahieren-sie-den-p-wert-aus-lm\/\",\"url\":\"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/\",\"name\":\"So extrahieren Sie P-Werte aus der Funktion lm() in R \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-13T02:55:29+00:00\",\"dateModified\":\"2023-07-13T02:55:29+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand eines Beispiels erkl\u00e4rt, wie man p-Werte aus der Ausgabe der Funktion lm() in R extrahiert.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So extrahieren sie p-werte aus der funktion lm() 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 extrahieren Sie P-Werte aus der Funktion lm() in R \u2013 Statorials","description":"In diesem Tutorial wird anhand eines Beispiels erkl\u00e4rt, wie man p-Werte aus der Ausgabe der Funktion lm() in R extrahiert.","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\/r-extrahieren-sie-den-p-wert-aus-lm\/","og_locale":"de_DE","og_type":"article","og_title":"So extrahieren Sie P-Werte aus der Funktion lm() in R \u2013 Statorials","og_description":"In diesem Tutorial wird anhand eines Beispiels erkl\u00e4rt, wie man p-Werte aus der Ausgabe der Funktion lm() in R extrahiert.","og_url":"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/","og_site_name":"Statorials","article_published_time":"2023-07-13T02:55:29+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\/r-extrahieren-sie-den-p-wert-aus-lm\/","url":"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/","name":"So extrahieren Sie P-Werte aus der Funktion lm() in R \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-13T02:55:29+00:00","dateModified":"2023-07-13T02:55:29+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand eines Beispiels erkl\u00e4rt, wie man p-Werte aus der Ausgabe der Funktion lm() in R extrahiert.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/r-extrahieren-sie-den-p-wert-aus-lm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So extrahieren sie p-werte aus der funktion lm() 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\/4171"}],"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=4171"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/4171\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=4171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=4171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=4171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}