拟合选定数据的非线性曲线。我希望您使用用户选择的列,而不是直接使用数据表中的数据列。 但这些值没有传递到公式中。
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 )
)
),
);