이상값 자동 선택여러 배치로 구성된 7000개의 행이 있습니다.나는 배치별 분포를 수행하고 이상값을 찾기 위해 이상값 상자 그림을 사용하고 있습니다.그런데 배치가 100개가 넘습니다. JMP에서 어떤 행이 이상치인지 자동으로 선택하도록 할 수 있는 방법이 있나요?
Re: 이상값 자동 선택이게 너한테 필요한 거야?
Names Default To Here( 1 );
// make a sample data table
dt = New Table( "Data",
add rows( 10000 ),
New Column( "it", Numeric, Ordinal, Format( "Best", 8 ), Formula( Row() ) ),
New Column( "Batch", Numeric, Ordinal, Format( "Best", 8 ), formula( Random Integer( 110 ) ) ),
New Column( "y1", Numeric, Continues, Format( "Best", 8 ), formula( Random Lognormal( :Batch / 10, 5 ) ) ),
New Column( "y2", Numeric, Continues, Format( "Best", 8 ), formula( Random Lognormal( :Batch / 10, 5 ) ) ),
New Column( "Out",
Numeric,
Ordinal,
Format( "Best", 8 ),
Set Property( "Value Colors", {0 = -13977687, 1 = -4222943} ),
Color Cell by Value,
formula( 0 )
),
New Column( "Outy1",
Numeric,
Ordinal,
Format( "Best", 8 ),
Set Property( "Value Colors", {0 = -13977687, 1 = -4222943} ),
Color Cell by Value,
formula( 0 )
),
New Column( "Outy2",
Numeric,
Ordinal,
Format( "Best", 8 ),
Set Property( "Value Colors", {0 = -13977687, 1 = -4222943} ),
Color Cell by Value,
formula( 0 )
),
);
dt << run formulas;
Column( dt, "it" ) << delete formula;
Column( dt, "Batch" ) << delete formula;
Column( dt, "y1" ) << delete formula;
Column( dt, "y2" ) << delete formula;
Column( dt, "Out" ) << delete formula;
Column( dt, "Outy1" ) << delete formula;
Column( dt, "Outy2" ) << delete formula;
// now we get to work
// make a list of batches
byvarlist = Associative Array( dt:Batch ) << get keys;
// make a list of columns
cols = dt << get column names( Continuous ); //List all Numeric columns
// loop through the batches
For( i = 1, i <= N Items( byvarlist ), i++,
// select each batch
dt << select where( dt:Batch == byvarlist[i] );
// subset each batch
subdt = dt << Subset( Selected Rows( 1 ) );
// clear selection for smoth workflow
dt << clear select;
// finde outliers in each variable within each batch
For( ii = 1, ii <= N Items( cols ), ii++,
out = Eval(
Parse(
"subdt << get rows where(
subdt:" || Char( cols[ii] ) || " > Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.75 ) + 1.5 * (Col Quantile( subdt:" || Char( cols[ii] ) || ", 0.75 ) - Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.25 )) | subdt:" || Char( cols[ii] ) || " <
Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.25 ) - 1.5 * (Col Quantile( subdt:" || Char( cols[ii] ) || ", 0.75 ) - Col Quantile( subdt:" || Char( cols[ii] ) ||
", 0.25 )));"
)
)`;
Eval( Parse( "column (subdt, \!"Out" || Char( cols[ii] || "\!" )[" || Char( out ) || "] = 1;" ) ) );
// also indicate the global outlier
Column( subdt, "Out" )[out] = 1;
//wait (0.00001);
);
// update original data table with new information for the batch
subdt << delete columns( "Batch" );
subdt << delete columns( cols );
dt << Update( With( subdt ), Match Columns( :it = :it ) );
Close( subdt, No Save );
//Wait( 0.00001 );
);
dt << color by column( :Out );
Re: 이상값 자동 선택간단한 질문 하나만 더 드리겠습니다. 열 90개 정도 삭제했는데 괜찮을까요?
n개의 열로 구성되어 있나요? 아니면 항상 3개의 열이어야 하나요?
Re: 이상값 자동 선택작동하는 것 같습니다.감사해요.
Re: 이상값 자동 선택이제 그것이 당신에게 효과가 있는지 확인하십시오 ...
당신이 보낸 스크립트는 당신의 데이터에 전혀 적용되지 않았습니다...
Re: 이상값 자동 선택첨부된 내용은 제가 이것을 사용하려고 했던 데이터의 예입니다.이상적으로는 각 Y에 대해 이 작업을 수행합니다.
Re: 이상값 자동 선택내 수식은 배치 크기에 민감하지 않습니다. 또한 배치 열이 문자(숫자가 아님)인 경우에도 작동합니다.
배치가 2~3개뿐이라도 샘플을 게시할 수 있나요?Re: 이상값 자동 선택이를 실행하면 하나의 테이블이 생성되고 여기에 해당 스냅샷이 표시됩니다.
모든 항목을 선택하려면 Out = 1인 행을 선택할 수 있기 때문에 작동합니다.
특이치.
[이미지: image.png]
Re: 이상값 자동 선택전체 스크립트를 실행하면 원하는 것을 얻을 수 있다는 것을 알 수 있습니까(단, 데이터에는 없음)?Re: 이상값 자동 선택나는 //이제부터 아래로 작업을 시작하는 모든 것을 복사합니다. 내가 이것을 실행할 때
내 테이블을 사용하면 하나의 배치만 포함된 하나의 테이블이 생성됩니다. 꼭 말해야겠습니다
한 가지 문제는 배치당 포인트 수가 일정하지 않다는 것입니다. 그래요
그게 중요한지 모르겠어요.
Re: 이상값 자동 선택이것은 나에게 효과적이었습니다.
결국에는 3개의 테이블이 있어야 합니다. 모든 행이 포함된 원본, 하나는 이상값만 있고 마지막 행은 이상값이 없습니다. 작동하는지 알려주세요.
Names Default To Here( 1 );<BR /><BR />// make a sample data table<BR />dt = New Table( "Data",<BR /> add rows( 10000 ),<BR /> New Column( "it", Numeric, Continues, Format( "Best", 8 ), Formula( Row() ) ),<BR /> New Column( "Batch", Numeric, Ordinal, Format( "Best", 8 ), formula( Random Integer( 110 ) ) ),<BR /> New Column( "y", Numeric, Continues, Format( "Best", 8 ), formula( Random Lognormal( :Batch / 10, 5 ) ) ),<BR /> New Column( "Out", Numeric, Ordinal, Format( "Best", 8 ), formula( 0 ) ), <BR /><BR />);<BR /><BR />dt << run formulas;<BR />Column( dt, "it" ) << delete formula;<BR />Column( dt, "Batch" ) << delete formula;<BR />Column( dt, "y" ) << delete formula;<BR />Column( dt, "Out" ) << delete formula;<BR /><BR />// now we get to work<BR />dt = Current Data Table();<BR />byvarlist = Associative Array( dt:Batch ) << get keys;<BR />For( i = 1, i <= N Items( byvarlist ), i++,<BR /> dt << select where( dt:Batch == byvarlist[i] );<BR /> subdt = dt << Subset( Selected Rows( 1 ) );<BR /> dt << clear select;<BR /> subdt:Out << set formula(<BR /> If(<BR /> :y > Col Quantile( :y, 0.75 ) + (Col Quantile( :y, 0.75 ) - Col Quantile( :y, 0.25 )) * 1.5, 1,<BR /> :y < Col Quantile( :y, 0.25 ) - (Col Quantile( :y, 0.75 ) - Col Quantile( :y, 0.25 )) * 1.5, 1,<BR /> 0<BR /> )<BR /> );<BR /> subdt << run formulas;<BR /> Column( subdt, "Out" ) << delete formula;<BR /> keep = {"it", "Out"};<BR /> todelete = subdt << get column names( "string" );<BR /> For( icol = 1, icol <= N Items( keep ), icol++,<BR /> Remove From( todelete, Contains( todelete, Keep[icol] ), 1 )<BR /> );<BR /> subdt << delete columns( todelete );<BR /> dt << Update( With( subdt ), Match Columns( :it = :it ) );<BR /> Close( subdt, No Save );<BR /> Wait( 0.00001 );<BR />);<BR />selected = dt << select where( :Out == 1 );<BR />selected << Markers( 11 );<BR />selected << Marker Size( 8 );<BR />selected << Row Colors( red );<BR />dt << clear select;<BR /><BR />dt << select where( dt:Out == 1 );<BR />Outdt = dt << Subset( Selected Rows( 1 ) );<BR />dt << clear select;<BR /> <BR />Wait( 0.00001 );<BR /> <BR />dt << select where( dt:Out == 0 );<BR />indt = dt << Subset( Selected Rows( 1 ) );<BR />dt << clear select;<BR /><BR />
Re: 이상값 자동 선택내가 방금 보낸 마지막 메시지를 받았는지 잘 모르겠습니다. 이상한 메시지가 왔습니다.
자동 이메일로 돌아옵니다. 두 번째 문제를 해결했는데 아직도 계속 진행 중입니다.
같은 것.
Re: 이상값 자동 선택for 루프에서는 그렇지 않습니다.Re: 이상값 자동 선택내 배치 열이 대문자로 표시되었습니다.
[이미지: image.png]
Re: 이상값 자동 선택열 이름은 대소문자를 구분합니다. :Batch 또는 :batch를 사용할 때 일관성을 유지하세요.Re: 이상값 자동 선택이것을 실행했을 때 첫 번째 배치만으로 하위 집합 테이블이 만들어졌습니다. 나
내 열린 테이블을 수행하도록 이것을 변경했습니다.
dt = currentdatatable();
byvarlist = Associative Array( dt:Batch ) << get keys;
For( i = 1, i <= N Items( byvarlist ), i++,
dt << select where( dt:batch == byvarlist[i] );
subdt = dt << Subset( Selected Rows( 1 ) );
dt << clear select;
subdt:Out << set formula(
If(
:y > Col Quantile( :y, 0.75 ) + (Col Quantile( :y, 0.75 )
-Col Quantile( :y, 0.25 )) * 1.5, 1,
:y < Col Quantile( :y, 0.25 ) - (Col Quantile( :y, 0.75 )
-Col Quantile( :y, 0.25 )) * 1.5, 1,
0
)
);
subdt << run formulas;
Column( subdt, "Out" ) << delete formula;
keep = {"it", "Out"};
todelete = subdt << get column names( "string" );
For( icol = 1, icol <= N Items( keep ), icol++,
Remove From( todelete, Contains( todelete, Keep[icol] ), 1 )
);
subdt << delete columns( todelete );
dt << Update( With( subdt ), Match Columns( :it = :it ) );
Close( subdt, No Save );
);
selected = dt << select where( :Out == 1 );
selected << Markers( 11 );
selected << Marker Size( 8 );
selected << Row Colors( red );
dt << clear select;Re: 이상값 자동 선택다시 시도해볼게
매끄러운 솔루션은 아니지만 단계가 명확하고 수정하기 쉽습니다.
Names Default To Here( 1 );
// make a sample data table
dt = New Table( "Data",
add rows( 10000 ),
New Column( "it", Numeric, Continues, Format( "Best", 8 ), Formula( Row() ) ),
New Column( "Batch" ,Numeric, Ordinal, Format( "Best", 8 ), formula( random integer (110) )),
New Column( "y" ,Numeric, Continues, Format( "Best", 8 ), formula( random log normal (:Batch / 10, 5) )),
New Column( "Out" ,Numeric, Ordinal, Format( "Best", 8 ), formula (0)),
);
dt << run formulas;
column (dt, "it") << delete formula;
column (dt, "Batch") << delete formula;
column (dt, "y") << delete formula;
column (dt, "Out") << delete formula;
// now we get to work
// extract the list of the by variable levels
byvarlist = Associative Array( dt:Batch ) << get keys;
// run across each group and locate the outliers
For( i = 1, i <= N Items( byvarlist ), i++,
// produce a subset data table for each group using selection method
dt << select where (dt:batch == byvarlist[i]);
subdt = dt << Subset(
Selected Rows( 1 ),
);
dt << clear select;
// indicate outliers within the group
subdt:Out << set formula(
If(
:y > Col Quantile( :y, 0.75 ) + (Col Quantile( :y, 0.75 ) -
Col Quantile( :y, 0.25 )) * 1.5, 1,
:y < Col Quantile( :y, 0.25 ) - (Col Quantile( :y, 0.75 ) -
Col Quantile( :y, 0.25 )) * 1.5, 1,
0
)
);
subdt << run formulas;
// prepare table for updating original by removing formulas and columns that are not needed
column (subdt, "Out") << delete formula;
keep = {"it", "Out"};
todelete = subdt << get column names( "string" );
For( icol = 1, icol <= N Items( keep ), icol++,
Remove From( todelete, Contains( todelete, Keep[icol] ), 1 )
);
subdt << delete columns( todelete );
// update
dt << Update(
With( subdt ),
Match Columns( :it = :it )
);
Close( subdt, No Save );
);
// now the original data has all the outliers indicated in a column
selected = dt << select where (:Out == 1);
selected << Markers( 11 );
selected << Marker size ( 8 );// not working???
selected << Row Colors( red );// not working???
dt << clear select;
Re: 이상값 자동 선택테이블을 배치별로 분할하고 고유한 값으로 그룹화한 다음(행이 손실되지 않도록) 내 스크립트를 실행해 보세요.
그렇지 않으면 내가 제공하는 것과는 다른 전략이 필요합니다.
말이 되나요?Re: 이상값 자동 선택내 데이터와 함께 작동하도록 할 수 없습니다. 열의 높이와 무게를 변경하고 테이블을 열고 테이블에 포함시킨 두 줄을 제거했지만 평가가 완료되었다고 표시되지만 아무 작업도 수행하지 않습니다.
또한 각 배치에 대해 by와 this를 개별적으로 사용하는 것도 필요합니다.
Re: 이상값 자동 선택안녕,
아마도 해결책은 다음과 같습니다.
https://community.jmp.com/t5/Discussions/How-to-extract-month-in-words-from-a-date-value-how-to-change/mp/19362/highlight/true#M17650
론
Re: 이상값 자동 선택Grubb의 스크립트를 사용해 보았습니다.이는 단지 이상값만 표시하고 행을 강조 표시하지 않습니다. 그렇죠?행을 강조할 뭔가가 필요합니다.
Re: 이상값 자동 선택by에 변수가 필요한 경우 선별 이상값이 작동하지 않습니다.제가 하고 싶은 것은 Y가 한 열에 있다는 것입니다.또 다른 열에는 배치라는 레이블이 지정되어 있습니다.배치별로 넣어서 배치를 하듯 배포 횟수를 만들어요.100개의 분포를 가정해 보세요.100개 분포 모두에서 모든 이상값을 강조 표시하는 스크립트를 원합니다.이상적으로는 행만 강조 표시하므로 다른 용도로 색상을 사용하므로 나만의 색상을 선택할 수 있습니다.이제 좀 더 이해가 되시나요?
Re: 이상값 자동 선택검색해 보셨다면 파일 교환 의 일부 JMP 커뮤니티 을 위한 ' 국외자 ,' 다음 두 가지 유틸리티 스크립트를 찾았을 것입니다.
물론, 이러한 각 테스트의 통계적 근거는 귀하의 상황과 기준에 적합해야 합니다.
Re: 이상값 자동 선택나는 당신이 찾고 있는 것이 정확히 무엇인지 잘 모르겠습니다.특정 분포에 대한 행을 선택하려는 경우 출력을 볼 때 이상값 상자 그림에 표시된 이상값 데이터 포인트를 드래그하면 이상값 데이터 포인트가 선택됩니다.

그러나 열에서 열로 이동하여 이상치 행을 선택하려는 경우 간단한 스크립트로 그렇게 할 수 있습니다. 그러나 행 선택은 모든 열에 걸쳐 이루어지며 결과적으로 열 중 하나가 선택된 선택 행이 된다는 점을 기억하십시오. .
실제로 원하는 것은 이상값인 모든 개별 셀에 색상을 지정하는 간단한 스크립트입니다.평균보다 훨씬 높으면 빨간색이고, 평균보다 낮으면 주황색일 수 있습니다.
당신이 찾고 있는 것이 무엇인지 정확히 설명해 주시겠습니까?
더 나은 답변은 Dan의 답변을 참조하세요.
Re: 이상값 자동 선택분석 > 선별 > 특이치 탐색을 살펴보는 것이 좋습니다.