library(qcc)
## Warning: package 'qcc' was built under R version 4.4.3
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
## --- Load data ---
retro <- read.csv("C:/Users/rijul/Desktop/IE 4331 Seminconductor/retrospective_resistivity (1).csv", 
                  header = FALSE)
online <- read.csv("C:/Users/rijul/Desktop/IE 4331 Seminconductor/online_resistivity (1).csv", 
                   header = FALSE)
## --- Phase I: Retrospective baseline (n = 5 per subgroup) ---
nsize <- 5

# Initial charts
xbar_init <- qcc(data = retro, type = "xbar", sizes = nsize,
                 title = "Retrospective X-bar (initial)",
                 xlab = "Subgroup", ylab = "Resistivity (Ω·cm)")

r_init <- qcc(data = retro, type = "R", sizes = nsize,
              title = "Retrospective R (initial)",
              xlab = "Subgroup", ylab = "Range (Ω·cm)")

# Exclude subgroups 6 and 16 for stable baseline
exclude_idx <- c(6, 16)

xbar_phase1 <- qcc(data = retro, type = "xbar", sizes = nsize,
                   exclude = exclude_idx,
                   title = "Retrospective X-bar (after excluding 6 & 16)",
                   xlab = "Subgroup", ylab = "Resistivity (Ω·cm)")

r_phase1 <- qcc(data = retro, type = "R", sizes = nsize,
                exclude = exclude_idx,
                title = "Retrospective R (after excluding 6 & 16)",
                xlab = "Subgroup", ylab = "Range (Ω·cm)")

## Capture numeric limits
xbar_limits <- with(xbar_phase1, c(LCL = limits[1], CL = center, UCL = limits[2]))
r_limits    <- with(r_phase1,    c(LCL = limits[1], CL = center, UCL = limits[2]))

print(round(xbar_limits, 4))
##     LCL      CL     UCL 
##  9.2895  9.9588 10.6282
print(round(r_limits, 4))
##    LCL     CL    UCL 
## 0.0000 1.1604 2.4537
## --- Phase II: Online monitoring with fixed baseline ---
xbar_online <- qcc(data = online, type = "xbar", sizes = nsize,
                   center = xbar_phase1$center, std.dev = xbar_phase1$std.dev,
                   title = "Online X-bar (fixed Phase I center & sigma)",
                   xlab = "Subgroup", ylab = "Resistivity (Ω·cm)")

r_online <- qcc(data = online, type = "R", sizes = nsize,
                center = r_phase1$center, std.dev = r_phase1$std.dev,
                title = "Online R (fixed Phase I center & sigma)",
                xlab = "Subgroup", ylab = "Range (Ω·cm)")

Using the limits established from my retrospective analysis, I applied them to the online monitoring data. All X-bar and R chart points fell within their respective control limits, and no non-random patterns were observed. This indicates that, after excluding subgroups 6 and 16—which likely reflected special-cause variation due to assignable factors such as measurement error, tool drift, or a process-specific anomaly—the process remains in statistical control.

The current online data provide no evidence of a shift in either the process mean or dispersion. As next steps, I recommend reviewing historical records related to subgroups 6 and 16 to identify potential root causes, and continuing routine statistical process control with the established limits. If future subgroups exceed control limits or display non-random trends, a focused cause analysis should be conducted promptly.