R/BSDA-package.R
Adsales.Rd
Data used in Exercise 9.15
Adsales
A data frame/tibble with six observations on three variables
a character vector listing month
a numeric vector containing number of ads
a numeric vector containing number of sales
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
plot(sales ~ ads, data = Adsales, main = "Exercise 9.15")
mod <- lm(sales ~ ads, data = Adsales)
abline(mod, col = "red")
summary(mod)
#>
#> Call:
#> lm(formula = sales ~ ads, data = Adsales)
#>
#> Residuals:
#> 1 2 3 4 5 6
#> 0.32517 -1.35635 1.18931 0.50780 0.05345 -0.71938
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 4.6748 0.8018 5.831 0.004311 **
#> ads 1.2272 0.1176 10.437 0.000476 ***
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Residual standard error: 1.017 on 4 degrees of freedom
#> Multiple R-squared: 0.9646, Adjusted R-squared: 0.9557
#> F-statistic: 108.9 on 1 and 4 DF, p-value: 0.0004761
#>
predict(mod, newdata = data.frame(ads = 6), interval = "conf", level = 0.99)
#> fit lwr upr
#> 1 12.03786 10.12395 13.95177