>
> #Simple scatter plot , col = colour, pch = 19 means circle, cex = size
> plot(Advertising, Sales, xlab = "Advertising", ylab= "Sales", main="Sales vs. Advertising", xlim = c(0, 6.5),
ylim = c(0, 5), col= "red", pch = 19, cex = 1.5)
>
Call:
Coefficients:
(Intercept) Advertising
-0.1 0.7
>
>
> #Compute the correlations and round the results to 4 significant digits
> round(cor(x,y),4)
[1] 0.9648
>
>
> #fit lm() fuction to a linear regression and call it by using summary (XXX.Reg)
> summary(SA.Reg)
Call:
Residuals:
1 2 3 4 5
Coefficients:
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> summary(PA.Reg)
Call:
Residuals:
1 2 3 4 5
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> confint(PA.Reg,level=0.95)
2.5 % 97.5 %
>
>
>
>
> predict(object = Quiz.Reg, newdata = ND, se.fit = TRUE, interval = c("confidence"), level = 0.95)
$fit
$se.fit
[1] 0.6
$df
[1] 3
$residual.scale
[1] 1.095445
> predict(object = Quiz.Reg, newdata = ND, se.fit = TRUE, interval = c("prediction"), level = 0.95)
$fit
$se.fit
[1] 0.6
$df
[1] 3
$residual.scale
[1] 1.095445
>
> summary(Quiz.Reg)
Call:
lm(formula = Q2 ~ Q1)
Residuals:
1 2 3 4 5
Coefficients:
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> anova(Quiz.Reg)