Heart Rate Data

hr <- data.frame(
  Age = c(18, 23, 25, 35, 65, 54, 34, 56, 72, 19, 23, 42, 18, 39, 37),
  MaxHR = c(202, 186, 187, 180, 156, 169, 174, 172, 153, 199, 193, 174, 198, 183, 178)
)

heart_fit <- lm(MaxHR ~ Age, data = hr)
Fitting linear model: MaxHR ~ Age
  Estimate Std. Error t value Pr(>|t|)
Age -0.7977 0.06996 -11.4 3.848e-08
(Intercept) 210 2.867 73.27 2.124e-18

The equation fit to the data is \[\widehat{MaxHR} = 210.048 -0.798 \times age\]

The \(p\) value for the coefficient -0.798 is \(\approx 4 \times 10^{-8}\), showing that it is significant at a significance level of \(\alpha = 0.01\).

Auto Data

auto <- read.table('data/auto-mpg.data')
names(auto) <- c('displacement', 'horsepower', 'weight', 'acceleration', 'mpg')

Subset of Data

set.seed(42) # set seed for replicable results
auto_sub <- auto[sample(1:nrow(auto), 40), ]
sub_fit <- lm(mpg ~ ., auto_sub)
Fitting linear model: mpg ~ .
  Estimate Std. Error t value Pr(>|t|)
displacement -0.006323 0.02399 -0.2635 0.7937
horsepower -0.0858 0.1055 -0.813 0.4217
weight -0.005613 0.003972 -1.413 0.1664
acceleration 0.1647 0.6306 0.2611 0.7955
(Intercept) 48.76 11.87 4.107 0.0002288

The equation fit to the data is \[\widehat{mpg} = 48.76 -0.01 \times displacement + -0.09 \times horsepower + -0.01 \times weight + 0.16 \times acceleration\]

None of the coefficients are statistically significant at the \(\alpha = 0.10\) significance level. The standard errors for the coefficients are presented in the table above. 95% confidence intervals for the coefficients are as follows:

  2.5 % 97.5 %
(Intercept) 24.66 72.86
displacement -0.05503 0.04238
horsepower -0.3 0.1284
weight -0.01368 0.002451
acceleration -1.115 1.445

Full Dataset

auto_fit <- lm(mpg ~ ., auto)
Fitting linear model: mpg ~ .
  Estimate Std. Error t value Pr(>|t|)
displacement -0.006001 0.006709 -0.8944 0.3717
horsepower -0.04361 0.01657 -2.631 0.008849
weight -0.005281 0.0008109 -6.512 2.303e-10
acceleration -0.02315 0.1256 -0.1843 0.8539
(Intercept) 45.25 2.456 18.42 7.072e-55

The equation fit to the data is \[\widehat{mpg} = 45.25 -0.01 \times displacement + -0.04 \times horsepower + -0.01 \times weight + -0.02 \times acceleration\]

The coefficients for horsepower and weight are statistically significant at the \(\alpha = 0.01\) significance level; the coefficients for the remaining variables are not significant. The standard errors for the coefficients are presented in the table above. 95% confidence intervals for the coefficients are as follows:

  2.5 % 97.5 %
(Intercept) 40.42 50.08
displacement -0.01919 0.00719
horsepower -0.07619 -0.01102
weight -0.006875 -0.003686
acceleration -0.2701 0.2238