我在農業領域進行研究,並且像大多數人一樣使用 excel 來組織我的數據。 然而,一種常見的分析是疾病進展曲線下面積 (AUDPC),以跟踪整個生長季節疾病的變化。 有什麼方法可以在不擬合趨勢線/回歸分析的情況下計算折線圖下的總面積。
發布的公式適用於 JMP 而不是 Excel。 以來自的答復為基礎@Thierry_S您可以在 JSL(JMP 的腳本語言)中執行此類操作:
NamesDefaultToHere(1);
// Some simple data
dt =
New Table( "AUDPC Example",
Add Rows( 4 ),
New Column( "x", Numeric, "Continuous", Set Values( [0, 1, 2, 3] )),
New Column( "y", Numeric, "Continuous", Set Values( [3, 4, 4.5, 5] ))
);
// A graph
gb = dt << Graph Builder(
Size( 526, 454 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :x ), Y( :y ) ),
Elements( Line( X, Y, Legend( 5 ) ) ),
SendToReport(
Dispatch(
{},
"x",
ScaleBox,
{Min( -1 ), Max( 4 ), Inc( 0.5 ), Minor Ticks( 0 ),
Add Ref Line( 0, "Dashed", "Red", "", 1 ),
Add Ref Line( 3, "Dashed", "Red", "", 1 )}
),
Dispatch(
{},
"y",
ScaleBox,
{Format( "Best", 12 ), Min( -1 ), Max( 6 ), Inc( 1 ), Minor Ticks( 1 ),
Add Ref Line( 0, "Dashed", "Red", "", 1 ),
Add Ref Line( 1, "Dashed", "Red", "", 1 )}
)
)
);
// Start here . . .
dt = CurrentDataTable();
// Get the x and y values
xVals = Column(dt, "x") << getValues;
yVals = Column(dt, "y") << getValues;
// Insert two points that define the base of the polygon at the value y = 0
baseLine = [0];
xVals2 = VConcat(xVals[1], xVals, xVals[NRow(xVals)]);
yVals2 = VConcat(baseLine, yVals, baseline);
// Get the area
a2 = PolygonArea(xVals2, yVals2);
Print(a2);
// Insert two points that define the base of the polygon at the value y = 1
baseLine = [1];
xVals3 = VConcat(xVals[1], xVals, xVals[NRow(xVals)]);
yVals3 = VConcat(baseLine, yVals, baseline);
// Get the area
a3 = PolygonArea(xVals3, yVals3);
Print(a3);
執行“文件 > 新建 > 新建腳本”,將上面的代碼剪切並粘貼到出現的窗口中,然後執行“編輯 > 運行腳本”。 我知道您可能不想學習 JSL。 請注意,這給出了由數據值定義的多邊形“下方”的區域。 您可能想要也可能不想要某種擬合曲線下的區域,但這也是可能的。
蒂埃里,
感謝您的答复。 我假設您發布的公式將應用於 Excel 軟件? 或者是否有在 JMP 軟件中使用它的方法?
最好的,
你好,
實現此目的的唯一方法是計算由數據點定義的多邊形面積和圖形的底部。
area = Polygon Area( {0, 0}, {0, 10}, {10, 10}, {10, 0} );
注意:1) 您可以在公式中使用此函數。 2) 如上面的簡單示例所示,包括多邊形的原點至關重要。
最好的,
TS