2 La régression linéaire multiple

La concentration en ozone

ozone <- read.table("../donnees/ozone.txt", header = T, sep = ";")
library("scatterplot3d")
scatterplot3d(ozone[,"T12"],ozone[,"Vx"],ozone[,"O3"],
              type="h",pch=16, box=FALSE, xlab="T12", ylab="Vx", zlab="O3")

regmulti <- lm(O3~T12+Vx, data = ozone)
summary(regmulti)

Call:
lm(formula = O3 ~ T12 + Vx, data = ozone)

Residuals:
    Min      1Q  Median      3Q     Max 
-42.984 -10.152  -2.407  11.710  34.494 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  35.4530    10.7446   3.300  0.00185 ** 
T12           2.5380     0.5151   4.927 1.08e-05 ***
Vx            0.8736     0.1772   4.931 1.06e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 16.82 on 47 degrees of freedom
Multiple R-squared:  0.5249,    Adjusted R-squared:  0.5047 
F-statistic: 25.96 on 2 and 47 DF,  p-value: 2.541e-08

La hauteur des eucalyptus

eucalypt <- read.table("../donnees/eucalyptus.txt", header = T, sep = ";")
plot(ht~circ, data = eucalypt, xlab = "circ", ylab = "ht")

regmult <- lm(ht ~ circ + I(sqrt(circ)), data = eucalypt)
resume.mult <- summary(regmult)
resume.mult

Call:
lm(formula = ht ~ circ + I(sqrt(circ)), data = eucalypt)

Residuals:
    Min      1Q  Median      3Q     Max 
-4.1881 -0.6881  0.0427  0.7927  3.7481 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)    
(Intercept)   -24.35200    2.61444  -9.314   <2e-16 ***
circ           -0.48295    0.05793  -8.336   <2e-16 ***
I(sqrt(circ))   9.98689    0.78033  12.798   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.136 on 1426 degrees of freedom
Multiple R-squared:  0.7922,    Adjusted R-squared:  0.7919 
F-statistic:  2718 on 2 and 1426 DF,  p-value: < 2.2e-16
plot(ht ~ circ, data = eucalypt, pch = "+", col = "grey60")
grille <- data.frame(circ = seq(min(eucalypt[,"circ"]),max(eucalypt[,"circ"]), length = 100))
lines(grille[,"circ"], predict(regmult, grille))