如何使该区域在曲线下或R中不可或缺
我有一个曲线作为下面的数据,我想计算x和y点所做的曲线曲线(积分)下的区域。以下方式做正确吗?我如何在特定间隔内计算曲线下的区域,而不知道曲线的功能? 我将使用重复测量的每个人使用其余数据重复此操作。另外,我需要计算曲线下的面积和第二个导数值。我应该这样做吗? 谢谢您的建议。
structure(list(x = c("76.37", "76.89", "77.36", "77.86", "78.86",
"79.37", "79.87", "80.36", "80.5", "81.2"),
y = c("2.1", "2.29", "2.47", "2.65", "2.82", "2.99", "3.16", "3.31", "3.46", "3.5")),
class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,-10L))
library(pracma)
AUC = trapz(data$x,data$y)
I have a curve as the data below and I would like to calculate the area under the curve (integral) of this curve made by x and y points. Is it correct to do in the way below? and how can I calculate the area under the curve within a specific interval without knowing the function of curve?
I am going to repeat this with the rest of my data for each individual with repeated measurements. Also, I need to calculate the area under the curve for the first and second derivative values. should I do the same?
Thank you for your advice.
structure(list(x = c("76.37", "76.89", "77.36", "77.86", "78.86",
"79.37", "79.87", "80.36", "80.5", "81.2"),
y = c("2.1", "2.29", "2.47", "2.65", "2.82", "2.99", "3.16", "3.31", "3.46", "3.5")),
class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,-10L))
library(pracma)
AUC = trapz(data$x,data$y)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用线性插值来近似
actoffun
,请注意,该区域的粗略近似可产生接近此数的数字。假设该区域是梯形。
You could approximate the function thus use
approxfun
with a linear interpolationNote that a rough approximation of the area yields a number closer to this. This assumes the region is trapezoidal.