2025-06-09

Introduction

  • Goal: Estimate concrete parameters based on a group of samples
  • Two types of estimates:
  • Point estimate: single value
  • Interval estimate: range of values (confidence interval)

Example: Estimating Average Concrete Strength

You collect compressive strength values from 30 samples (Mpa).

set.seed(42)
strength = rnorm(30, mean = 40, sd = 5)
summary(strength)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   26.72   38.00   39.50   40.34   45.35   51.43

Point Estimation Calculation

The point estimate for the population mean is the sample mean:

mean_strength = mean(strength)
mean_strength
## [1] 40.34293

Confidence Interval Formula

\(begin:math:display\) \bar{x} \pm t_{\alpha/2, n-1} \cdot \frac{s}{\sqrt{n}} \(end:math:display\)

Compute Confidence Interval in R

n = length(strength)
s = sd(strength)
t_value = qt(0.975, df=n-1)
ci_lower = mean_strength - t_value * s / sqrt(n)
ci_upper = mean_strength + t_value * s / sqrt(n)

Confidence Interval Output

c(ci_lower, ci_upper)
## [1] 37.99976 42.68611

Histogram of Strength (ggplot2)

library(ggplot2)
ggplot(data.frame(strength), aes(x=strength)) +
geom_histogram(binwidth=2, fill="skyblue", color="black") +
labs(title="Distribution of Measured Concrete Strength",
x="Strength (MPa)", y="Frequency")

Confidence Interval Plot (ggplot2)

ggplot(data.frame(x=1, y=mean_strength), aes(x=x, y=y)) +
geom_point(size=4) +
geom_errorbar(aes(ymin=ci_lower, ymax=ci_upper), width=0.1) +
xlim(0.5, 1.5) +
labs(title="Point Estimate with 95% Confidence Interval",
y="Strength (MPa)", x="")

Interactive Boxplot (plotly)

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
plot_ly(x = ~strength, type = "box", name = "Concrete Strength") %>%
layout(title = "Interactive Boxplot of Concrete Strength")

Conclusion

-Point estimate: ‘r round(mean_strength, 2)’ MPa -95% CI: between ‘r round(ci_lower, 2)’ and ‘r round(ci_upper, 2)’ MPa - This method helps infer properties from limited sample data.

References

  1. Devore, J.L. (2015). Probability and Statistics for Engineering and the Sciences (9th ed.)