데이터 테이블에 샘플당 여러 항목이 있는 경우 목록의 각 샘플에 대해 스크립트를 실행하는 방법입니다.동일한 샘플을 여러 번 측정한 데이터 테이블이 있습니다(아래 예 참조). 샘플은 식별자로 구분됩니다.

스크립트에서 각 샘플에 대해 동일한 계산 세트를 수행하여 관리 한계를 결정하고 A, B, C 등에 대한 관리 차트를 만들 수 있기를 원합니다. 각 샘플의 식별자를 모르겠습니다. 계산을 수행하고 차트를 만들 수 있는 스크립트가 이미 있지만 각 식별자에 대해 별도의 계산을 수행할 수는 없습니다.
나의 초기 과정은 이 작업을 수행하기 위해 일종의 루프를 사용하는 것이었습니다. 목록의 각 고유 식별자를 반환하고 루프에 대한 설정으로 고유 식별자 수를 제공하는 스크립트가 있습니다.
Identifiers = Column( "Identifier") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
그래도 루프가 작동하지 않는 것 같습니다. 이를 수행하는 더 좋은 방법이 있습니까? 아니면 누군가 나에게 루프를 수행하는 방법을 보여줄 수 있습니까?
JMP 10을 사용하고 있습니다.
감사합니다!
품질 및 프로세스 엔지니어링Re: 데이터 테이블에 샘플당 여러 항목이 있는 경우 목록의 각 샘플에 대해 스크립트를 실행하는 방법입니다.매력처럼 작동합니다. 감사합니다!
Re: 데이터 테이블에 샘플당 여러 항목이 있는 경우 목록의 각 샘플에 대해 스크립트를 실행하는 방법입니다.스크립트를 수정하지 않으려면 다음과 같이 각 식별자 수준의 하위 집합에 대해 스크립트를 실행할 수 있습니다.
Names default to here(1);
//Open some sample data
dt = Open( "$Sample_data/big class.jmp" );
//Your code
Identifiers = Column( "age") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
//A window to hold a bunch of graphs
win = New Window("Graphs", graphbox = v list box());
//Run an analysis on a subset of the data table for each level of a variable
for( i=1, i<=nUnique Identifiers, i++,
//Make a subset of the table with only values for this level
dt << Select Where( :age == UniqueIdentifiers[i]);
dtSub = dt << Subset("Selected Rows");
//run your existing script on the subset
//For demonstration, taking a picture of the graph builder platform
// and getting the R2 value from a linear model and adding those to a window
pic = (gb = dtSub << Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Close Outline( 1 ),
Add Filter(
columns( :age ),
Where( :age == Unique Identifiers[i] ),
Display( :age, N Items( 6 ) )
)
)
)) << Get Picture;
graphbox << Append( pic );
gb << Close Window;
fm = dtSub << Fit Model(
Y( :height ),
Effects( :weight ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run(
:height << {Summary of Fit( 1 ), Analysis of Variance( 1 ),
Parameter Estimates( 1 ), Scaled Estimates( 0 ),
Plot Actual by Predicted( 1 ), Plot Residual by Predicted( 1 ),
Plot Studentized Residuals( 0 ), Plot Effect Leverage( 1 ),
Plot Residual by Normal Quantiles( 0 ), Box Cox Y Transformation( 0 )}
)
);
Wait( 0 );
dtSum = Report( fm )[Outline Box( "Response height" )][Outline Box( "Whole Model" )][
Outline Box( "Summary of Fit" )][Table Box( 1 )] << Make Into Data Table;
Report( fm ) << Close Window;
Rsq = dtSum:Column 2[1];
graphbox << Append( Text Box( "RSquared was " || char(Rsq) ) );
dtSum << Close Window;
//close the subset
dtSub << Close Window;
);Re: 데이터 테이블에 샘플당 여러 항목이 있는 경우 목록의 각 샘플에 대해 스크립트를 실행하는 방법입니다.식별자로 필터링된 추가 계산을 어떻게 수행할 수 있습니까? 일부 데이터 조작을 수행한 다음 각 차트에 추가될 식별자당 데이터를 기반으로 자체 제한을 계산하고 싶기 때문에 최종 차트 스크립트 앞에 어떤 종류의 필터도 와야 한다고 생각합니다. 그렇게 할 수 있는 스크립트가 있고 필요하다면 게시할 수도 있지만 꽤 깁니다. 저는 데이터 테이블의 모든 행이 아닌 각 식별자에 대해 이미 실행한 스크립트를 만드는 방법을 찾고 있습니다.
Re: 데이터 테이블에 샘플당 여러 항목이 있는 경우 목록의 각 샘플에 대해 스크립트를 실행하는 방법입니다.내장된 관리 차트 플랫폼을 사용하여 한계를 계산하고 측정값을 플롯하는 것이 효과가 있는지 궁금합니다. 특히 식별자를 분석별 역할에 할당하는 경우 더욱 그렇습니다.
이미 사용 가능한 기능이 중복되는 경우 스크립팅에 많은 시간을 소비하지 않기를 바랍니다.
Re: 데이터 테이블에 샘플당 여러 항목이 있는 경우 목록의 각 샘플에 대해 스크립트를 실행하는 방법입니다.이를 수행하는 방법은 많지만 그 중 하나는 기존 플랫폼에 로컬 데이터 필터를 추가하는 것입니다.다음은 그래프 빌더를 사용하는 예입니다.
Names default to here(1);
//Open some sample data
dt = Open( "$Sample_data/big class.jmp" );
//Your code
Identifiers = Column( "age") << GetAsMatrix();
Identifiers set = Associative Array( Identifiers);
Unique Identifiers = Identifiers set << Get Keys;
nUnique Identifiers = N Items (Unique Identifiers);
//A window to hold a bunch of graphs
win = New Window("Graphs", graphbox = v list box());
//Open a graph that is filtered to only show each unique identifier
//to keep things organized add it to a single window.
for( i=1, i<=nUnique Identifiers, i++,
win << Append(<BR /> //To get this script I opened graph builder and added a local data filter for one age<BR /> //and then copied/pasted it here and replaced the age with 4Unique Identifiers[i]
Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Close Outline( 1 ),
Add Filter(
columns( :age ),
Where( :age == Unique Identifiers[i] ),
Display( :age, N Items( 6 ) )
)
)
)
)
);