Name: Raunak Mane R: R1185197

library(qcc)
## Package 'qcc' version 2.7
## Type 'citation("qcc")' for citing this R package in publications.
?qcc

#Retrospective Analysis: 

#Loading the retrospective dataset into your control chart software.

retro<-read.csv("/Users/raunak/Downloads/retrospective_resistivity.csv",
                   header=FALSE)

#Ploting the initial X-bar and R charts.

xbar_retro <-qcc(data=retro,
                 type="xbar",
                 sizes=5)

r_retro <-qcc(data=retro,
              type="R",
              sizes=5)

Identify any out-of-control subgroups (points that fall outside of the control limits).

I’ve identified sub group 6 and 16 are out of control

I’ll remove subgroup 6, for the first iteration

retro_6 <- retro[-c(6), ]

xbar_retro <-qcc(data=retro_6,
                 type="xbar",
                 sizes=5)

r_retro <-qcc(data=retro_6,
              type="R",
              sizes=5)

The process is still out of control as subgroup 16 is out of control, so I’ll remove the subgroup 16 and reiterate again

retro_16 <- retro_6[-c(15), ]

xbar_retro_16 <-qcc(data=retro_16,
                 type="xbar",
                 sizes=5)

r_retro_16 <-qcc(data=retro_16,
              type="R",
              sizes=5)

The process in under control now.

As summary of the process, In the retrospective study, I constructed X-bar and R charts for 30 subgroups. The initial X-bar chart identified two subgroups: Subgroup 6 was above the UCL and subgroup 16 is below the LCL as special cause outliers, while the R chart showed no points beyond its limits. I removed subgroup 6, reiterated limits, and re plotted, but subgroup 16 remained still out of control. After removing subgroup 16 and recalculating again, both charts indicated a stable process: the final X-bar chart had CL ≈ 10.6385 ohm-cm with LCL ≈ 9.29 and UCL ≈ 10.64, and the final R chart had CL ≈ 1.17 with LCL = 0 and UCL ≈ 2.47

#Online Process Monitoring
online<-read.csv("/Users/raunak/Downloads/online_resistivity.csv",
                header=FALSE)

xbar_online <- qcc(data=online,
    type="xbar",
    sizes=5, center = xbar_retro_16$center,
    std.dev = xbar_retro_16$std.dev)

rbar_online <- qcc(data=online,
    type="R",
    sizes=5,
    center = r_retro_16$center,
    std.dev = r_retro_16$std.dev)

Using the data found in my retrospective analysis, I formed in-control limits for online monitoring, all X-bar and R points fell within their respective limits and showed no non-random patterns were found. I conclude that, after excluding subgroups 6 and 16 likely a special-cause variation caused due to assignable factors such as measurement error, tool drift, or the special issue in process ,but overall the process remains in statistical control; the current online data provide no evidence of a shift in the mean or dispersion. Recommended next steps are to investigate historical records for the two excluded subgroups to verify root causes and to continue routine statistical process control checks with the established limits, pausing for cause analysis if any future points breach limits or crosses the control limits.