cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
MikeKim
Level III

How to backtransform the SHASH transformed value?

Hi.

I am trying to figure out the CpK of the process data.

However historical Dist analysis says, SHASH transform needed.

Thus I apply SHASH transformation to the data and analyze.

Here are the questions.

1. Can I use SHASH data as the material for Cpk?

2. Do I need to input SHASH value of the original LSL/USL to the Cpk analysis?

3. How can I back transform the SHASH value if presented by analysis?

4. Is there other consideration to this type of analysis?

 

Thank you for read.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to backtransform the SHASH transformed value?

I have done this in the past using successive approximation to do the Back Transform.  Below is a very crude example of using successive approximation on a column

names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Probe.jmp" );

// Save Columns: Save Transformed
Local( {obj},
	obj = dt << Distribution(
		Continuous Distribution( Column( :DELL_RPPBR ), Fit SHASH )
	);
	obj << (Fit Handle["SHASH"] << Save Transformed);
	obj << Close Window;
);

meandell_rppbr = col mean(dt:dell_rppbr);
meanSHASH = col mean(dt:SHASH Transform to Normal dell_rppbr);

// Determine the mean of the SHASH value in the original data distribution
// Do this by using successive approximation

// Temporarily add a new row to have a cell to be able to run the SHASH formula
dt << add rows(1);
theRow = nrows(dt);

theMax = col max(:dell_rppbr);
theMin = col min(:dell_rppbr);
targetdell_rppbr = meandell_rppbr;
theDif = col max( dt:SHASH Transform to Normal dell_rppbr)-col min(dt:SHASH Transform to Normal dell_rppbr);
count = 1;

// Successively recalculate the SHASH formula until the difference
// between the mean of the SHASH calculated mean, and the estimated 
// value is effectively zero.  
while( round(theDif,5) != 0 & count < 100,
if(dt:SHASH Transform to Normal dell_rppbr[theRow]>meanSHASH,
	theMax = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMin ),
	theMin = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMax )	
);
dt:dell_rppbr[theRow] = targetdell_rppbr;
count++;
dt << rerun formulas;
theDif = meanSHASH - dt:SHASH Transform to Normal dell_rppbr[theRow];
);

// Once the difference is effectively zero, then display the results
meanSHASHBackTransform = :dell_rppbr[theRow];
dt<<delete rows(theRow);
displayList = {};
insert into(displayList, meandell_rppbr);
insert into(displayList, meanSHASH);
insert into(displayList, meanSHASHBackTransform);

New Window("Results",
	Table Box(
		string col box("Source", {"Original Mean", "SHASH Mean", "Back Transformed Mean"}),
		number col box("Value", displayList)
	)
)
Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: How to backtransform the SHASH transformed value?

I have done this in the past using successive approximation to do the Back Transform.  Below is a very crude example of using successive approximation on a column

names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Probe.jmp" );

// Save Columns: Save Transformed
Local( {obj},
	obj = dt << Distribution(
		Continuous Distribution( Column( :DELL_RPPBR ), Fit SHASH )
	);
	obj << (Fit Handle["SHASH"] << Save Transformed);
	obj << Close Window;
);

meandell_rppbr = col mean(dt:dell_rppbr);
meanSHASH = col mean(dt:SHASH Transform to Normal dell_rppbr);

// Determine the mean of the SHASH value in the original data distribution
// Do this by using successive approximation

// Temporarily add a new row to have a cell to be able to run the SHASH formula
dt << add rows(1);
theRow = nrows(dt);

theMax = col max(:dell_rppbr);
theMin = col min(:dell_rppbr);
targetdell_rppbr = meandell_rppbr;
theDif = col max( dt:SHASH Transform to Normal dell_rppbr)-col min(dt:SHASH Transform to Normal dell_rppbr);
count = 1;

// Successively recalculate the SHASH formula until the difference
// between the mean of the SHASH calculated mean, and the estimated 
// value is effectively zero.  
while( round(theDif,5) != 0 & count < 100,
if(dt:SHASH Transform to Normal dell_rppbr[theRow]>meanSHASH,
	theMax = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMin ),
	theMin = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMax )	
);
dt:dell_rppbr[theRow] = targetdell_rppbr;
count++;
dt << rerun formulas;
theDif = meanSHASH - dt:SHASH Transform to Normal dell_rppbr[theRow];
);

// Once the difference is effectively zero, then display the results
meanSHASHBackTransform = :dell_rppbr[theRow];
dt<<delete rows(theRow);
displayList = {};
insert into(displayList, meandell_rppbr);
insert into(displayList, meanSHASH);
insert into(displayList, meanSHASHBackTransform);

New Window("Results",
	Table Box(
		string col box("Source", {"Original Mean", "SHASH Mean", "Back Transformed Mean"}),
		number col box("Value", displayList)
	)
)
Jim
MikeKim
Level III

Re: How to backtransform the SHASH transformed value?

Unfortunately I am not able to fully understand the script and the run results.

However it looks obvious that back-transformation of SHASH is not identical to the original unit. (considering the run result's value and your usage of "approximation")

Thus I simply concluded that I cannot use this transformation, since exact 1 to 1 matching is needed to this type of Cpk anlysis.

Very interesting but confusing point that general transformation such as Log and Sqrt has the exact back-transformation but this looks not the case for SHASH and several others such as maybe Box-cox.

 

One more question, as I investigated, SHASH must be sinh(arcsinh(x)), then why sinh(arcsinh(93))=93? this 93 is arbitrary but f(x)=x, I intended. Am I wrong?

Re: How to backtransform the SHASH transformed value?

Hello TXnelson, can you add the standard deviation for the original, SHASH and back transformation? Thank you very much!

txnelson
Super User

Re: How to backtransform the SHASH transformed value?

Your request, while it is not a difficult modification to the code, the interpretation is not straight forward.  To back transform the standard deviation, one has to back transform the value of one transformed standard deviation above the transformed mean and then subtract the original mean, from the new back transformed 1 std above the mean.  That is easy to do, but because the transformation changes the distribution of the data, one has to repeat the same process with the transformed value one transformed std below the mean.  The result is that the distance from the mean to the back transformed value above the mean is different than the distance from the mean to back transformed value below the mean.  In the example in my previous response the distance from the mean to the back transformed value is:  1.57, where the distance below the mean is .303  I don't know how to deal with these differences? 

Jim

Re: How to backtransform the SHASH transformed value?

Thanks Jim for you quick response. Using your code I was able to back transformed my dataset for mean but I'm new to JMP and I would not know what would the code look like - Can you help? thanks 

 

 

Original Mean: 4.92759

SHASH Mean: 0284

Back Transformed Mean: 5.14013

Original Stdv: 0.6796304

SHASH Stdv: 1.0157

txnelson
Super User

Re: How to backtransform the SHASH transformed value?

As I stated above, there is not going to be a single value for the Back Transformed STD.  The assumption has to be, that if you are transforming the data, the original, nontrans formed data, is not normally distributed.  Therefore, the back transformed standard deviation point of 1 STD above the original mean will not be the same distance from the mean, as will be 1 STD below the mean.  So the best way to show this, is to return the v1STD for above the mean and the 2 STD below the mean.  Here is the JSL to calculate all of this

names default to here(1);
dt =
// Open Data Table: Big Class.jmp
// → Data Table( "Big Class" )
Open( "$SAMPLE_DATA/Probe.jmp" );

// Save Columns: Save Transformed
Local( {obj},
	obj = dt << Distribution(
		Continuous Distribution( Column( :DELL_RPPBR ), Fit SHASH )
	);
	obj << (Fit Handle["SHASH"] << Save Transformed);
	obj << Close Window;
);

meandell_rppbr = col mean(dt:dell_rppbr);
meanSHASH = col mean(dt:SHASH Transform to Normal dell_rppbr);

// Determine the mean of the SHASH value in the original data distribution
// Do this by using successive approximation

// Temporarily add a new row to have a cell to be able to run the SHASH formula
dt << add rows(1);
theRow = nrows(dt);

theMax = col max(:dell_rppbr);
theMin = col min(:dell_rppbr);
targetdell_rppbr = meandell_rppbr;
theDif = col max( dt:SHASH Transform to Normal dell_rppbr)-col min(dt:SHASH Transform to Normal dell_rppbr);
count = 1;

// Successively recalculate the SHASH formula until the difference
// between the mean of the SHASH calculated mean, and the estimated 
// value is effectively zero.  
while( round(theDif,5) != 0 & count < 100,
if(dt:SHASH Transform to Normal dell_rppbr[theRow]>meanSHASH,
	theMax = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMin ),
	theMin = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMax )	
);
dt:dell_rppbr[theRow] = targetdell_rppbr;
count++;
dt << rerun formulas;
theDif = meanSHASH - dt:SHASH Transform to Normal dell_rppbr[theRow];
);

// Once the difference is effectively zero, then display the results
meanSHASHBackTransform = :dell_rppbr[theRow];

displayList = {};
insert into(displayList, meandell_rppbr);
insert into(displayList, meanSHASH);
insert into(displayList, meanSHASHBackTransform);

sourceList = {"Original Mean", "SHASH Mean", "Back Transformed Mean"};
meandell_rppbr = col mean(dt:dell_rppbr);
stddell_rppbr = col STDDEV(dt:dell_rppbr);
upperSTDSHASH = col mean(dt:SHASH Transform to Normal dell_rppbr)+col STDDEV(dt:SHASH Transform to Normal dell_rppbr);

// Calculate the Upper STD

// Determine the mean of the SHASH value in the original data distribution
// Do this by using successive approximation

STDSHASH = col mean(dt:SHASH Transform to Normal dell_rppbr) + 
	col STDDEV(dt:SHASH Transform to Normal dell_rppbr);

theMax = col max(:dell_rppbr);
theMin = col min(:dell_rppbr);
targetdell_rppbr = meandell_rppbr;
theDif = col max( dt:SHASH Transform to Normal dell_rppbr)-col min(dt:SHASH Transform to Normal dell_rppbr);
count = 1;

// Successively recalculate the SHASH formula until the difference
// between the mean of the SHASH calculated mean, and the estimated 
// value is effectively zero.  
while( round(theDif,5) != 0 & count < 100,
if(dt:SHASH Transform to Normal dell_rppbr[theRow]>upperSTDSHASH,
	theMax = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMin ),
	theMin = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMax )	
);
dt:dell_rppbr[theRow] = targetdell_rppbr;
count++;
dt << rerun formulas;
theDif = upperSTDSHASH - dt:SHASH Transform to Normal dell_rppbr[theRow];
);

// Once the difference is effectively zero, then display the results
UpperSTDSHASHBackTransform = :dell_rppbr[theRow] - meandell_rppbr;


insert into(displayList, stddell_rppbr);
insert into(displayList, upperSTDSHASH);
insert into(displayList, UpperSTDSHASHBackTransform);

insert into(sourceList,"Original STD" );
insert into(sourceList,"SHASH STD");
insert into(sourceList,"Back Transformed Upper STD");

// Calculate the Lower STD

// Determine the mean of the SHASH value in the original data distribution
// Do this by using successive approximation

STDSHASH = col mean(dt:SHASH Transform to Normal dell_rppbr) - 
	col STDDEV(dt:SHASH Transform to Normal dell_rppbr);

theMax = col max(:dell_rppbr);
theMin = col min(:dell_rppbr);
targetdell_rppbr = meandell_rppbr;
theDif = col max( dt:SHASH Transform to Normal dell_rppbr)-col min(dt:SHASH Transform to Normal dell_rppbr);
count = 1;

// Successively recalculate the SHASH formula until the difference
// between the mean of the SHASH calculated mean, and the estimated 
// value is effectively zero.  
while( round(theDif,5) != 0 & count < 100,
if(dt:SHASH Transform to Normal dell_rppbr[theRow]>upperSTDSHASH,
	theMax = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMin ),
	theMin = targetdell_rppbr;
	targetdell_rppbr = mean(targetdell_rppbr, theMax )	
);
dt:dell_rppbr[theRow] = targetdell_rppbr;
count++;
dt << rerun formulas;
theDif = upperSTDSHASH - dt:SHASH Transform to Normal dell_rppbr[theRow];
);

// Once the difference is effectively zero, then display the results
UpperSTDSHASHBackTransform =  meandell_rppbr - :dell_rppbr[theRow];

insert into(displayList, UpperSTDSHASHBackTransform);

insert into(sourceList,"Back Transformed Lower STD");

New Window("Results",
	Table Box(
		string col box("Source", sourceList),
		number col box("Value", displayList)
	)
);

dt<<delete rows(theRow);
Jim

Re: How to backtransform the SHASH transformed value?

Hi Jim - Thank you very much for you explanation it makes sense to me now. Also, thank you for providing the updated code!.