使用MAPE函数的R错误,我该如何解决?

发布于 2025-02-06 22:35:20 字数 548 浏览 1 评论 0 原文

我建立了一个模型

model.5 <- lm(formula = rent ~ area + rooms + age + nationality + maritalstat + education + traveltime + region + center, data=mysample)

,现在我做了预测

sel <- is.na(mysample$rent)

predict(model.5, newdata=subset(mysample, sel), interval="pred")

newprediction <- predict(model.5, newdata=subset(mysample, sel), interval="prediction")

我想知道为什么我的Mape不起作用

MAPE(newprediction, mysample$rent)

有人可以帮助我吗?我会很高兴的。

一切顺利

I build a model

model.5 <- lm(formula = rent ~ area + rooms + age + nationality + maritalstat + education + traveltime + region + center, data=mysample)

and now I did the prediction

sel <- is.na(mysample$rent)

predict(model.5, newdata=subset(mysample, sel), interval="pred")

newprediction <- predict(model.5, newdata=subset(mysample, sel), interval="prediction")

I would like to know why my MAPE doesn't work

MAPE(newprediction, mysample$rent)

Can someone please help me? I would be very pleased.

All the best

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

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

发布评论

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

评论(1

花间憩 2025-02-13 22:35:20

我注意到MAPE函数后有一个空间(就在开放括号之前)。这可能会导致错误。

如果这无法解决您的问题,那么如果您可以分享您收到的错误消息,这将很有帮助。

I noticed that there is a space after the MAPE function (right before the opening parenthesis). That could cause an error.

If that doesnt solve your issue, it would help a lot if you could share the error message you get.

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