cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
Kristin
Level I

CUSUM chart with subgroup variable

I'm trying to understand how the cusum chart is calculated usind a subgroup variable X where some X values are present multiple times. For example, I have 3-5 measurements per day and the cusum chart should be grouped by day. Since it says in the JMP help regarding X "If a value of this column is present more than once, the average response at each X value is plotted on the CUSUM chart.", I thought that the daily averages of Y are calculated and then the cusum calculation is done with the aggregated data. For T and sigma this gives the same results as the cusum calculation with the original data and day as X variable, but the chart looks completely different. Can you please give me an explanation how the calculation is done? Thank you.

4 REPLIES 4
Phil_Kay
Staff

Re: CUSUM chart with subgroup variable

Can you share an illustrative data example as a .jmp file? That will help the community to help you.

Thanks,

Phil

Kristin
Level I

Re: CUSUM chart with subgroup variable

The file CUSUM_example contains the raw data. There are several measurements for each MEAS_STARTDATE. The other file contains the average number of counts grouped by MEAS_STARTDATE (daily averages). I thought that the cusum charts should be equal for both cases, but they look completely different. Can anybody explain why? Thank you.

ian_jmp
Staff

Re: CUSUM chart with subgroup variable

In conjunction with the documentation for the platform, the script below should help you to understand how it works. Do 'File > New > New Script' cut and paste the code below into the resulting window, then do 'Edit > Run Script'):

NamesDefaultToHere(1);

ng = 10;		// Number of groups
ns = 5;			// Size of group

// Make some data
sVals = SortAscending(Repeat((1::ng)`, ns));
cVals = J(ng*ns, 1, RandomInteger(0, 20));
dt1 = NewTable("Raw Data",
		NewColumn("Group", Numeric, Ordinal, Values(sVals)),
		NewColumn("Count", Numeric, Continuous, Values(cVals))		
	);

// Do the Cusum Control Chart (note the 'Data Units' option)
dt1 << CUSUM Control Chart(Y( :Count ), X( :Group ), Show Center Line( 0 ), Data Units( 1 ));

// Agregate the data (use the 'sum' not the 'mean'!)
dt2 = dt1 << Summary(Group( :Group ), Sum( :Count ));

// Do the Cusum Control Chart with the agregated data (note the 'Data Units' option)
dt2 << CUSUM Control Chart( Y( :"Sum(Count)"n ), Show Center Line( 0 ), Data Units( 1 ));
Kristin
Level I

Re: CUSUM chart with subgroup variable

Hi Ian,

thanks for the script. I see that it's working with Data Unit option set to 1. Apart from scaling I get the same result for the sum or the mean if I dont't use data units. That's what I expected. However, the chart for the raw data looks different when setting data units to 0 (see attached image). Can you explain this?
This is my script:

NamesDefaultToHere(1);

ng = 10;		// Number of groups
ns = 5;			// Size of group

// Make some data
sVals = SortAscending(Repeat((1::ng)`, ns));
cVals = J(ng*ns, 1, RandomInteger(0, 20));
dt1 = NewTable("Raw Data",
		NewColumn("Group", Numeric, Ordinal, Values(sVals)),
		NewColumn("Count", Numeric, Continuous, Values(cVals))		
	);

// Do the Cusum Control Chart (note the 'Data Units' option)
dt1 << CUSUM Control Chart(Y( :Count ), X( :Group ), Show Center Line( 0 ), Data Units( 1 ));
dt1 << CUSUM Control Chart(Y( :Count ), X( :Group ), Show Center Line( 0 ), Data Units( 0 ));

// Agregate the data (use the 'sum' not the 'mean'!)
dt2 = dt1 << Summary(Group( :Group ), Mean( :Count ));

// Do the Cusum Control Chart with the agregated data (note the 'Data Units' option)
dt2 << CUSUM Control Chart( Y( :"Mean(Count)"n ), Show Center Line( 0 ), Data Units( 1 ));
dt2 << CUSUM Control Chart( Y( :"Mean(Count)"n ), Show Center Line( 0 ), Data Units( 0 ));

// Agregate the data (use the 'sum' not the 'mean'!)
dt3 = dt1 << Summary(Group( :Group ), Sum( :Count ));

// Do the Cusum Control Chart with the agregated data (note the 'Data Units' option)
dt3 << CUSUM Control Chart( Y( :"Sum(Count)"n ), Show Center Line( 0 ), Data Units( 1 ));
dt3 << CUSUM Control Chart( Y( :"Sum(Count)"n ), Show Center Line( 0 ), Data Units( 0 ));