我有一個1985 - 1996年的數據集,顯示了大約16個不同城市的年度減少量。並非所有城市都有完整的數據集。我必須找到每個城市年度差異的平均值。數據按月列出,但數字僅在上個月後實際發生變化。大約2000行數據中都有漏洞。如果沒有洞我會好的,但我很難過。任何人都可以引導我朝著正確的方向前進嗎?
解決方案非常簡單......只需將數據簡化為每年/每行一行,然後使用簡單的公式添加新列,然後生成表格報告。 下面是一個執行任務的腳本。 通過以交互方式執行所需任務,然後讓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”作為開始學習JMP的好方法
幫助==>書籍==>使用JMP
我試圖在每次B列中的年份更改時從前一個值中減去D列中的新值,然後計算每個位置的平均值
我對數據表的實際情況只有一個模糊的概念.....你可以附加數據表,還是附加數據表的子集?這確實有助於找出解決方案。