Johnson Transformation에서 상수를 얻는 방법안녕하세요 여러분,
저는 존슨 변환을 사용하여 열을 변환하고 수식에서 상수를 가져온 다음 역수 수식에 다시 넣어 원래 단위로 사양 한계를 계산할 수 있는 스크립트를 개발하려고 했습니다.
그래서 작업 흐름은 이렇게 될 겁니다.
열 선택-> Johnson을 사용하여 변환-> 관리도 실행-> 관리 한계를 확인하고 사용자 인터페이스로 입력-> 원래 단위로 사양 한계를 추출-> 원래 단위로 관리도를 다시 실행하고 이전 단계에서 계산된 값을 입력합니다.
이 중 대부분은 처리할 수 있을 것 같지만 변환 방정식에서 상수를 가져오는 방법을 모르겠습니다.
그래서 여기서부터

여기에 넣으려면

어떤 아이디어라도 감사합니다!
스티브
자동화 및 스크립팅Re: Johnson Transformation에서 상수를 얻는 방법수식을 표현식으로 추출한 다음 거기에서 값을 가져옵니다. 표현식이 있으면 예를 들어 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 > 수식 가져오기 > 매개변수 추출입니다.
Re: Johnson Transformation에서 상수를 얻는 방법제가 성공적으로 사용한 한 가지 방법은 연속 근사를 사용하여 변환된 분포의 값에 대한 원래 분포의 값을 찾는 것입니다. 기본적으로 원래 분포에서 값을 가져와 변환 공식에서 만든 공식을 통해 변환 분포에서 계산된 값과 일치하는 값을 찾을 때까지 전달합니다. 다음은 존슨 분포에 맞는 예이며, 변환된 열의 평균을 찾은 다음 해당 변환 평균 값에 대한 원래 분포의 값을 찾습니다. 이 예제의 경우, 단순히 역변환된 값을 로그에 씁니다.
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 );Re: Johnson Transformation에서 상수를 얻는 방법@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));
지금까지 잘 작동하고 있어요!
스티브
Re: Johnson Transformation에서 상수를 얻는 방법정말 멋지네요 @txnelson !
조금 더 실험해 볼게요. 하지만 이걸 사용하면 변환된 단위에서 타겟을 입력할 수 있을 것 같습니다(스크립트에서 열 평균을 사용하는 방식과 대조적으로). 그러면 원래 단위로 값이 출력됩니다(제가 제대로 이해했다면 말이죠).
스티브
Re: Johnson Transformation에서 상수를 얻는 방법이와 같은 경우 모든 표현식 함수가 매우 유용할 수 있습니다.

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()));
Re: Johnson Transformation에서 상수를 얻는 방법맞습니다. 또는 변환된 분포에서 얻은 다른 통계입니다.
Re: Johnson Transformation에서 상수를 얻는 방법안녕하세요 @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>Re: Johnson Transformation에서 상수를 얻는 방법변경되어서는 안 될 몇 가지 문장을 변경했습니다. 부적절한 줄을 주석 처리하고 다시 변경했습니다. 또한 제어 차트를 실행하고 제어 한계를 제거하여 원래 분포로 다시 변환하는 값으로 사용하는 기능을 추가했습니다.
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>
Re: Johnson Transformation에서 상수를 얻는 방법@txnelson 감사합니다!
그 이상을 해주셔서 감사합니다. 잘 작동합니다!
스티브