Régréssion linéaire simple Sur des données fictives: x=1:100 x=sample(x,30,replace=TRUE) x [1] 62 18 9 67 43 38 57 12 41 29 69 76 77 46 42 75 32 74 6 40 51 88 61 3 38 [26] 71 81 76 94 34 y=3+7*x+rnorm(30,0,100) Y [1] 340.61710 254.86969 54.52298 463.78335 379.30676 177.27873 555.98297 [8] -13.48922 273.11081 187.46739 439.59869 380.92303 537.40362 414.12641 [15] 299.09269 494.05965 415.9
plot(x,y)
res.reg=lm(y~x); Call: lm(formula = y ~ x) Coefficients: (Intercept) x 13.22 6.71 Droite de régression: y=6,71 *x +13.22
plot(x,y);abline(res.reg)
summary(res.reg) Residuals: Min 1Q Median 3Q Max -142.29 -58.64 -17.17 63.33 187.99 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 13.2213 37.0548 0.357 0.724 x 6.7105 0.6587 10.188 6.37e-11 Residual standard error: 90.65 on 28 degrees of freedom Multiple R-Squared: 0.7875, Adjusted R-squared: 0.78