文字列変数を使用したディスパッチによるANOVAレポート出力の制御こんにちは、
文字列変数を参照しようとしています( 列名 ) 派遣中ですが、それに従うことができませんアウトラインボックス、 {閉じる(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 )}
)
)
);文字列変数を使用したディスパッチによるANOVAレポート出力の制御助けてくれてありがとう。私はあなたの例のように解決策を使いました、そしてそれはうまくいきました!
反乱
文字列変数を使用したディスパッチによるANOVAレポート出力の制御式の残りの部分を評価する前に、アウトラインボックスの名前を含む文字列を作成する必要があります。 場合によっては、Parse(Substitute())とEval Insert()をチェックして、文字列を使用してこれを行うことができます。 ただし、1つの方法は、次に示すように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 )}
)
)
)
) );
);