我保存了我的學生化殘差並進行分組,運行瞭如下篩選異常值:
Explore Outliers(
Y( Column Group( "Studentized Group" ) ),
Robust Fit Outliers( K Sigma( 2.5 ), Huber( 1 ) )
);
obj << Change to Missing(
現在,如果學生化列上有任何缺失,我需要從該 Y(變數)建立一個新列,使用所有原始數據,但不要在學生化殘差上發現的異常值那行。
變數不只 1 個,可以有多個。那麼它需要具有通用性。
我想像這可能是一個公式/腳本,它檢查“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