Program written, modified, or edited at StatSoft, Inc.}
randomaccess;
NoDataFileVariableNames;
dim matrix(1,1), VarList1(20), VarList2(1), TempMatrix(1,1), RowVector(1);
ifault:=0;
pick := DisplayButtonBox ('Taguchi Transformation',
'Smaller the Better|Nominal the Best|Larger the Better|Signed Target');
if pick = 0 then stop;
okay := SelectVariables2 ('Select Variables for Transformation', 1, 20, VarList1, Count1, 'Dependent Variable(s)',
1, 1, VarList2, Count2, 'Result (Target) Variable');
if not okay then stop;
target :=VarList2(1);
redim matrix(ncases,Count1), VarList1(Count1), TempMatrix(ncases,1), RowVector(Count1);
{read dependent variables into matrix for transformation}
for i := 1 to Count1 do
begin
MatrixExtract (Data, 1, VarList1(i), ?NoOfRows, 1, TempMatrix);
MatrixSetColumn (Matrix, i, TempMatrix);
end;
if pick = 1 then
begin {smaller the better}
for i := 1 to NCases do
begin
sum := 0;
for j := 1 to Count1 do sum := sum + Matrix(i,j)^2;
DATA(i,target) := -10*log10(sum/Count1);
end;
end; {smaller the better}
if pick = 2 then
begin {nominal the best}
for i:= 1 to NCases do
begin
MatrixGetRow (Matrix, i, RowVector);
ValMean (RowVector, 1, ?HowMany, Mean);
ValVariance (RowVector, 1, ?HowMany, Variance);
if (Variance<=0) then ifault:=1;
DATA(i,target) := 10*log10(Mean^2/Variance);
end;
end; {nominal the best}
if pick = 3 then
begin {larger the better}
for i:= 1 to NCases do
begin
element := 0;
for j:= 1 to Count1 do begin
if (Matrix(i,j)^2<=0) then ifault:=1;
element := element+1/Matrix(i,j)^2;
end;
DATA(i,target) := -10*log10(element/Count1);
end;
end; {larger the better}
if pick = 4 then
begin {signed target}
for i:= 1 to NCases do
begin
MatrixGetRow (Matrix, i, RowVector);
ValVariance (RowVector, 1, ?HowMany, Variance);
if (Variance<=0) then ifault:=1;
DATA(i,target) := -10*log10(Variance);
end;
end; {signed target}
if (ifault=1) then DisplayMessageBox (MB_ICONEXCLAMATION, 'Some Transformations Failed',
'The respective transformation could not be computed for some cases; the TARGET values for those cases were set to missing data.');
| Back to List of Programs |
![[StatSoft]](../../../images/sssmall.gif)
2300 East 14th Street, Tulsa, OK 74104
Phone: (918) 749-1119; Fax: (918) 749-2217
e-mail: info@statsoft.com
©Copyright StatSoft, Inc., 1984-2004.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.