Effect of Ultrasound Exposure Time and Oil Amount on Oil Removal Efficiency

Author

Sandeep

library(Stat2Data)
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(emmeans)
Welcome to emmeans.
Caution: You lose important information if you filter this package's results.
See '? untidy'
data(OilDeapsorbtion)

OilDeapsorbtion <- OilDeapsorbtion |>
  mutate(
    Oil = factor(Oil),
    Ultra = factor(Ultra),
    Salt = factor(Salt)
  )

head(OilDeapsorbtion)
  Salt Ultra Oil Diff
1    0     5   5  0.5
2    0     5   5  0.5
3    0     5   5  0.5
4    0     5   5 -0.5
5    0     5   5  0.0
6    0    10   5 -0.5

The dataset shows the variables Salt, Ultrasound time, Oil amount, and the difference in oil removed. Each row represents one observation from the experiment.

Dot Plots

Dot Plot: Oil Amount

ggplot(OilDeapsorbtion, aes(x = Oil, y = Diff)) +
  geom_dotplot(binaxis = "y", stackdir = "center", binwidth = 0.25) +
  labs(
    title = "Dot Plot of Difference by Amount of Oil",
    x = "Amount of Oil",
    y = "Difference in Oil Removed"
  )

The dot plot shows that when the oil amount is 10 ml, the difference in oil removed is generally higher compared to 5 ml. This suggests that higher oil amount may increase oil removal.

Dot Plot: Ultrasound Time

ggplot(OilDeapsorbtion, aes(x = Ultra, y = Diff)) +
  geom_dotplot(binaxis = "y", stackdir = "center", binwidth = 0.25) +
  labs(
    title = "Dot Plot of Difference by Ultrasound Time",
    x = "Ultrasound Time",
    y = "Difference in Oil Removed"
  )

The dot plot shows that ultrasound time of 10 minutes generally has slightly higher and more consistent oil removal compared to 5 minutes. This suggests that longer ultrasound time may improve oil removal.

Interaction Plot

interaction.plot(
  x.factor = OilDeapsorbtion$Oil,
  trace.factor = OilDeapsorbtion$Ultra,
  response = OilDeapsorbtion$Diff,
  xlab = "Amount of Oil",
  ylab = "Mean Difference in Oil Removed",
  trace.label = "Ultrasound Time",
  main = "Interaction Plot"
)

The lines in the interaction plot are not parallel and cross each other, which suggests there may be an interaction between oil amount and ultrasound time. This means the effect of ultrasound time may depend on the amount of oil. However, the ANOVA results show that this interaction is not statistically significant.

Check Model Conditions

model <- lm(Diff ~ Oil * Ultra, data = OilDeapsorbtion)

par(mfrow = c(1,1))  # reset layout

plot(model, which = 1)  # Residuals vs Fitted

plot(model, which = 2)  # Normal Q-Q

plot(model, which = 3)  # Scale-Location

plot(model, which = 5)  # Residuals vs Leverage

Residuals vs Fitted

The points are scattered randomly around zero with no clear pattern. This suggests that the model fits the data reasonably well and the linearity assumption is satisfied.

Q-Q Plot

The points are mostly close to the straight line, with a few slight deviations at the ends. This suggests that the residuals are approximately normally distributed.

Scale-Location Plot

The spread of the points is fairly consistent across the fitted values. This suggests that the variance is approximately constant, although there may be slight variation.

Residuals vs Leverage

Most points lie within the boundary lines, with no strong influential points. This suggests that there are no highly influential observations affecting the model.”

Two-Way ANOVA Results

anova(model)
Analysis of Variance Table

Response: Diff
          Df  Sum Sq Mean Sq F value   Pr(>F)   
Oil        1  4.5562  4.5562  8.7597 0.005418 **
Ultra      1  0.0563  0.0563  0.1081 0.744172   
Oil:Ultra  1  1.4063  1.4063  2.7036 0.108828   
Residuals 36 18.7250  0.5201                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(model)

Call:
lm(formula = Diff ~ Oil * Ultra, data = OilDeapsorbtion)

Residuals:
   Min     1Q Median     3Q    Max 
 -2.55  -0.15   0.00   0.45   1.45 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)   
(Intercept)     0.5000     0.2281   2.192  0.03490 * 
Oil10           1.0500     0.3225   3.255  0.00247 **
Ultra10         0.3000     0.3225   0.930  0.35850   
Oil10:Ultra10  -0.7500     0.4561  -1.644  0.10883   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.7212 on 36 degrees of freedom
Multiple R-squared:  0.2432,    Adjusted R-squared:  0.1802 
F-statistic: 3.857 on 3 and 36 DF,  p-value: 0.01719

The results show that the amount of oil has a significant effect on oil removal because its p-value is less than 0.05. However, ultrasound time does not have a significant effect since its p-value is high. The interaction between oil amount and ultrasound time is also not significant. Overall, only the amount of oil affects the difference in oil removed.

95% Confidence Intervals

means <- emmeans(model, ~ Oil * Ultra)

means
 Oil Ultra emmean    SE df lower.CL upper.CL
 5   5       0.50 0.228 36   0.0375    0.963
 10  5       1.55 0.228 36   1.0875    2.013
 5   10      0.80 0.228 36   0.3375    1.263
 10  10      1.10 0.228 36   0.6375    1.563

Confidence level used: 0.95 
confint(means)
 Oil Ultra emmean    SE df lower.CL upper.CL
 5   5       0.50 0.228 36   0.0375    0.963
 10  5       1.55 0.228 36   1.0875    2.013
 5   10      0.80 0.228 36   0.3375    1.263
 10  10      1.10 0.228 36   0.6375    1.563

Confidence level used: 0.95 

The confidence intervals show the average difference in oil removed for each combination of oil amount and ultrasound time. For all groups, the intervals are above 0, which means ultrasound helps remove more oil than the control. The highest oil removal is seen when oil = 10 and ultrasound time = 5. Overall, higher oil amount generally gives higher oil removal.

Pairwise Comparisons

pairs(means)
 contrast                     estimate    SE df t.ratio p.value
 Oil5 Ultra5 - Oil10 Ultra5      -1.05 0.323 36  -3.255  0.0126
 Oil5 Ultra5 - Oil5 Ultra10      -0.30 0.323 36  -0.930  0.7889
 Oil5 Ultra5 - Oil10 Ultra10     -0.60 0.323 36  -1.860  0.2629
 Oil10 Ultra5 - Oil5 Ultra10      0.75 0.323 36   2.325  0.1111
 Oil10 Ultra5 - Oil10 Ultra10     0.45 0.323 36   1.395  0.5105
 Oil5 Ultra10 - Oil10 Ultra10    -0.30 0.323 36  -0.930  0.7889

P value adjustment: tukey method for comparing a family of 4 estimates 
confint(pairs(means))
 contrast                     estimate    SE df lower.CL upper.CL
 Oil5 Ultra5 - Oil10 Ultra5      -1.05 0.323 36   -1.919   -0.181
 Oil5 Ultra5 - Oil5 Ultra10      -0.30 0.323 36   -1.169    0.569
 Oil5 Ultra5 - Oil10 Ultra10     -0.60 0.323 36   -1.469    0.269
 Oil10 Ultra5 - Oil5 Ultra10      0.75 0.323 36   -0.119    1.619
 Oil10 Ultra5 - Oil10 Ultra10     0.45 0.323 36   -0.419    1.319
 Oil5 Ultra10 - Oil10 Ultra10    -0.30 0.323 36   -1.169    0.569

Confidence level used: 0.95 
Conf-level adjustment: tukey method for comparing a family of 4 estimates 

Most of the group differences are not important because their p-values are greater than 0.05. Only one comparison is important, which is between oil = 5 and oil = 10 at ultrasound time = 5. This means increasing oil amount at 5 minutes increases oil removal. Overall, most group differences are not significant.

Conclusion

This study shows that the amount of oil has a significant effect on oil removal, while ultrasound time does not have a strong effect. There is also no strong interaction between oil amount and ultrasound time. The results suggest that increasing the amount of oil leads to better oil removal. Overall, oil amount is the main factor affecting the difference in oil removed.