我在農業領域進行研究,我像大多數人一樣使用 excel 來組織我的數據。 然而,常見的分析是病害進展曲線下面積 (AUDPC) 來跟踪病害在整個生長季節的變化。 有沒有辦法在不擬合趨勢線/回歸分析的情況下計算折線圖下的總面積。
你好,
您可以實現這一點的唯一方法是計算由您的數據點和圖形的底定義的多邊形區域。
area = Polygon Area( {0, 0}, {0, 10}, {10, 10}, {10, 0} );
注意:1) 您可以在公式中使用此函數。 2) 如上面的簡單示例所示,包含多邊形的原點至關重要。
最好的事物,
TS
蒂埃里,
感謝您的答复。 我假設您發布的公式將應用於 Excel 軟件? 或者是否有在 JMP 軟件中使用它的方法?
最好的,
發布的公式適用於 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。 請注意,這給出了由數據值定義的多邊形“下方”的區域。 您可能想要也可能不想要某種擬合曲線下的面積,但這也是可能的。