我在农业领域进行研究,我像大多数人一样使用 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。 请注意,这给出了由数据值定义的多边形“下方”的区域。 您可能想要也可能不想要某种拟合曲线下的面积,但这也是可能的。