Problem of sample size in control charts

3 views (last 30 days)
Andy
Andy on 10 Dec 2020
Answered: Rahul on 13 Mar 2025
Hi,
I am a newbie in statistical process control (SPC). I would like to do a visual comparison between xbar-s, CUSUM and EWMA charts. I would like to use similar datasets for this:
Question 1 (see datasetSingle.csv)
A single measurement (sample size n=1) is available and taken every 20 seconds for the weight of an item from a production process. There are 231 readings available. How can I use this dataset to construct xbar-s, CUSUM and EWMA charts in MATLAB so that I can compare their sensitivities? (see datasetSingle.csv)
Question 2 (see datasetMultiple.csv)
Three measurements (sample size n=3) are available and taken every minute for the weight of an item from a production process. There are 25 readings available. How can I use this dataset to construct xbar-s, CUSUM and EWMA charts in MATLAB so that I can compare their sensitivities? (see datasetMultiple.csv)

Answers (1)

Rahul
Rahul on 13 Mar 2025
Hi @Andy,
In order to achieve the required control charts of types xbar-s, CUSUM and EWMA , MATLAB provides 'controlchart' and 'cusum' functions.
The 'controlchart' function contains a 'charttype' property which can be set to 'xbar', 'ewma', 's' and several other types as well.
Here is an example:
data = csvread('datasetSingle.csv'); % Reading data
controlchart(data, 'charttype', 'ewma'); % Chart of type ewma
Note: Chart of type 'xbar' would require grouped data.
Additionally, 'cusum' function can be used to obtain the chart with cumulative sum. Here is an example:
cusum(data); % Chart with cumulative sum
For the dataset with multple redings, considering a mean of the values using the 'mean' function or some other method would be viable to obtain consistent data to be used with 'controlchart' and 'cusum' functions.
The following MATLAB Answer can be referred:
The following MathWorks documentation can be referred to knwo more:
Hope this helps! Thanks.

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!