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 )
Solution:
if we want to built simple regression \(y=b0+b1x\), then we get \(y=-14.8+4.28x\)
X<-c(5.6,6.3,7,7.7,8.4)
Y<-c(8.8,12.4,14.8,18.2,20.8)
slm<-lm(Y~X)
summary(slm)
##
## 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)
abline(slm)
if we want to build polynomial regression, such as \(y=b0+b1x+b2x^2\), then we get \(y=-21.8+6.3x-0.15x^2\)
prm<-lm(Y~X+I(X^2))
summary(prm)
##
## Call:
## lm(formula = Y ~ X + I(X^2))
##
## Residuals:
## 1 2 3 4 5
## -0.09714 0.30857 -0.34286 0.14857 -0.01714
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -21.8000 9.2269 -2.363 0.142
## X 6.2980 2.6749 2.354 0.143
## I(X^2) -0.1458 0.1907 -0.764 0.525
##
## Residual standard error: 0.3497 on 2 degrees of freedom
## Multiple R-squared: 0.9973, Adjusted R-squared: 0.9945
## F-statistic: 363.4 on 2 and 2 DF, p-value: 0.002744
X1<-c()
Y1<-c()
for (i in (1:100))
{x<-5.5+3*i/100
X1<-c(X1,x)
y<--21.8+6.3*x-0.15*x^2
Y1<-c(Y1,y)}
plot(X,Y)
lines(X1,Y1)
Find all local maxima, local minima, and saddle points for the function given below. Write your answer(s) in the form (x,y,z). Separate multiple points with a comma.
\(f(x,y)=24x-6xy^2-8y^3\)
Solution:
\(f_x(x,y)=24-6y^2=0\), or \(y=2\) and \(y=-2\)
\(f_y(x,y)=-12xy-24y^2=y(x+2y)=0\), or \(y=0\) and \(x=-2y\)
\(f_xx(x,y)=0\)
\(f_xy=-12y=0\), or \(y=0\)
\(f_yy=-12x-48y=x+4y=0\), or \(x=-4y\)
\(f_yx=-12y=0\), or \(y=0\)
Critical points are:
\((-4,2)\) and \((4,-2)\)
As \(f_{xx}(x,y)=0\), we do not have enough information to make conclusions.
Answer: For \(y=2\) and \(y=-2\), z is constant -64 and 64. And points appear to a type of saddle points, even though they are not true saddle points.
t <- function(x, y){
24*x-6*x*y^2-8*y^3
}
x <- c(-5:-3)
y <- c(1:3)
z <- outer(x, y, t)
persp(x, y, z)
x <- c(3:5)
y <- c(-3:-1)
z <- outer(x, y, t)
persp(x, y, z)
for (y in (1:3)){
x=-4
z<-24*x-6*x*y^2-8*y^3
print(paste0(x,' ',y,' ',z))
}
## [1] "-4 1 -80"
## [1] "-4 2 -64"
## [1] "-4 3 -96"
for (x in (-5:-3)){
y=2
z<-24*x-6*x*y^2-8*y^3
print(paste0(x,' ',y,' ',z))
}
## [1] "-5 2 -64"
## [1] "-4 2 -64"
## [1] "-3 2 -64"
for (x in (2:6)){
for (y in (-3:-1)){
z<-24*x-6*x*y^2-8*y^3
print(paste0(x,' ',y,' ',z))
}
}
## [1] "2 -3 156"
## [1] "2 -2 64"
## [1] "2 -1 44"
## [1] "3 -3 126"
## [1] "3 -2 64"
## [1] "3 -1 62"
## [1] "4 -3 96"
## [1] "4 -2 64"
## [1] "4 -1 80"
## [1] "5 -3 66"
## [1] "5 -2 64"
## [1] "5 -1 98"
## [1] "6 -3 36"
## [1] "6 -2 64"
## [1] "6 -1 116"
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-21x+17y\) units of the “house” brand and \(40+11x-23y\) units of the “name” brand.
Step 1. Find the revenue function R(x,y).
Step 2. What is the revenue if she sells the “house” brand for $2.30 and the “name” brand for $4.10?
Solution:
\(R(x,y)=x(81-21x+17y)+y(40+11x+23y)\)
\(R(2,3,4.1)=x(81-21x+17y)+y(40+11x+23y)=889.88\)
x<-2.3
y<-4.1
x*(81-21*x+17*y)+y*(40+11*x+23*y)
## [1] 889.88
A company has a plant in Los Angeles and a plant in Denver. The firm is committed to produce a total of 96 units of a product each week. The total weekly cost is given by \(C(x, y)=\frac{1}{6}x^2+\frac{1}{6}y^2+7x+25y+700\), where x is the number of units produced in Los Angeles and y is the number of units produced in Denver. How many units should be produced in each plant to minimize the total weekly cost?
Solution:
\(y=96-x\)
\(C(x)=\frac{1}{6}x^2+\frac{1}{6}(96-x)^2+7x+25(96-x)+700\)
\(C'(x)=\frac{1}{3}x-\frac{1}{3}(96-x)+7-25=\frac{2}{3}x-50=0\), or \(x=75\) and \(y=21\)
C<-c()
for (x in (0:96)){
y<-96-x
t<-x^2/6+y^2/6+7*x+25*y+700
C<-c(C,t)
}
match(min(C),C)-1
## [1] 75
Evaluate the double integral on the given region.
\(\int\int(e^{8x+3y}dA)\); R: \(2\ge x \ge 4\) and \(2 \ge y \ge 4\)
Write your answer in exact form without decimals.
Solution:
\(\int_2^4\int_2^4(e^{8x+3y})dxdy=\int_2^4(e^{8x+3y})/8dy=\int_2^4(e^{3y})(e^{32}-e^{16})/8dy=(e^{12}-e^{6})(e^{32}-e^{16})/24=5341559e+11\)
(exp(12)-exp(6))*(exp(32)-exp(16))/24
## [1] 5.341559e+17
InnerFunc=function(x,y){exp(8*x+3*y)}
InnerIntegral=function(y){sapply(y,function(z){integrate(InnerFunc,2,4, y=z)$value})}
integrate(InnerIntegral,2,4)
## 5.341559e+17 with absolute error < 5930