이변량 그래프에서 요인 범위 추출임의의 Y 값을 사용하여 이 곡선과 95% CI의 교차점을 효율적으로 추출하려면 어떻게 해야 합니까?

dt = Open( "$sample_data/Growth.jmp" );
biv = Bivariate(
Y( :age ),
X( :ratio ),
Fit Line( {Line Color( {204, 121, 41} )}, save studentized residuals ),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Grid Line Order( 3 ), Reference Line Order( 4 )}
)
)
);
biv << (Curve[1] << Save Studentized Residuals);
biv2 = Bivariate(
Y( :Studentized Residuals age ),
X( :ratio ),
Fit Polynomial( 2, {Confid Shaded Fit( 1 ), Line Color( {212, 73, 88} )} ),
SendToReport(
Dispatch(
{},
"ratio",
ScaleBox,
{Min( 0.2796875 ), Max( 1.2666259765625 ), Inc( 0.2 ), Minor Ticks( 1 )}
),
Dispatch(
{},
"Studentized Residuals age",
ScaleBox,
{Add Ref Line( 1.96, "Solid", "Black", "", 1 ),
Add Ref Line( -1.96, "Solid", "Black", "", 1 )}
)
)
);따라서 곡선과 95% CI가 +/- 1.96(총 6개 값)을 교차하는 비율 값을 얻고 싶습니다. 내가 생각할 수 있는 무차별 대입보다 더 나은 솔루션이 있습니까? 예측값과 평균 신뢰 한계 공식을 테이블에 덤프하고 값이 있는 행을 테이블에 추가하여 한계를 초과하는지 확인하는 것입니다.
고급 통계 모델링데이터 접근데이터 탐색 및 시각화대량 맞춤화Re: 이변량 그래프에서 요인 범위 추출확장 @Craige_Hales 그리고 @Mark_Bailey 의 코드에서 전체 최소값을 찾기 위해 아래와 같은 작업을 수행한 다음 각 측면에서 후속 검색에 대한 범위로 사용할 수 있으므로 초기 값에 의존하지 않아도 됩니다.또한 절대값 대신 사각형을 사용하면 모서리가 제거됩니다. 실제로는 프로파일러의 옵티마이저에서 단계 변경과 함께 절댓값 및 기타 기능을 사용하여 운이 좋았습니다.
Names Default To Here( 1 );
// example data set
dt = Open( "$sample_data/Growth.jmp" );
// fit first-order polynomial model to response
biv = Bivariate(
Y( :age ),
X( :ratio ),
Fit Line
);
// save residuals for next step
biv << (Curve[1] << Save Studentized Residuals);
biv << Close Window();
// fit second-order polynomial model to residuals
biv = Bivariate(
Y( :Studentized Residuals age ),
X( :ratio ),
Fit Polynomial( 2, {Confid Shaded Fit( 1 ), Line Color( {212, 73, 88} )} )
);
// save formulas for lower / upper 95% confidence bound
biv << (Curve[1] << Mean Confidence Limit Formula);
// get formulas
fUpper = Column( dt, N Cols( dt ) ) << Get Formula;
fLower = Column( dt, N Cols( dt ) - 1 ) << Get Formula;
// replace predictor name with x
fsUpper = Substitute( Name Expr( fUpper ), Expr( :ratio ), Expr( x ) );
fsLower = Substitute( Name Expr( fLower ), Expr( :ratio ), Expr( x ) );
// initialize x, could get x that predicts mean residual = 0
x = 0.5;
// find the minimum of the whole expression, one solution will fall above and one below this value
fOverallMin = Name Expr( fsLower );
Minimize( fOverallMin, { x } );
xOverallMin = x;
// find where the value cross the x axis on each side of the overall min
x = xOverallMin - 1;
fMinCrossingTarget = Insert( Expr( Power() ), Insert( Expr( add(-1.96) ), Name Expr( fsLower ) ) );
Minimize( fMinCrossingTarget, { x(-1000, xOverallMin) } );
xMinLower = x;
x = xOverallMin + 1;
Minimize( fMinCrossingTarget, { x(xOverallMin, 1000) } );
xMinUpper = x;
x = xOverallMin - 1;
fMaxCrossingTarget = Insert( Expr( Power() ), Insert( Expr( add(-1.96) ), Name Expr( fsUpper ) ) );
Minimize( fMaxCrossingTarget, { x(-1000, xOverallMin) } );
xMaxLower = x;
x = xOverallMin + 1;
Minimize( fMaxCrossingTarget, { x(xOverallMin, 1000) } );
xMaxUpper = x;
show(xOverallMin, xMinLower, xMinUpper, xMaxLower, xMaxUpper);
Re: 이변량 그래프에서 요인 범위 추출요인 그리드(빨간색 삼각형에서 요인 그리드 재설정)를 조정하여 하나의 한계만 얻거나 다른 한계를 얻을 수 있습니다.
Re: 이변량 그래프에서 요인 범위 추출내 생각에 문제는 절댓값 함수가 멋진 도함수가 없는 곡선을 만들어 최소화가 실패할 가능성이 높다고 생각합니다. 나는 바라고 있었다 @ih 아이디어는 최소화가 올바른 이웃에 머물도록 강제하지만 그렇지 않을 수도 있습니다.
지금은 퍼즐을 풀 시간이 없습니다. 이 문제에 대해 abs()에 대한 표준 대안이 있는 것 같습니다. 더 부드러운 기능을 제공합니다. (아마도 그것을 제곱? 그런 것.)
편집: 그리고 귀하의 결과가 제 의견과 일치하므로 육안 검사에 대한 의견이 있습니다. abs 함수는 함수에서 최소화할 코너를 만들고 그 코너 근처의 기울기는 최소화 함수에서 사용하며 답변의 각 측면에서 연속(2차?) 도함수를 기대합니다. 기울기 이후 곧 정답의 양쪽을 뒤집는데, 때때로 근사한 답을 얻는다는 것이 놀랍습니다. 로그의 메시지는 이것 때문일 수 있습니다.
Re: 이변량 그래프에서 요인 범위 추출예를 들어 2차 공식을 사용하여 1.96과 교차하는 예측 곡선을 계산했으며 이 숫자를 시작 조건에 대입해도 상당히 예측할 수 없는 동작이 발생합니다.

사용 방법을 보여 주셔서 감사합니다. 이 예제에서 많은 것을 배웠지만 아직 충분히 강력하지는 않습니다.
Re: 이변량 그래프에서 요인 범위 추출@Craige_Hales , 초기 값 문제를 해결하기 위해 전체 함수를 먼저 최소화하면 해당 비율을 최소화 검색의 한계로 사용할 수 있으며 양쪽에서 값을 찾을 수 있습니다. 0.8이 될 수 있는 이 문제의 경우:
Minimize( fa, { x([very small number],[min ratio - found from minimizing the function]) } );
//For this example -10 is arbitrary (could use -1E6 or something), and 0.8 is
//roughly the overall function minimum
Minimize( fa, { x(-10,0.8) } );
Re: 이변량 그래프에서 요인 범위 추출사소한 변화
offset = 1.96;
// (I do not know how to pick these without a visual examination of the result.)
startingPoint = 1.1; // or 0.5 (trial and error. pick something close and check.)
// example data set
dt = Open( "$sample_data/Growth.jmp" );
// fit first-order polynomial model to response
biv = Bivariate( Y( :age ), X( :ratio ), Fit Line );
// save residuals for next step
biv << (Curve[1] << Save Studentized Residuals);
biv << Close Window();
// fit second-order polynomial model to residuals
biv = Bivariate( Y( :Studentized Residuals age ), X( :ratio ), Fit Polynomial( 2, {Confid Shaded Fit( 1 ), Line Color( {212, 73, 88} )} ) );
// save formulas for lower / upper 95% confidence bound
biv << (Curve[1] << save predicteds);
biv << (Curve[1] << Mean Confidence Limit Formula);
// get formulas, using order columns were saved
fupper = Column( dt, N Cols( dt ) ) << Get Formula;
flower = Column( dt, N Cols( dt ) - 1 ) << Get Formula;
fpredicted = Column( dt, N Cols( dt ) - 2 ) << Get Formula;
// replace predictor name with x
fsupper = Substitute( Name Expr( fupper ), Expr( :ratio ), Expr( x ) );
fslower = Substitute( Name Expr( flower ), Expr( :ratio ), Expr( x ) );
fspredicted = Substitute( Name Expr( fpredicted ), Expr( :ratio ), Expr( x ) );
fsupper2 = Substitute( Expr( a - offset ), Expr( a ), Name Expr( fsupper ) ); // find zero at offset
fslower2 = Substitute( Expr( a - offset ), Expr( a ), Name Expr( fslower ) ); // find zero at offset
fspredicted2 = Substitute( Expr( a - offset ), Expr( a ), Name Expr( fspredicted ) ); // find zero at offset
// initialize x, could get x that predicts mean residual = 0
x = startingPoint;
// minimize expression that is Abs( residual ), or mean = 0
faupper = Insert( Expr( Abs() ), Name Expr( fsupper2 ) );
Minimize( faupper, {x} );
xupper = x;
Show( xupper, Eval( faupper ) );
// initialize x, could get x that predicts mean residual = 0
x = startingPoint;
// minimize expression that is Abs( residual ), or mean = 0
falower = Insert( Expr( Abs() ), Name Expr( fslower2 ) );
Minimize( falower, {x} );
xlower = x;
Show( xlower, Eval( falower ) );
// initialize x, could get x that predicts mean residual = 0
x = startingPoint;
// minimize expression that is Abs( residual ), or mean = 0
fapredicted = Insert( Expr( Abs() ), Name Expr( fspredicted2 ) );
Minimize( fapredicted, {x} );
xpredicted = x;
Show( xpredicted, Eval( fapredicted ) );
// add lines on plot
Report( biv )[axisbox( 2 )] << {Add Ref Line( xpredicted, "Solid", "Black", "P", 1 ), Add Ref Line( xupper, "Solid", "Black", "U", 1 ),
Add Ref Line( xlower, "Solid", "Black", "L", 1 )};
Report( biv )[axisbox( 1 )] << {Add Ref Line( offset, "Solid", "Black", "", 1 )};
Report( biv )[framebox( 1 )] << Frame Size( 752, 513 );
Low sideLow side낮은 쪽
High sideHigh side 높은 쪽
Re: 이변량 그래프에서 요인 범위 추출프로파일러에 내장된 옵티마이저를 사용하여 이 작업을 수행할 수 있습니다.목표와 일치하도록 응답 한계를 설정한 다음 상한값과 하한값을 찾으려면 계수 그리드 재설정을 사용하여 최소값 위 또는 아래에서 검색할 값 범위를 정의하십시오.
Profiler(
Y( :Lower 95% Mean Studentized Residuals age ),
Profiler(
1,
Desirability Functions( 1 ),
Lower 95% Mean Studentized Residuals age <<
Response Limits(
{Lower( -0.04, 0.0183 ), Middle( 1.96, 1 ), Upper( 3.96, 0.0183 ),
Goal( "Match Target" ), Importance( 1 )}
),
Term Value( ratio( 0.8, Min( 0 ), Max( 0.8 ), Lock( 0 ), Show( 1 ) ) )
),
SendToReport(
Dispatch(
{"Prediction Profiler"},
"1",
ScaleBox,
{Min( 0 ), Max( 0.8 ), Inc( 0.2 ), Minor Ticks( 0 )}
)
)
) << Maximize Desirability;
Profiler(
Y( :Lower 95% Mean Studentized Residuals age ),
Profiler(
1,
Desirability Functions( 1 ),
Lower 95% Mean Studentized Residuals age <<
Response Limits(
{Lower( -0.04, 0.0183 ), Middle( 1.96, 1 ), Upper( 3.96, 0.0183 ),
Goal( "Match Target" ), Importance( 1 )}
),
Term Value( ratio( 1.52, Min( 0.8 ), Max( 2 ), Lock( 0 ), Show( 1 ) ) )
),
SendToReport(
Dispatch(
{"Prediction Profiler"},
"1",
ScaleBox,
{Min( 0.8 ), Max( 2 ), Inc( 0.2 ), Minor Ticks( 0 )}
)
)
) << Maximize Desirability;
또한 동일한 결과를 얻기 위해 1.96을 빼고 잔차를 최소화하여 최소화 함수에 보내는 표현식을 수정할 수 있어야 합니다.어떤 이유로 허용 오차를 조정한 후에도 약간 다른 값을 얻습니다(프로파일러에서 1.07 v 최소화로 1.03).
fa = Insert( Expr( Abs() ), parse( "abs( " || char( Name Expr( fs ) ) || " - 1.96 )" ) );
// find lower value
x = 0.2;
Minimize( fa, { x(0.2,0.8) } );
Show( x );
// find upper value
x = 1;
Minimize( fa, { x(0.8,1.5) } );
Show( x );
Re: 이변량 그래프에서 요인 범위 추출예, 이것은 지역 최소값을 찾는 데 정확히 작동하지만 거기에서 1.96으로 다음 교차점에 도달하는 것은 여전히 어렵습니다. 값이 1.96을 초과할 때까지 곡선을 따라 올라가야 합니다.
이 문제를 일시적으로 해결하기 위해 값이 한계(또는 최대 단계 수)를 초과할 때까지 약간의 단계를 거쳐 양방향으로 나가는 함수를 만들었지만 JMP에 이를 구현하는 솔버 함수가 있을 것으로 예상했습니다. 더 나은 알고리즘(비선형 플랫폼에 내장된 것과 같은). 지금은 내가 필요한 것이 있다고 생각하지만 더 좋은 방법을 위해 항상 열려 있습니다.
Re: 이변량 그래프에서 요인 범위 추출예, 그 문제는 일반적으로 대상 값(왼쪽에 하나, 오른쪽에 하나)이 있는 교차가 여러 개 있고 바람직성 최대화 도구를 사용하면 둘 중 하나를 무작위로 얻는다는 것입니다.
적합 모델에서 역 예측을 시도했지만 2차 항을 지원하지 않습니다.
Re: 이변량 그래프에서 요인 범위 추출코드가 약간 지저분했습니다. 나는 여전히 잘못된 목표를 쫓고 있을지도 모르지만 그것을 정리하고 예제를 마쳤습니다.
Names Default To Here( 1 );
// example data set
dt = Open( "$sample_data/Growth.jmp" );
// fit first-order polynomial model to response
biv = Bivariate(
Y( :age ),
X( :ratio ),
Fit Line
);
// save residuals for next step
biv << (Curve[1] << Save Studentized Residuals);
biv << Close Window();
// fit second-order polynomial model to residuals
biv = Bivariate(
Y( :Studentized Residuals age ),
X( :ratio ),
Fit Polynomial( 2, {Confid Shaded Fit( 1 ), Line Color( {212, 73, 88} )} )
);
// save formulas for lower / upper 95% confidence bound
biv << (Curve[1] << Mean Confidence Limit Formula);
// get upper formula
f = Column( dt, N Cols( dt ) ) << Get Formula;
// replace predictor name with x
fs = Substitute( Name Expr( f ), Expr( :ratio ), Expr( x ) );
// initialize x, could get x that predicts mean residual = 0
x = 0.5;
// minimize expression that is Abs( residual ), or mean = 0
fa = Insert( Expr( Abs() ), Name Expr( fs ) );
Minimize( fa, { x } );
Show( x );Re: 이변량 그래프에서 요인 범위 추출다른 접근법이 궁금합니다. Prediction Profiler 및 Match Target desirability 함수를 대상 응답과 함께 사용하면 어떻게 될까요? 그런 다음 예측된 평균과 평균의 95% 신뢰 구간 추정치를 선택할 수 있습니다.
당신의 원래 목표에서 벗어났을 수도 있습니다...
Re: 이변량 그래프에서 요인 범위 추출@Mark_Bailey 감사합니다. 한 번 시도했지만 구문이 명확하지 않습니다.
이것은 내가 얻은 것입니다. 그러나 이제 올바른 최적화 제약 조건을 제공하는 방법을 알아내야 합니다.
Names Default To Here( 1 );
dt = Open( "$sample_data/Growth.jmp" );
biv = Bivariate(
Y( :age ),
X( :ratio ),
Fit Line( {Line Color( {204, 121, 41} )}, save studentized residuals ),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Grid Line Order( 3 ), Reference Line Order( 4 )}
)
)
);
biv << (Curve[1] << Save Studentized Residuals);
biv << close window();
biv2 = Bivariate(
Y( :Studentized Residuals age ),
X( :ratio ),
Fit Polynomial( 2, {Confid Shaded Fit( 1 ), Line Color( {212, 73, 88} )} ),
SendToReport(
Dispatch(
{},
"ratio",
ScaleBox,
{Min( 0.2796875 ), Max( 1.2666259765625 ), Inc( 0.2 ), Minor Ticks( 1 )}
),
Dispatch(
{},
"Studentized Residuals age",
ScaleBox,
{Add Ref Line( 1.96, "Solid", "Black", "", 1 ),
Add Ref Line( -1.96, "Solid", "Black", "", 1 )}
)
)
);
biv << (Curve[1] << Mean Confidence Limit Formula);
f =column(dt, n cols(dt)) << Get Formula;
fs = substitute(name expr(f), expr(:ratio), expr(x1));
/*A = [1 5];
b = [-1.96, 1.96];
minFun = Constrained Maximize(
f,
{x1( 0, 5 )},
<<LESSTHANEQ></LESSTHANEQ>
minimize(name expr(f), {})마지막 부분이 작동하지 않습니다. 당신의 도움을 주셔서 감사합니다!
Re: 이변량 그래프에서 요인 범위 추출Minimize() 함수와 신뢰 경계에 대한 표현식을 사용할 수 있습니다. 다음에 대한 도움말을 참조하십시오. 최적화 방법 .
Re: 그래프에서 범위 추출나는 직접적인 방법을 모르지만 여기에 몇 가지 아이디어가 있습니다.일부는 스크립트 작성에 약간의 작업이 필요할 수 있으며 아마도 작은 문제에 대해 훨씬 더 빠른 것은 없을 것입니다.
- 이변량 보고서의 표에서 매개변수와 표준 오류를 가져온 다음 적절한 수식이 있는 열을 만들어 해당 행 각각에 대한 수식을 데이터 테이블에 저장합니다.그런 다음 프로파일러에 내장된 옵티마이저를 사용하여 각각을 해결합니다.
- 무차별 대입 방법을 사용하여 상대적으로 적은 수의 점을 저장한 다음 적합 모델을 사용하여 새 곡선을 해당 점에 맞춥니다. 그 다음에 예측 공식을 저장하고 옵티마이저로 해결하십시오.
- 대신 예측 수식을 직접 추출할 수 있어야 하지만 CI가 아닌 적합 모델을 사용하여 적합합니다.
- 무차별 대입 방법을 사용하고 가장 가까운 몇 개의 점 사이를 보간합니다. 마지막 2개 사이에서 선형이거나 이 문제의 경우 가장 가까운 3개 사이에서 2차입니다.