두 가지 데이터 세트가 있습니다. 하나는 매주 또는 격주로 플롯에서 수행 된 곤충 수의 평균치입니다. 다른 하나는 매주 측정 된 생산량입니다. 곤충의 수확량에 미치는 영향을 분석 할 수 있도록이 두 데이터 표를 결합하려고합니다.
나는 이것을 가지고있다:

그리고 JMP에서 이것을 만들려고합니다.
44 주와 45 주 동안 나는 수확량 값을 간단히 움직였습니다. 그러나 47 주 동안 나는 46 주와 47 주로부터 수확량을 합산해야합니다. 49 주째에도 마찬가지입니다. 52 주 동안 저는 50-52 주에서 수확량을 합계했습니다.
나는 곤충과 양보 샘플링의 많은 구획과 고르지 않은 주를 가지고있다.
어떤 도움을 주셔서 감사합니다.
원하는 것을 얻는 한 가지 방법이 있습니다.
names default to here(1);
dtInsects = New Table( "Insects",
Add Rows( 10 ),
New Column( "Week",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [39, 40, 41, 42, 43, 44, 45, 47, 49, 52] )
),
New Column( "Plot#",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01]
)
),
New Column( "Insects",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 0.2, 0.2, 3.6, 15.4, 2.6, 0.3, 0.3, 0.3, 0.7] )
)
);
dtYields = New Table( "Yields",
Add Rows( 9 ),
New Column( "Week",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [44, 45, 46, 47, 48, 49, 50, 51, 52] )
),
New Column( "Plot#",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01, 59.01]
)
),
New Column( "Yield",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[130.96, 343.1, 466.2, 903.59, 2611.25, 1052.88, 1335.74, 1414.32,
500.25]
)
)
);
// Join the data
dtTogether = dtInsects << Join(
With( dtYields ),
Merge Same Name Columns,
By Matching Columns( :Week = :Week, :Plot# = :Plot# ),
Drop multiples( 0, 0 ),
Include Nonmatches( 1, 1 ),
Preserve main table order( 0 ),
Output Table( "All Together" )
);
dtTogether << New Column( "Calculated Yield",
formula(
rowNum = Row() - 1;
cumSum = :Yield;
If( Is Missing( :Yield ) == 0,
While( :Match Flag[rowNum] == 2,
cumSum = cumSum + :Yield[rowNum];
rowNum--;
)
);
cumSum;
)
);
// Make formula columns static values
dtTogether:Calculated Yield << delete formula;
// Delete rows that only came from the With Data Table
dtTogether << select where( :Match Flag == 2 ) << delete rows;
// Delete the Match Flag column
dtTogether << delete columns("Match Flag");