在 R 中积分非参数曲线

发布于 2024-12-10 21:33:33 字数 546 浏览 0 评论 0原文

只是警告,我一天前开始使用 R...如果有任何事情看起来非常简单,我深表歉意。

现在,我正在尝试让 R 接收包含撞击加速度计数据的 .txt 文件,并为其计算头部受伤标准测试。 HIC 测试要求将数据曲线按一定间隔进行积分。

该方程位于下面的链接...我尝试将其作为图像插入此处,但它不允许我这样做。显然我需要一些声誉点才能让我这样做。

equation

a(t) 是加速度曲线。

到目前为止,我在 R 中生成合适的曲线来匹配数据还没有遇到问题。 loess 函数运行得很好,这正是我一直在寻找的东西......我只是不知道如何集成它。据我所知,黄土是非参数回归,因此无法确定曲线的方程。有没有办法整合它?

如果没有,是否有另一种方法可以使用不同的函数来完成此任务?

任何帮助或有见地的评论将非常感激。

提前致谢,

韦斯

詹姆斯还有一个问题,在使用Integrate()函数时,我怎样才能得到没有文本和错误的数字?

Just a warning, I started using R a day ago...my apologies if anything seems idiotically simple.

Right now im trying to have R take in a .txt file with acelerometer data of an impact and calculate a Head injury criterion test for it. The HIC test requires that curve from the data be integrated on a certain interval.

The equation is at the link below...i tried to insert it here as an image but it would not let me. Apparently i need some reputation points before it'll let me do that.

equation

a(t) is the aceleration curve.

So far i have not had an issue generating a suitable curve in R to match the data. The loess function worked quite well, and is exactly the kind of thing i was looking for...i just have no idea how to integrate it. As far as i can tell, loess is a non-parametric regression so there is no way to determine the equation of the curve iteslf. Is there a way to integrate it though?

If not, is there another way to acomplish this task using a different function?

Any help or insighful comments would be very much appreciated.

Thanks in advance,

Wes

One more question though James, how can i just get the number without the text and error when using the integrate() function?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半暖夏伤 2024-12-17 21:33:33

您可以在 loess 模型上使用 predict 函数来创建与 integrate 一起使用的函数。

# using the inbuilt dataset "pressure"
plot(pressure,type="l")

# create loess object and prediction function
l <- loess(pressure~temperature,pressure)
f <- function(x) predict(l,newdata=x)

# perform integration
integrate(f,0,360)
40176.5 with absolute error < 4.6

并单独提取值:

integrate(f,0,360)$value
[1] 40176.5

You can use the predict function on your loess model to create a function to use with integrate.

# using the inbuilt dataset "pressure"
plot(pressure,type="l")

# create loess object and prediction function
l <- loess(pressure~temperature,pressure)
f <- function(x) predict(l,newdata=x)

# perform integration
integrate(f,0,360)
40176.5 with absolute error < 4.6

And to extract the value alone:

integrate(f,0,360)$value
[1] 40176.5
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文