1.Find the equation of the regression line for the given points.

Round any final values to the nearest hundredth, if necessary. ( 5.6, 8.8 ), ( 6.3, 12.4 ), ( 7, 14.8 ), ( 7.7, 18.2 ), ( 8.4, 20.8 )

\[\begin{gathered} \beta_{1}=\frac{\sum_{i=1}^{n}\left(x_{i}-\bar{X}\right)\left(y_{i}-\bar{Y}\right)}{\sum_{i=1}^{n}\left(x_{i}-\bar{X}\right)^{2}} \\ \beta_{1}=\frac{\operatorname{Cov}(x, y)}{\operatorname{Var}(x)} \\ \beta_{0}=\bar{Y}-m \bar{X} \end{gathered}\]
x = c(5.6, 6.3, 7, 7.7, 8.4)
y = c(8.8, 12.4, 14.8, 18.2, 20.8)
x_bar = mean(x)
x_bar
## [1] 7
y_bar = mean(y)
y_bar
## [1] 15
x_x_bar = x-x_bar
sq_x_xbar = (x_x_bar)^2
sq_x_xbar
## [1] 1.96 0.49 0.00 0.49 1.96
var_x = sum(sq_x_xbar)/(length(x)-1)
var_x
## [1] 1.225
var(x)
## [1] 1.225
y_y_bar = y-y_bar
y_y_bar
## [1] -6.2 -2.6 -0.2  3.2  5.8
prod_x_y = x_x_bar*y_y_bar
prod_x_y
## [1] 8.68 1.82 0.00 2.24 8.12
cov_xy = sum(prod_x_y)/(length(x)-1)
cov_xy
## [1] 5.215
cov(x,y)
## [1] 5.215
B_1 = cov_xy/var_x
B_1
## [1] 4.257143
B_0 = y_bar - B_1*x_bar
B_0
## [1] -14.8

y=-14.8+4.26 * x

fit <- lm(y~x)
summary(fit)
## 
## Call:
## lm(formula = y ~ x)
## 
## Residuals:
##     1     2     3     4     5 
## -0.24  0.38 -0.20  0.22 -0.16 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -14.8000     1.0365  -14.28 0.000744 ***
## x             4.2571     0.1466   29.04 8.97e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3246 on 3 degrees of freedom
## Multiple R-squared:  0.9965, Adjusted R-squared:  0.9953 
## F-statistic: 843.1 on 1 and 3 DF,  p-value: 8.971e-05
plot(x,y, col = 'green')
abline(fit, col = 'orange')

qqnorm(resid(fit))
qqline(resid(fit))

hist(resid(fit))

plot(fitted(fit),resid(fit))

shapiro.test(resid(fit))
## 
##  Shapiro-Wilk normality test
## 
## data:  resid(fit)
## W = 0.83427, p-value = 0.1497

2. It’s difficult to visualize the normality of only 5 data points so the Shaprio-Wilks test was used;because the p-value of 0.1497 is >0.05, so the null hypothesis needs to be accepted that the residuals come from a Normal Distribution.

According to lm():

y=-14.8+4.26 * x

Find all local maxima, local minima, and saddle points for the function given below.

\[\begin{gathered} f(x, y)=24 x-6 x y^{2}-8 y^{3} \\ f_{x}=24-6 y^{2} \\ f_{y}=-12 x y-24 y^{2} \\ 24-6 y^{2}=0 \&-12 x y-24 y^{2}=0 \\ y=\sqrt{\frac{24}{6}}=\pm 2 \\ x=-2 y=\mp 4 \end{gathered}\]
finder <- function(x,y){
   z = 24*x-6*x*y^2-8*y^3
   return(c(x,y,z))
 }
finder(-4,2)
## [1]  -4   2 -64
finder(4,-2)
## [1]  4 -2 64
min_max <- function(x,y){
  D = (24 - 6*y^2)*(-12*x*y - 24*y^2) - 144*y^2
  if(D>0){
    return("maximum or minimum")
  }
  if(D<0){
    return("Saddle point")
  }
  else{
    return("Inconclusive")
  }
}
min_max(-4,2)
## [1] "Saddle point"
min_max(4,-2)
## [1] "Saddle point"

3.A grocery store sells two brands of a product, the “house” brand and a “name” brand.

The manager estimates that if she

sells the “house” brand for x dollars and the “name” brand for y dollars, she will be able to sell 81-21 x+17y units of the “house” brand and 40+11x−23y units of the “name” brand.

Step 1. Find the revenue function R(x, y).

Revenue is the total amount of money brought in before overhead costs are removed. This will be number of units sold time price per unit.

R(x, y)=x(81-21 x+17 y)+y(40+11 x-23 y)

5.Evaluate the double integral on the given region.

\[\begin{gathered} A=\int_{2}^{4} \int_{2}^{4} e^{(8 x+3 y)} d A \\ A=\int_{2}^{4} \int_{2}^{4} e^{8 x} e^{3 y} d x d y \\ A=\int_{2}^{4} e^{8 x} d x * \int_{2}^{4} e^{3 y} d y \\ A=\left.\left.\frac{1}{8} e^{8 x}\right|_{2} ^{4} * \frac{1}{3} e^{3 y}\right|_{2} ^{4} \\ A=\left.\left.\frac{1}{24} e^{8 x}\right|_{2} ^{4} * e^{3 y}\right|_{2} ^{4} \\ A=\frac{1}{24}\left(e^{32}-e^{16}\right)\left(e^{12}-e^{6}\right) \\ A=534,156,100,000,000,000 \end{gathered}\]
1/24*((exp(32)+exp(16))*(exp(12) - exp(6)))
## [1] 5.341561e+17