{"id":3204,"date":"2015-07-30T10:16:06","date_gmt":"2015-07-30T09:16:06","guid":{"rendered":"https:\/\/abcdr.guyader.pro\/?p=3204"},"modified":"2018-04-08T00:02:23","modified_gmt":"2018-04-07T23:02:23","slug":"comment-effectuer-une-regression-lineaire-simple-sur-r-lm","status":"publish","type":"post","link":"https:\/\/thinkr.fr\/abcdr\/comment-effectuer-une-regression-lineaire-simple-sur-r-lm\/","title":{"rendered":"Comment effectuer une r\u00e9gression lin\u00e9aire simple sur R ? lm"},"content":{"rendered":"<p>La r\u00e9gression lin\u00e9aire simple permet de mod\u00e9liser une relation lin\u00e9aire entre deux variables quantitatives dans le but d\u2019expliquer un ph\u00e9nom\u00e8ne ou de le pr\u00e9dire.<\/p>\n<pre><code>\n\n#On commence par repr\u00e9senter les donn\u00e9es\u00a0:\n\nplot(Sepal.Length~Petal.Length, data=iris)\n\n#On constate que la relation entre la largeur des s\u00e9pales et celle des p\u00e9tales semble \u00eatre lin\u00e9aire\n\n\u00a0\n\n#On estime les param\u00e8tres\u00a0:\n\nReg.simp &lt;- lm(Sepal.Length~Petal.Length, data=iris)\n\n\u00a0\n\n#Call:\n\n#lm(formula = Sepal.Length ~ Petal.Length, data = iris)\n\n\u00a0\n\n#Residuals:\n\n#\u00a0\u00a0\u00a0\u00a0 Min\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1Q\u00a0\u00a0 Median\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3Q\u00a0\u00a0\u00a0\u00a0\u00a0 Max\n\n#-1.24675 -0.29657 -0.01515\u00a0 0.27676\u00a0 1.00269\n\n\u00a0\n\n#Coefficients:\n\n#\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Estimate Std. Error t value Pr(&gt;|t|)\u00a0\u00a0\u00a0\n\n#(Intercept)\u00a0\u00a0 4.30660\u00a0\u00a0\u00a0 0.07839\u00a0\u00a0 54.94\u00a0\u00a0 &lt;2e-16 ***\n\n#Petal.Length\u00a0 0.40892\u00a0\u00a0\u00a0 0.01889\u00a0\u00a0 21.65\u00a0\u00a0 &lt;2e-16 ***\n\n#---\n\n#Signif. codes:\u00a0 0 \u2018***\u2019 0.001 \u2018**\u2019 0.01 \u2018*\u2019 0.05 \u2018.\u2019 0.1 \u2018 \u2019 1\n\n\u00a0\n\n#Residual standard error: 0.4071 on 148 degrees of freedom\n\n#Multiple R-squared:\u00a0\u00a0 0.76,\u00a0\u00a0\u00a0\u00a0 Adjusted R-squared:\u00a0 0.7583\n\n#F-statistic: 468.6 on 1 and 148 DF,\u00a0 p-value: &lt; 2.2e-16\n\n<\/code><\/pre>\n<p>\u00a0<\/p>\n<p>On obtient une matrice \u201cCoefficients\u201d qui contient pour chaque param\u00e8tre son estimation, son \u00e9cart-type estim\u00e9 et la p-value. Si la p-value est inf\u00e9rieure \u00e0 0.05 cela signifie que la relation entre les deux variables est significative.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>La r\u00e9gression lin\u00e9aire simple permet de mod\u00e9liser une relation lin\u00e9aire entre deux variables quantitatives dans le but d\u2019expliquer un ph\u00e9nom\u00e8ne ou de le pr\u00e9dire. #On commence par repr\u00e9senter les donn\u00e9es\u00a0: plot(Sepal.Length~Petal.Length, data=iris) #On constate que la relation entre la largeur des s\u00e9pales et celle des p\u00e9tales semble \u00eatre lin\u00e9aire \u00a0 #On estime les param\u00e8tres\u00a0: Reg.simp &lt;- lm(Sepal.Length~Petal.Length, data=iris) \u00a0 #Call: #lm(formula = Sepal.Length ~ Petal.Length, data = iris) \u00a0 #Residuals: #\u00a0\u00a0\u00a0\u00a0 Min\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 1Q\u00a0\u00a0 Median\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 3Q\u00a0\u00a0\u00a0\u00a0\u00a0 Max #-1.24675 -0.29657 -0.01515\u00a0 0.27676\u00a0 1.00269 \u00a0 #Coefficients: #\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Estimate Std. Error t value Pr(&gt;|t|)\u00a0\u00a0\u00a0 #(Intercept)\u00a0\u00a0 4.30660\u00a0\u00a0\u00a0 0.07839\u00a0\u00a0 54.94\u00a0\u00a0 &lt;2e-16 *** #Petal.Length\u00a0 0.40892\u00a0\u00a0\u00a0 0.01889\u00a0\u00a0 21.65\u00a0\u00a0 &lt;2e-16 *** #&#8212; #Signif. codes:\u00a0<a class=\"more-link\" href=\"https:\/\/thinkr.fr\/abcdr\/comment-effectuer-une-regression-lineaire-simple-sur-r-lm\/\">Read More &rarr;<\/a><\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","rop_custom_images_group":[],"rop_custom_messages_group":[],"rop_publish_now":"initial","rop_publish_now_accounts":{"twitter_399453572_399453572":""},"rop_publish_now_history":[],"rop_publish_now_status":"pending","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-helene","4":"post-3204","6":"format-standard","7":"category-fonctions-utiles"},"acf":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p9O7Sx-PG","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts\/3204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/comments?post=3204"}],"version-history":[{"count":2,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts\/3204\/revisions"}],"predecessor-version":[{"id":4299,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/posts\/3204\/revisions\/4299"}],"wp:attachment":[{"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/media?parent=3204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/categories?post=3204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thinkr.fr\/abcdr\/wp-json\/wp\/v2\/tags?post=3204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}