我保存了我的学生化残差并进行分组,运行了如下筛选异常值:
Explore Outliers(
Y( Column Group( "Studentized Group" ) ),
Robust Fit Outliers( K Sigma( 2.5 ), Huber( 1 ) )
);
obj << Change to Missing(
现在,如果学生化列上有任何缺失,我需要从该 Y(变量)创建一个新列,使用所有原始数据,但不要在学生化残差上发现的异常值那行。
变量不只一个,可以有多个。那么它就需要具有通用性。
我想象这可能是一个公式/脚本,它检查“Studentized resid”后的字符串以找到具有相同名称的相同列,该列将创建一个新列并更改学生化残差列/行所缺少的列。
你好@Bmllnn ,
该平台将允许您创建一个脚本,该脚本可以创建一个“Culled”列,该列会删除新公式列中的异常值。
我使用示例数据文件夹中的“Diamond”数据集作为示例,如果我运行 Robust Fit Outlier 平台,我可以按“公式列”,它将创建一个已删除异常值的新列

您可以在下面的钻石数据集中看到值已被删除:

如果您想要编写脚本,您可以这样做(我添加了一个菜单选项来选择列以使其更加灵活):
dt=current data table();
cols=dt<<GET column="" names=""></GET>
<BR />
<BR />你好,
谢谢你的回答。我目前有这些:
obj << Studentized Residuals;
dt << Clear Selection;
colList = dt << Get Column Names( String );
For( i = 1, i <= N Cols( dt ), i++,
If( Contains( colList[i], "Studentized" ),
Column( colList[i] ) << Set Selected( 1 )
)
);
dt << group columns("Studentized Group");
// ANOTHER script
Names Default To Here(1);
dt=Current Data Table();
dt << Explore Outliers(
Y( Column Group("Studentized Group" ) ),
Robust Fit Outliers( K Sigma( 2.5 ), Huber( 1 ) ),
SendToReport(
Dispatch( {"Robust Fit Outliers"}, "", TabListBox, {Set Selected( 2 )} ),
Dispatch( {"Robust Fit Outliers"}, "", Tab Page Box( 2 ),
{Title( "Outliers by Cell" )}
),
Dispatch( {"Robust Fit Outliers"}, "", List Box( 9 ),
{Padding( {Left( 12 ), Top( 0 ), Right( 0 ), Bottom( 0 )} )}
),
Dispatch( {"Robust Fit Outliers"}, "", TextBox,
{Padding( {Left( 2 ), Top( 6 ), Right( 0 ), Bottom( 8 )} )}
),
Dispatch( {"Robust Fit Outliers"}, "", Panel Box( 3 ),
{Padding( {Left( 0 ), Top( 0 ), Right( 12 ), Bottom( 0 )} )}
),
Dispatch( {"Robust Fit Outliers"}, "", Lineup Box( 3 ), {Spacing( 1 )} ),
Dispatch( {"Robust Fit Outliers"}, "", Button Box( 11 ),
{Margin( {Left( 1 ), Top( 1 ), Right( 1 ), Bottom( 1 )} )}
),
Dispatch( {"Robust Fit Outliers"}, "", Button Box( 12 ),
{Margin( {Left( 1 ), Top( 1 ), Right( 1 ), Bottom( 1 )} )}
),
Dispatch( {"Robust Fit Outliers"}, "", Lineup Box( 4 ), {Spacing( 1 )} ),
Dispatch( {"Robust Fit Outliers"}, "", Button Box( 13 ),
{Margin( {Left( 1 ), Top( 1 ), Right( 1 ), Bottom( 1 )} )}
),
Dispatch( {"Robust Fit Outliers"}, "", Button Box( 14 ),
{Margin( {Left( 1 ), Top( 1 ), Right( 1 ), Bottom( 1 )} )}
)
)
);一切正常。然后,我需要从这里选择异常值,并在学生化残差的新列中执行 IF 公式(如您所提到的)。但是,之后我需要为发现有异常值的参数创建一个新列,以将其更改为真实数据集中没有异常值的列。
@Bmllnn ,
如果我理解正确的话,您有一组来自多个模型的学生化残差的列,您想要运行稳健拟合异常值,然后创建每个单独的学生化列的副本,但删除每列的异常值行?
如果是这样,您只需单击“公式列”,它就会为您生成新列,或者使用如下所示的 JSL:
Names Default to Here(1);
dt=current data table();
colList = dt << Get Column Names( String );
For( i = 1, i <= N Cols( dt ), i++,
If( Contains( colList[i], "Studentized" ),
Column( colList[i] ) << Set Selected( 1 )
)
);
dt << group columns("Studentized Group");
//Run the outliers
obj=Explore Outliers(
Y( Column Group( "Studentized Group" ) ),
);
obj<< Robust Fit Outliers( K Sigma( 2.5 ), Huber( 1 ) );//run the robust fit
wait(2);//wait to allow time for platform to run and perform calculations
obj<< Formula Columns( Suffix( "Culled" ) );//Create each column from the original studentised, with outliers removed