具有交互作用的回归报告的用户输入列表我有一个输入框,用户可以在其中选择要在回归报告中运行的列。 这部分效果很好。 然后我将列列表插入到列表中。 我想获取列列表并进行可以插入到回归报告中的不同交互。 具体来说,我对稍微复杂的交互感兴趣(即第 1 列 * 第 2 列 ^2)当我尝试在回归报告中放入除通用列表之外的任何内容时,它不会运行报告。 我该怎么做才能在报告中创建这些交互?
用户输入列表读数如下所示:{"Column 1", "Column 2", "Column 3"}
平台 = dt << 拟合模型(
Y( :Char(变量)),
效果(
什么应该去这里????
),
个性(“广义回归”),
广义分布(“正态”),
跑(
拟合(估计方法(两阶段前向选择),验证方法(AICc),强制遗传)
)
);
美国能源部脚本编写回复:具有交互作用的回归报告的用户输入列表脚本索引有一个效果示例 - 复制在下面。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Dogs.jmp" );
obj = Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
Effects( :drug, :dep1, :drug * :dep1 ),
Personality( Manova ),
Run( Response Function( Sum ) )
);
回复:具有交互作用的回归报告的用户输入列表这是处理此问题的一种方法
names default to here(1);
dt=data table("big class");
variable = "Age";
// If you build your list as expressions the code below works
effectsList = {height, weight, weight * height};
Fit Model(
Y( :char(variable) ),
Effects( eval(effectsList) ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:char(variable) << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Regression( 0 ),
Plot Residual by Predicted( 1 ), Plot Studentized Residuals( 0 ),
Plot Effect Leverage( 1 ), Plot Residual by Normal Quantiles( 0 ),
Box Cox Y Transformation( 0 )}
)
);
/*
// If you build your list using strings
effectsList = {"height", "weight", "weight * height"};
// You can convert the elements back to expressions by
// using the Parse() function
For( i = 1, i <= N Items( effectsList ), i++,
effectsList[i] = Parse( effectsList[i] );
);回复:具有交互作用的回归报告的用户输入列表这是使用表达式的另一种方式。 除了这个例子之外,还有更多基于表达式的解决方案。
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Dogs.jmp" );
predictor = { :drug, :dep1 };
n = N Items( predictor );
effectExpr = Expr( Effects() );
For( x1 = 1, x1 < n, x1++,
Insert Into( effectExpr, predictor[x1] );
For( x2 = 2, x2 <= n, x2++,
Eval(
Substitute(
Expr( Insert Into( effectExpr, Expr( xxx1 * xxx2 ) ) ),
Expr( xxx1 ), predictor[x1],
Expr( xxx2 ), predictor[x2]
)
)
);
);
Show( Name Expr( effectExpr) );
Eval(
Substitute(
Expr(
obj = dt << Fit Model(
Y( :LogHist0, :LogHist1, :LogHist3, :LogHist5 ),
eee,
Personality( Manova ),
Run( Response Function( Sum ) )
);
),
Expr( eee ), Name Expr( effectExpr )
)
);