Problem 1: (7.2)A solid - fuel rocket propellant loses weight after it is produced. Months since production (x), Weight loss (y)kg.

## 
## Call:
## lm(formula = weight_loss ~ months + I(months^2))
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.005364 -0.002727  0.001045  0.002409  0.003273 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.633000   0.004196   389.2  < 2e-16 ***
## months      -1.232182   0.007010  -175.8 5.09e-14 ***
## I(months^2)  1.494545   0.002484   601.6  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.003568 on 7 degrees of freedom
## Multiple R-squared:      1,  Adjusted R-squared:      1 
## F-statistic: 1.859e+06 on 2 and 7 DF,  p-value: < 2.2e-16

Remark:
According to the fitted plot, the propellant loses weight at an increasing rate, rather than a constant rate.

## Analysis of Variance Table
## 
## Response: weight_loss
##             Df Sum Sq Mean Sq F value    Pr(>F)    
## months       1 42.703  42.703 3355253 < 2.2e-16 ***
## I(months^2)  1  4.607   4.607  361974 < 2.2e-16 ***
## Residuals    7  0.000   0.000                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Remark:
The Pr(>F) significance codes for both coefficients are zero. The regression model is statistically significant

## [1] "The value of beta_2 is  1.4945"
## [1] "The value of p-value is  0"

Remark:
B0 does not equal 0, the quadratic term is statistically significant

(d) Are there any potential hazards in extrapolating with this model?

Extrapolating with polynomial models can lead to unreliable and unexpected predictions when used outside the range of the original data.

Problem 2: (7.17)Chemical and mechanical engineers often need to know the vapor pressure of water at various temperatures (the “ infamous ” steam tables can be used for this). Vapor Pressure(y)mmHg, Temperature(x)°C

## 
## Call:
## lm(formula = vapor ~ temp)
## 
## Residuals:
##       1       2       3       4       5       6 
##  17.738  -1.090 -13.919 -17.548  -7.476  22.295 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept) -35.6667    17.2317  -2.070  0.10725   
## temp          2.7129     0.4425   6.131  0.00359 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 18.51 on 4 degrees of freedom
## Multiple R-squared:  0.9038, Adjusted R-squared:  0.8798 
## F-statistic: 37.59 on 1 and 4 DF,  p-value: 0.003586

Remark: There is some deviation at higher temperatures, suggesting a higher-order model.

Remark: The residuals are scattered from the line, showing that the model isn’t as adequate as it could be.

Remark: The points have a curved pattern, showing that the first-order model isn’t as adequate as it could be.

## 
## Call:
## lm(formula = vapor ~ temp + I(temp^2))
## 
## Residuals:
##      1      2      3      4      5      6 
## -2.179  2.893  2.014 -1.614 -3.493  2.379 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept) 20.100000   6.335989   3.172  0.05039 . 
## temp        -1.469643   0.414518  -3.545  0.03822 * 
## I(temp^2)    0.059750   0.005797  10.307  0.00195 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.542 on 3 degrees of freedom
## Multiple R-squared:  0.9974, Adjusted R-squared:  0.9956 
## F-statistic: 566.4 on 2 and 3 DF,  p-value: 0.0001357

Remark: The p-value for the quadratic term is < 0.05, suggesting that it is statistically significant.

Remark: There is almost no deviation from the line, suggesting a higher-order model is adequate.
The residuals are not scattered from the line, showing that the model is adequate.
The points have are random, showing that the second-order model is adequate.

Problem 3: (7.6)The carbonation level of a soft drink beverage is affected by the temperature of the product and the filler operating pressure. Carbonation(y), Temperature(X1), Pressure(X2)

## 
## Call:
## lm(formula = carbon ~ temp2 + pressure + I(temp2^2) + I(pressure^2) + 
##     I(temp2 * pressure))
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.75548 -0.22238 -0.00342  0.26024  0.96452 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)  
## (Intercept)         3025.3186  2045.7464   1.479   0.1897  
## temp2               -194.2729   132.0643  -1.471   0.1917  
## pressure              -6.0507    20.6063  -0.294   0.7789  
## I(temp2^2)             3.6259     2.2098   1.641   0.1519  
## I(pressure^2)          1.1542     0.3237   3.565   0.0118 *
## I(temp2 * pressure)   -1.3317     0.8962  -1.486   0.1878  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.6194 on 6 degrees of freedom
## Multiple R-squared:  0.9933, Adjusted R-squared:  0.9877 
## F-statistic: 177.2 on 5 and 6 DF,  p-value: 1.983e-06

Remark: Most residuals are small, suggesting a good fit. Only I(pressure^2) is significant at the 0.05 level. R-squared: 0.9933 and Adjusted R-squared: 0.9877 suggesting a good fit. F-stat is 177.2 with a p-value: 1.983e-06 suggesting overall the model is highly significant.

## Analysis of Variance Table
## 
## Response: carbon
##                     Df  Sum Sq Mean Sq  F value    Pr(>F)    
## temp2                1 109.964 109.964 286.5944 2.716e-06 ***
## pressure             1 224.101 224.101 584.0631 3.298e-07 ***
## I(temp2^2)           1   0.198   0.198   0.5173   0.49905    
## I(pressure^2)        1   4.776   4.776  12.4482   0.01239 *  
## I(temp2 * pressure)  1   0.847   0.847   2.2081   0.18784    
## Residuals            6   2.302   0.384                       
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Remark: The p-value for two of the coefficients are significant. .

## 
## Call:
## lm(formula = carbon ~ temp2 + pressure + I(temp2^2) + I(pressure^2) + 
##     I(temp2 * pressure))
## 
## Coefficients:
##         (Intercept)                temp2             pressure  
##            3025.319             -194.273               -6.051  
##          I(temp2^2)        I(pressure^2)  I(temp2 * pressure)  
##               3.626                1.154               -1.332
## Analysis of Variance Table
## 
## Model 1: carbon ~ temp2 + pressure + I(temp2^2) + I(pressure^2)
## Model 2: carbon ~ temp2 + pressure + I(temp2^2) + I(pressure^2) + I(temp2 * 
##     pressure)
##   Res.Df    RSS Df Sum of Sq      F Pr(>F)
## 1      7 3.1494                           
## 2      6 2.3022  1   0.84723 2.2081 0.1878

Remark: The p-value is greater than 0.05, indicating there is no evidence of lack of fit from excluding the interaction term.

Remark: The p-value for interaction term (temp2 * pressure) = 0.1878 is greater than the usual significance level of 0.05. This suggests that the interaction term does not contribute significantly to the model.

Remark: The second-order terms are not significant. P-value for temp2^2 = 0.1519 (not significant). P-value for pressure^2 = 0.0118 (significant at 0.05)

## 
## Call:
## rsm(formula = carbon ~ SO(temp2, pressure))
## 
##                  Estimate Std. Error t value Pr(>|t|)  
## (Intercept)    3025.31864 2045.74639  1.4788  0.18967  
## temp2          -194.27289  132.06428 -1.4710  0.19169  
## pressure         -6.05067   20.60625 -0.2936  0.77893  
## temp2:pressure   -1.33171    0.89619 -1.4860  0.18784  
## temp2^2           3.62587    2.20978  1.6408  0.15194  
## pressure^2        1.15425    0.32373  3.5655  0.01185 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Multiple R-squared:  0.9933, Adjusted R-squared:  0.9877 
## F-statistic: 177.2 on 5 and 6 DF,  p-value: 1.983e-06
## 
## Analysis of Variance Table
## 
## Response: carbon
##                      Df Sum Sq Mean Sq  F value    Pr(>F)
## FO(temp2, pressure)   2 334.07 167.033 435.3288 3.206e-07
## TWI(temp2, pressure)  1   0.83   0.834   2.1727   0.19092
## PQ(temp2, pressure)   2   4.99   2.494   6.5004   0.03149
## Residuals             6   2.30   0.384                   
## Lack of fit           3   0.73   0.242   0.4605   0.72969
## Pure error            3   1.58   0.525                   
## 
## Stationary point of response surface:
##    temp2 pressure 
## 30.50246 20.21707 
## 
## Eigenanalysis:
## eigen() decomposition
## $values
## [1] 3.7938410 0.9862833
## 
## $vectors
##                [,1]       [,2]
## temp2    -0.9696254 -0.2445947
## pressure  0.2445947 -0.9696254

Remark: Eigenanalysis: values are both positive => a minimum. From the plots we can see the level of carbonation increase with the increase in temperature and operating pressure.