回复:從圖中提取範圍我不知道直接的方法,但這裡有一些想法。有些腳本需要一些工作,可能我懷疑對於小問題,沒有一個會更快。
- 通過從雙變量報告中的表中提取參數和標準誤差,然後使用適當的公式創建列,將這些行中的每一行的公式保存到數據表中。然後使用分析器內置的優化器來解決每個問題。
- 使用蠻力方法保存相對較少的點,然後使用擬合模型為它們擬合新曲線,並且然後保存預測公式並使用優化器求解。
- 使用擬合模型進行擬合,您應該能夠直接提取預測公式,但可能不是 CI。
- 使用蠻力方法並在最近的幾個點之間進行插值,要么在最後兩個點之間線性,要么在最近的三個點之間進行二次插值。
從二元圖中提取因子範圍如何使用任意 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 個值)。 有沒有比我能想到的蠻力更好的解決方案:將預測值和平均置信限公式轉儲到表中,並將帶有值的行添加到表中以查看它何時超過限制?
腳本編寫回复:從二元圖中提取因子範圍您也許可以使用 Minimize() 函數和置信邊界表達式。 請參閱幫助優化方法.
回复:從二元圖中提取因子範圍@馬克貝利謝謝,我試過試一試,但語法對我來說不清楚。
這是我得到的,但現在我需要弄清楚如何為它提供正確的優化約束:
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), {})最後一部分不起作用。 謝謝你的幫助!
回复:從二元圖中提取因子範圍我想知道另一種方法。 如果您對目標響應使用預測刻畫器和匹配目標合意性函數會怎樣? 然後你可以選擇預測均值和均值的 95% 置信區間估計值。
我可能偏離了你最初的目標......
回复:從二元圖中提取因子範圍你的代碼有點亂。 我清理它並完成了示例,儘管我可能仍在追求錯誤的目標。
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 );回复:從二元圖中提取因子範圍是的,那個問題是目標值通常有多個交叉點(一個在左邊,一個在右邊),並且使用意願最大化器你會隨機得到兩個中的一個。
我在擬合模型下嘗試了逆預測,但不支持二次項。
回复:從二元圖中提取因子範圍是的,這確實適用於找到局部最小值,但仍然很難從那里以 1.96 到達下一個交叉點。 您仍然需要沿著曲線向上走,直到值超過 1.96。
為了臨時解決這個問題,我為它構建了一個函數,它只需要很少的步驟並在兩個方向上輸出,直到值超過限制(或最大步數),但我曾期望在 JMP 中有一個求解器函數可以實現更好的算法(例如內置於非線性平台的算法)。 我想現在我有我需要的東西,但我總是樂於尋找更好的方法來做到這一點。
回复:從雙變量圖中提取因子範圍您可以使用探查器中內置的優化器來執行此操作。設置響應限制以匹配目標,然後找到上限和下限,只需使用重置因子網格來定義要搜索的值範圍,高於或低於最小值。
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 並最小化殘差以獲得相同的結果。出於某種原因,即使在調整容差後我得到的值也略有不同(在 profiler v 1.03 中為 1.07,最小化)。
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 );