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