私は1985年から1996年までのデータセットを持っていて、およそ16の異なる都市で毎年減少しています。すべての都市に完全なデータセットがあるわけではありません。私は各都市の年ごとの違いの平均を見つける必要があります。データは月別にリストされていますが、数字は実際には先月以降にのみ変化します。約2000行分のデータに穴が開いています。穴がなければ大丈夫だろうが、私は困惑している。誰かが私を正しい方向に向けることができますか?
解決策は非常に簡単です...年/場所ごとに1行にデータを単純化し、それから簡単な式で新しい列を追加して、それから表形式のレポートを生成するだけです。 以下はタスクを実行するスクリプトです。 このスクリプトは、対話的に必要なタスクを実行してから、ソリューションの各ステップに必要なスクリプトをJMPに生成させることによって生成されました。
Names Default To Here( 1 );
// Create a handle pointing to the raw data table
dt = Current Data Table();
// Since all of the values for each year are the same,
// summarize the data by year and location to get just one
// row per year/location.......Min, Max, Mean, Median could
// all be used for the statistic, since they would yield
// the same results, with all of the data being the same
dt2 = dt << Summary(
Group(
:Name( "Site of ARB_metals 2 final 2 By (Site, yr)" ),
:Name( "yr of ARB_metals 2 final 2 By (Site, yr)" )
),
Max( :Name( "Mean(log(Pb))" ) ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" )
);
// Add a new column, calculating the difference
dt2 << New Column( "Difference",
formula(
If(
Row() == 1 | Lag( :Name( "Site of ARB_metals 2 final 2 By (Site, yr)" ) ) !=
:Name( "Site of ARB_metals 2 final 2 By (Site, yr)" ),
.,
Lag( :Name( "Mean(log(Pb))" ) ) - :Name( "Mean(log(Pb))" )
)
)
);
// Run the Tabulate Platform to generated the desired table
dt2 << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table( Analysis Columns( :Difference ), Statistics( Mean ) ),
Row Table(
Grouping Columns(
:Name( "Site of ARB_metals 2 final 2 By (Site, yr)" )
)
)
)
);
JMPを習得するためのよい方法として、「Using JMP」という文書を読むことをお勧めします。
ヘルプ==>本==> JMPを使う
列Bの年が変わるたびに、前の値から列Dの新しい値を減算し、それから各場所の平均を計算させます。
私はデータテーブルが実際にどのように見えるかについて漠然とした考えしか持っていません.....あなたはデータテーブルを添付することができますか、それともデータテーブルのサブセットですか?それは本当に解決策を考え出すのに役立ちます。