如何将变量传递给 Fit Life by X 中的 X 参数?大家好,
I need to dynamically pass variables to the X parameter in the fit life by x function. The first part of my code generates the analysis report as expected, but the second part only brings up the startup window without a report.
我的代码如下:
Names Default To Here(1);
dt = Open( "$sample_data/big class.jmp" );
x_var = "sex";
y_var = "weight";
obj1 = dt << Fit Life by X(
Distribution( Weibull ),
Nested Model Tests( Location and Scale ),
Y( Eval(y_var) ),
X( :sex ),
);
wait(2);
obj2 = dt << Fit Life by X(
Distribution( Weibull ),
Nested Model Tests( Location and Scale ),
Y( :weight ),
X( Eval(x_var) ),
);
有谁遇到过这个问题或者知道如何正确地将变量传递给 X 参数?
谢谢!
自动化和脚本可靠性分析回复:如何将变量传递给 Fit Life by X 中的 X 参数?请参阅以下内容。
由于缺少“关系”,代码试图根据 X 做出最佳猜测。但在代码检查 X 的地方,在本例中,X 还不是有效列。因此,只要提供完整的信息,代码就不需要陷入陷阱。
Names Default To Here(1);
dt = Open( "$sample_data/big class.jmp" );
x_var = "sex";
y_var = "weight";
obj1 = dt << Fit Life by X(
Distribution( Weibull ),
Relationship( Location and Scale ),
Nested Model Tests( Location and Scale ),
Y( Eval(y_var) ),
X( :sex ),
);
wait(2);
obj2 = dt << Fit Life by X(
Distribution( Weibull ),
Relationship( Location and Scale ),
Nested Model Tests( Location and Scale ),
Y( :weight ),
X( Eval(x_var) ),
);
回复:如何将变量传递给 Fit Life by X 中的 X 参数?这似乎需要做更多的工作来解决,因为“正常”强制不起作用
Names Default To Here(1);
dt = Open("$sample_data/big class.jmp");
x_var = "sex";
y_var = "weight";
myexpr = EvalExpr(dt << Fit Life by X(
Distribution( Weibull ),
Nested Model Tests( Location and Scale ),
Y( :weight ),
X(Expr(NameExpr(AsColumn(dt, x_var)))),
));
show(myexpr);
obj = Eval(myexpr);
其中一个极其罕见的情况是,我会说使用 Eval(Parse()) (邪恶的解析),但这似乎有效
Names Default To Here(1);
dt = Open("$sample_data/big class.jmp");
x_var = "sex";
y_var = "weight";
obj2 = Eval(Parse(Eval Insert("\[dt << Fit Life by X(
Distribution(Weibull),
Nested Model Tests(Location and Scale),
Y(:weight),
X(:^x_var^)
)]\")));回复:如何将变量传递给 Fit Life by X 中的 X 参数?此异常似乎是一个错误。在第二种情况下,嵌套模型检验参数无法识别。请将此问题报告给 JMP 技术支持 ( support@jmp.com ),以便将其作为缺陷输入并进行跟踪。
回复:如何将变量传递给 Fit Life by X 中的 X 参数?哦,这完全正确。非常感谢!
回复:如何将变量传递给 Fit Life by X 中的 X 参数?这也是另一种解决方法。谢谢!