擬合選定數據的非線性曲線。我希望您使用用戶選擇的列,而不是直接使用數據表中的數據列。 但這些值沒有傳遞到公式中。
Y_axis = colListY << Get Items;
X_axis = colListX << Get Items;
Group_by = colListBy << Get Items;
New Column( "Model",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
Parameter(
{p = 0.29, x0 = 15, m0 = 1.2, x1 = 30, m1 = 5},
p * (1 - Exp( -(:X_axis / x0) ^ m0 )) + (1 - p) * (1
-Exp( -(:X_axis / x1) ^ m1 ))
)
),
);
nlin = dt << Nonlinear(
SendToByGroup( Bygroup Default ),
Y( :Y_axis ),
X( :Model ),
Iteration Limit( 1000 ),
Unthreaded( 1 ),
QuasiNewton BFGS,
Finish,
By(:Group_By )<BR /> );
基礎數據分析和建模視窗回复:擬合所選數據的非線性曲線。您必須擁有數據表中的數據才能使用不同的平台。 您可以使用以下方式構建用戶選擇新窗戶() 。
回复:擬合所選數據的非線性曲線。我創建了一個新窗口,讓用戶使用這些列列錶框選擇所需的字段。 但是如何將這些值傳遞給非線性函數,因為它僅從數據表中獲取列。
Button box("X Column", colListX<<APPEND></APPEND>

回复:擬合所選數據的非線性曲線。維努沙,
由於您沒有自定義用戶對話框的完整腳本,因此我猜測問題所在。 我認為這是如何獲取和使用 ColListBox 的輸入。 下面是為 JSL 應用程序書籍編寫的腳本的片段。 colListBox 的結果是列名稱、文本的列表,而不是列引用。
_init = {_yusr={}, _xusr={}, _gusr={}};
EvalList(_init);
//define expressions, actions
_src_get = Expr( _src << Get Selected );
//dialog
ccol_dlg = New Window("Custom Column Dialog", <<MODAL></MODAL>
指定 X 變量的列性別。 運行此腳本並查看 LOG 窗口中的輸出
show(_yusr, _xusr, _gusr);
/*:
_yusr = {"weight", "height"};
_xusr = {"sex"};
_gusr = {"age"};
您的腳本新列公式和 NLN 需要列引用。 我相信這就是賈莫告訴你的。
//:*/
show(Column(_gusr[1]))
/*:
Column(_gusr[1]) = Column("age");
_gusr[1] 是列名“age”,要引用該列,請使用 Column(_gusr[1]) ,即 Column("age) ,相當於:年齡。
回复:擬合所選數據的非線性曲線。@維努沙, @jthi ,
我在版本 16 和 17 中沒有太多使用 JMP。 先前的腳本是為 JMP 13 編寫的。 從那時起,JMP/JSL 將用戶窗口變量保留為列格式。 所以腳本可以更簡單。 請參閱 col_dlg 的輸出。
bc_dt = Open( "$SAMPLE_DATA/Big Class.JMP" );
//Below is JSL to build the basic dialog using the Column Dialog function.
col_dlg = Column Dialog(
_yVar = ColList( "Y, Response",, Data Type(Numeric), MinCol (1) ),
_xVar = ColList( "X, Treatment", Data Type(Character), MinCol(1), MaxCol(1) ),
_grpVar = ColList( "Group Factors", Data Type(Any) ),
);
Show( col_dlg, col_dlg["_yVar"], col_dlg["_xVar"],
col_dlg["_grpVar"], col_dlg["Button"] );
If (col_dlg["Button"] == -1, Throw( "User Cancel") );
Remove From( col_dlg , N Items(col_dlg) ); //Remove the last item
Eval List ( col_dlg );
Show( col_dlg, _yVar, _xVar, _grpVar );
這是輸出
Show( col_dlg, _yVar, _xVar, _grpVar );
/*:
col_dlg = {_yVar = {:height, :weight}, _xVar = {:sex}, _grpVar = {:age}, Button(1)};
col_dlg["_yVar"] = {:height, :weight};
col_dlg["_xVar"] = {:sex};
col_dlg["_grpVar"] = {:age};
col_dlg["Button"] = 1;
col_dlg = {_yVar = {:height, :weight}, _xVar = {:sex}, _grpVar = {:age}};
_yVar = {:height, :weight};
_xVar = {:sex};
_grpVar = {:age};
因此,您可以將列引用為 _yVar[1] 等。
回复:擬合所選數據的非線性曲線。您(通常)可以使用 Eval()
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Nonlinear Examples/US Population.jmp");
nw = New Window("User Selections", << Modal, << Return Result,
H List Box(
Panel Box("Column Selections",
window:fcs = Filter Col Selector(dt)
),
Panel Box("User Selections",
Lineup Box(N Col(2),
Button Box("X", << Set Function(Function({this},
(this << sib) << Set Items((window:fcs << Get Selected));
))),
clb_x = Col List Box(dt, Min Items(1), Max Items(1), N Lines(2)),
Button Box("Y", << Set Function(Function({this},
(this << sib) << Set Items((window:fcs << Get Selected));
))),
clb_y = Col List Box(dt, Min Items(1), Max Items(1), N Lines(2)),
Button Box("By", << Set Function(Function({this},
(this << sib) << Set Items((window:fcs << Get Selected));
))),
clb_by = Col List Box(dt, Max Items(1), N Lines(2)),
)
),
Panel Box("Actions",
Lineup Box(N Col(1),
Button Box("OK",
x_selection = clb_x << get items;
y_selection = clb_x << get items;
by_selection = clb_x << get items;
),
Button Box("Cancel"),
)
)
)
);
obj = Nonlinear(
Y(Eval(y_selection)),
X(Eval(x_selection)),
Finish()
);回覆:擬合所選資料的非線性曲線。我執行了相同的操作,但收到錯誤,並且在資料表中顯示的是列名稱而不是值。
Names Default To Here( 1 );
Error = expr(New Window("JMP ALERT" , <<MODAL></MODAL>回覆:擬合所選資料的非線性曲線。對於公式,您可能必須在那裡評估所選列。 這篇文章提供了一些想法使用 Eval Insert、Eval Expr、Parse 和 Substitute 將一個表達式插入另一個表達式
回覆:擬合所選資料的非線性曲線。為什麼在這種情況下使用 Exp 和 Eval 很重要?當我們從使用者那裡獲取輸入時,您能否將它們與這個方程式一起使用。
x_selection = colListX << get items;
y_selection = colListY << get items;
by_selection = colListBy << get items;
New Column( "Model",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula(
Parameter(
{p = 0.29, x0 = 15, m0 = 1.2, x1 = 30, m1 = 5},
p * (1 - Exp( -(Eval(x_selection)/ x0) ^ m0 )) + (1 - p) * (1
-Exp( -Eval(x_selection)/ x1) ^ m1 )
)
),
);