#Question 1: The largest and smallest values

library(wooldridge)
## Warning: package 'wooldridge' was built under R version 4.2.3
data <- wooldridge::econmath
head(data)
##   age work study econhs colgpa hsgpa acteng actmth act mathscr male calculus
## 1  23   15  10.0      0 3.4909 3.355     24     26  27      10    1        1
## 2  23    0  22.5      1 2.1000 3.219     23     20  24       9    1        0
## 3  21   25  12.0      0 3.0851 3.306     21     24  21       8    1        1
## 4  22   30  40.0      0 2.6805 3.977     31     28  31      10    0        1
## 5  22   25  15.0      1 3.7454 3.890     28     31  32       8    1        1
## 6  22    0  30.0      0 3.0555 3.500     25     30  28      10    1        1
##   attexc attgood fathcoll mothcoll score
## 1      0       0        1        1 84.43
## 2      0       0        0        1 57.38
## 3      1       0        0        1 66.39
## 4      0       1        1        1 81.15
## 5      0       1        0        1 95.90
## 6      1       0        0        1 83.61
max(data$score)
## [1] 98.44
min(data$score)
## [1] 19.53

#Question 2: The linear model

model1 <- lm(score ~ colgpa + actmth + acteng, data=data)
summary(model1)
## 
## Call:
## lm(formula = score ~ colgpa + actmth + acteng, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.855  -6.215   0.444   6.812  32.670 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 16.17402    2.80044   5.776 1.09e-08 ***
## colgpa      12.36620    0.71506  17.294  < 2e-16 ***
## actmth       0.88335    0.11220   7.873 1.11e-14 ***
## acteng       0.05176    0.11106   0.466    0.641    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.35 on 810 degrees of freedom
##   (42 observations deleted due to missingness)
## Multiple R-squared:  0.3972, Adjusted R-squared:  0.395 
## F-statistic: 177.9 on 3 and 810 DF,  p-value: < 2.2e-16
plot(model1)

# The equation is “score=16.17402+12.36620colgpa+0.88335actmth+0.05176acteng #The coeffiecent of colgpa is 12.36620. It means if colgpa increases by one unit, the score increases by 12.36620. #The coeffiecent of actmth is 0.88335. It means if actmth increases by one unit, the score increases by 0.88335. #The coeffiecent of acteng is 0.05176. It means if acteng increases by one unit, the score increases by 0.05176. #If you look at the Pr values, colgpa and actmth are significant variables. Because the va;ues are smaller than 0.05.