從約翰遜變換中獲取常數的一些方法嘿大家,
我試圖開發一個腳本,使用約翰遜變換來轉換一列,然後能夠從公式中獲取常數,並將其放回逆公式中,這樣我就可以使用它來計算其原始單位的規格限制。
所以工作流程會是這樣的
選擇一列->使用Johnson進行轉換->運行控製圖->查看控制限是什麼並進入我的用戶界面,->以原始單位吐出規格限->以原始單位再次運行控製圖並輸入前面步驟計算的結果。
我想我可以處理大部分內容,但我不知道如何從變換方程式中獲得常數。
所以從這裡

放在這裡

感謝您的任何想法!
史蒂夫
自動化和腳本回覆:從約翰遜變換中獲取常數的一些方法將公式提取到表達式中,然後從中取得值。有了表達式之後,您就可以使用 Arg() 從公式中選擇值
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
new_cols = dt << New Formula Column(
Operation(Category("Distributional"), "Johnson Normalizing"),
Columns(:weight)
);
new_col = Remove From(new_cols, 1)[1];
f_expr = Column(dt, new_col << get name) << Get Formula;
Show(Arg(f_expr, 1), Arg(f_expr, 2));
社群中關於此問題的貼文很少,這裡是JMP > JSL > 取得公式 > 擷取參數
回覆:從約翰遜變換中獲取常數的一些方法我成功使用的一種方法是使用連續近似法從轉換後的分佈中找到原始分佈中的值。它基本上從原始分佈中獲取值,並將其傳遞給轉換公式創建的公式,直到找到與轉換分佈計算的值匹配的值。這是一個適合約翰遜分佈的例子,找到變換後的列的平均值,然後在原始分佈中找到該變換平均值的值。在範例中,它只是將轉換後的值寫入日誌。
Names Default To Here( 1 );
dt =
// Open Data Table: Semiconductor Capability.jmp
// → Data Table( "Semiconductor Capability" )
Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
theColumn = "NPN1";
Distribution(
Continuous Distribution(
Column( as column(theColumn) ),
Process Capability( Use Column Property Specs ),
Fit Johnson(save distribution formula)
),
SendToReport(
Dispatch( {"NPN1"}, "Process Capability", OutlineBox, {Close( 1 )} )
)
);
// Find the back transform of the calculated mean of the transformed distribution
theTargetCol = Column( dt, N Cols( dt ) ) << get name;
theFormula = Char( As Column( dt, theTargetCol ) << get formula );
theTarget = Col Mean( Column( dt, theTargetCol ) );
// Change the reference to the original column used in the transformation to _X_
// so it can be used in the back transform
Substitute Into( theFormula, ":"|| theColumn, "_X_" );
// The formula needs to create a memory variable to allow for comparison.
// Add the resulting variable name to be the resulting variable when the
// formula is executed
theFormula = "theResult = " || theFormula || ";";
// Successive Approximation will be used to get the back transform
// Use the min and max of the original column to start the approximations
theMax = Col Max(as column(theColumn) );
theMin = Col Min( as column(theColumn) );
// Loop through the approximations for up to 100 loops to find the value
For( i = 1, i <= 100, i++,
_X_ = Mean( theMax, theMin );
Eval( Parse( theFormula ) );
If(
theResult > theTarget, theMax = _X_,
theResult < theTarget, theMin = _X_,
Break()
);
);
// Display the findings in the log
Show( theTarget, theResult, _X_, i );回覆:從約翰遜變換中獲取常數的一些方法謝謝@jthi !
我修改了你的腳本來提取每個單獨的參數,如下所示:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
new_cols = dt << New Formula Column(
Operation(Category("Distributional"), "Johnson Normalizing"),
Columns(:weight)
);
new_col = Remove From(new_cols, 1)[1];
f_expr = Column(dt, new_col << get name) << Get Formula;
test1=contains(char(arg(f_expr))," - (",1);
test2=contains(char(arg(f_expr)),"))",1);
c1=num(substr(char(arg(f_expr)),num(test1)+4,num(test2)-num(test1)-4));
test3=contains(char(arg(f_expr))," / ",1);
test4=contains(char(arg(f_expr)),") *",1);
c2=num(substr(char(arg(f_expr)),num(test3)+4,num(test4)-num(test3)-4));
test5=contains(char(arg(f_expr))," * ",1);
test6=contains(char(arg(f_expr)),"+",1);
c3=num(substr(char(arg(f_expr)),num(test5)+4,num(test6)-num(test5)-4));
c4=Arg(f_expr, 2);
Show(Arg(f_expr, 1), Arg(f_expr, 2));
到目前為止工作順利!
史蒂夫
回覆:從約翰遜變換中獲取常數的一些方法那真的很酷@txnelson !
我會對此進行更多的嘗試,但看起來我可以使用它來從轉換後的單位中輸入一個目標(與腳本僅使用列平均值的方式相比),它將以原始單位輸出值(如果我理解正確的話)。
史蒂夫
回覆:從約翰遜變換中獲取常數的一些方法對於這樣的情況,所有的表達式函數都非常有用

N Arg(f_expr);
Head(f_expr);
Head Name(f_expr);
Head(Arg(f_expr, 1));
Head(Arg(Arg(f_expr, 1), 1));
有時你可能會想加入 Extract Expr
Extract Expr(f_expr, (:weight - Wild()));
回覆:從約翰遜變換中獲取常數的一些方法這是正確的,或者你從變換後的分佈中獲得的任何其他統計數據
回覆:從約翰遜變換中獲取常數的一些方法嘿@txnelson ,
我修改了你的腳本(盡量不要太過畏縮,哈哈),這樣我就可以輸入我的規格限制並得到這些限制的轉換值,這很棒。然而,對於我的工作流程,我實際上需要能夠從轉換後的資料輸入規格限制(因此在轉換後的資料上執行控製圖)並將它們輸出到原始資料值中。我遵循了大部分程式碼,但還不足以讓我有信心自己嘗試進一步修改,所以想知道這是否可以在此程式碼中進行快速修復,以基本上逆轉它當前正在做的事情?
Names Default To Here( 1 );
dt=current data table();
theColumn = dt<<GET selected="" columns=""> theTarget_lcl, theMax = _X_,
theResult_lcl < theTarget_lcl, theMin = _X_,
Break()
);
);
// Display the findings in the log
Show( theTarget_lcl, theResult_lcl);
// Find the back transform of the calculated mean of the transformed distribution
theTargetCol = Column( dt, N Cols( dt ) ) << get name;
theFormula_ucl = Char( As Column( dt, theTargetCol ) << get formula );
theTarget_ucl = nebvalue2;
// Change the reference to the original column used in the transformation to _X_
// so it can be used in the back transform
Substitute Into( theFormula_ucl, ":"|| theColumn[1], "_X_" );
// The formula needs to create a memory variable to allow for comparison.
// Add the resulting variable name to be the resulting variable when the
// formula is executed
theFormula_ucl = "theResult_ucl = " || theFormula_ucl || ";";
// Successive Approximation will be used to get the back transform
// Use the min and max of the original column to start the approximations
theMax = Col Max(as column(theColumn) );
theMin = Col Min( as column(theColumn) );
// Loop through the approximations for up to 100 loops to find the value
For( i = 1, i <= 1000, i++,
_X_ = thetarget_ucl;
Eval( Parse( theFormula_ucl ) );
If(
theResult_ucl > theTarget_ucl, theMax = _X_,
theResult_ucl < theTarget_ucl, theMin = _X_,
Break()
);
);
// Display the findings in the log
Show( theTarget_ucl, theResult_ucl);
neb3<<SET></SET></GET>
<P>謝謝您的任何意見和/或幫助!</P>
<BR />
<P>史蒂夫</P>回覆:從約翰遜變換中獲取常數的一些方法你修改了一些不該修改的陳述。我已註解掉不適當的行,然後將其改回來。我還添加了運行控製圖、剝離控制限並將它們用作轉換回原始分佈的值的功能。
Names Default To Here( 1 );
dt=current data table();
theColumn = dt<<GET selected="" columns=""> theTarget_lcl, theMax = _X_,
theResult_lcl < theTarget_lcl, theMin = _X_,
Break()
);
);
neb1 << set( _X_ );
// Display the findings in the log
Show( i,_x_,theTarget_lcl, theResult_lcl);
// Find the back transform of the calculated mean of the transformed distribution
//theTargetCol = Column( dt, N Cols( dt ) ) << get name;
theFormula_ucl = Char( As Column( dt, theTargetCol ) << get formula );
//theTarget_ucl = nebvalue2;
// Change the reference to the original column used in the transformation to _X_
// so it can be used in the back transform
Substitute Into( theFormula_ucl, ":"|| theColumn[1], "_X_" );
// The formula needs to create a memory variable to allow for comparison.
// Add the resulting variable name to be the resulting variable when the
// formula is executed
theFormula_ucl = "theResult_ucl = " || theFormula_ucl || ";";
// Successive Approximation will be used to get the back transform
// Use the min and max of the original column to start the approximations
theMax = Col Max(as column(theColumn) );
theMin = Col Min( as column(theColumn) );
// Loop through the approximations for up to 100 loops to find the value
For( i = 1, i <= 15000, i++,
_X_ = Mean( theMax, theMin );
//_X_ = thetarget_ucl;
Eval( Parse( theFormula_ucl ) );
If(
theResult_ucl > theTarget_ucl, theMax = _X_,
theResult_ucl < theTarget_ucl, theMin = _X_,
Break()
);
);
// Display the findings in the log
Show( i,_x_,theTarget_ucl, theResult_ucl);
neb2 << set( _X_ );
neb3<<SET></SET></GET>
回覆:從約翰遜變換中獲取常數的一些方法謝謝@txnelson !
感謝您的超越。這很有效!
史蒂夫