通过带有字符串变量的dispatch控制ANOVA报告输出你好,
我正在尝试引用一个字符串变量( colname的 ) 在派遣,但它没有遵守 OutlineBox, {关闭(0)} (要么关闭(1) )而不是明确写入字符串时。
非常感谢你的帮助。
莉薇
这是代码:
For( i = 1, i <= N Items( ColumnNames ), i++,
colname = "Response " || char(colnameames[i]);
Cobj = dt << Fit Model(
Y( colnameames[i] ),
Effects( :Visit, :Group, :Group * :Visit ),
Random Effects( :SubjectNumber[:Group] ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
colnameames[i] << {Analysis of Variance( 0 ), Lack of Fit( 0 ),
Plot Actual by Predicted( 0 ), Plot Regression( 0 ),
Plot Residual by Predicted( 0 ), Plot Effect Leverage( 0 ), {:Visit <<
{LSMeans Plot( 1 ), LSMeans Contrast( [1 0 0 -1] )}, :Group << {LSMeans Plot( 1 ),
LSMeans Contrast( [1 0 0 -1] )}, :Group * :Visit << {LSMeans Plot( 1 )}}
),
SendToReport(
Dispatch(
{colname , "Effect Details", "Visit", "Contrast"},
"Test Detail",
OutlineBox,
{Close( 0 )}
),
Dispatch(
{colname , "Effect Details", "Group", "Contrast"},
"Test Detail",
OutlineBox,
{Close( 0 )}
),
Dispatch(
{colname , "Effect Details"},
"SubjectNumber[Group]",
OutlineBox,
{Close( 1 )}
)
)
);Re:使用字符串变量通过dispatch控制ANOVA报告输出非常感谢帮忙。我在你的例子中使用了解决方案,它工作了!!
Revtal
Re:使用字符串变量通过dispatch控制ANOVA报告输出在评估表达式的其余部分之前,您需要构建包含大纲框名称的字符串。 您可以使用字符串以几种不同的方式执行此操作,检查Parse(Substitute())和Eval Insert(),因为在某些情况下,它们可能是更好的选择。 但是,一种方法是使用Eval Expr(),如下所示:
尝试替换Eval(使用Write(Char)(查看日志以查看实际评估的代码)。您可以将日志复制并粘贴到脚本窗口,然后使用“重新格式化脚本”按钮。
Names default to here( 1 );
dt = Open( "$Sample_data/Iris.jmp" );
targets = {"Sepal length", "Petal length"};
For( i = 1, i <= N Items( targets ), i++,
//Here is a Fit Model expression with some parts contained in Expr()
//First the Fit model 'code' goes to Eval Expr() to evalute only those parts
//contained in Expr(). Then it goes to Eval() to actually run the code.
Eval( Eval Expr(
Fit Model(
Y( targets[i] ),
Effects( :Sepal width, :Petal width ),
Random Effects( :Species ),
NoBounds( 1 ),
Personality( "Standard Least Squares" ),
Method( "REML" ),
Emphasis( "Minimal Report" ),
Run(
:Sepal length << {Summary of Fit( 1 ), Analysis of Variance( 0 ),
Parameter Estimates( 1 ), Lack of Fit( 0 ), Plot Actual by Predicted( 0 ),
Plot Regression( 0 ), Plot Residual by Predicted( 0 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 0 )}
),
SendToReport(
Dispatch(
{ Expr( "Response" || targets[i] ) }, //This is evaluated first
"Parameter Estimates",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{ Expr( "Response" || targets[i] ) }, //This is evaluated first
"REML Variance Component Estimates",
OutlineBox,
{Close( 1 )}
),
Dispatch(
{ Expr( "Response" || targets[i] ) }, //This is evaluated first
"Fixed Effect Tests",
OutlineBox,
{Close( 1 )}
)
)
)
) );
);