首页 文章

{Methcomp} - 戴明/正交回归 - 拟合置信区间的好

提问于
浏览
2

以下问题this post . 我有以下数据:

  • x1,疾病症状

  • y1,另一种疾病症状

我使用Deming回归拟合x1 / y1数据,其中vr(或sdr)选项设置为1.换句话说,回归是总最小二乘回归,即正交回归 . 请参阅图表的上一篇文章 .

x1=c(24.0,23.9,23.6,21.6,21.0,20.8,22.4,22.6,
 21.6,21.2,19.0,19.4,21.1,21.5,21.5,20.1,20.1,
 20.1,17.2,18.6,21.5,18.2,23.2,20.4,19.2,22.4,
 18.8,17.9,19.1,17.9,19.6,18.1,17.6,17.4,17.5,
 17.5,25.2,24.4,25.6,24.3,24.6,24.3,29.4,29.4,
 29.1,28.5,27.2,27.9,31.5,31.5,31.5,27.8,31.2,
 27.4,28.8,27.9,27.6,26.9,28.0,28.0,33.0,32.0,
 34.2,34.0,32.6,30.8)

y1=c(100.0,95.5,93.5,100.0,98.5,99.5,34.8,
 45.8,47.5,17.4,42.6,63.0,6.9,12.1,30.5,
 10.5,14.3,41.1, 2.2,20.0,9.8,3.5,0.5,3.5,5.7,
 3.1,19.2,6.4, 1.2, 4.5, 5.7, 3.1,19.2, 6.4,
 1.2,4.5,81.5,70.5,91.5,75.0,59.5,73.3,66.5,
 47.0,60.5,47.5,33.0,62.5,87.0,86.0,77.0,
 86.0,83.0,78.5,83.0,83.5,73.0,69.5,82.5,78.5,
 84.0,93.5,83.5,96.5,96.0,97.5)   

x11()
plot(x1,y1,xlim=c(0,35),ylim=c(0,100))
library(MethComp)
dem_reg <- Deming(x1, y1)
abline(dem_reg[1:2], col = "green")

我想知道x1有多少有助于预测y1:

  • 通常情况下,我会选择R平方,但它似乎不是to be relevant;虽然另一位数学家告诉我他认为R平方可能是合适的 . 这个页面建议计算一个Pearson product-moment correlation coefficient,这是R我相信吗?

  • 部分相关,可能有tolerance interval . 我可以用R(包或帖子中显示的代码)来计算它,但它并不是我正在搜索的内容 .

有人知道如何使用R来计算Deming回归的拟合优度吗?我看了MetchComp pdf,但找不到它(虽然可能错过了) .

EDIT: following Gaurav's answers about confidence interval: R code

首先:参数的置信区间

library(mcr)
MCR_reg=mcreg(x1,y1,method.reg="Deming",error.ratio=1,method.ci="analytical")
getCoefficients(MCR_reg)

其次:预测值的置信区间

# plot of data
x11()
plot(x1,y1,xlim=c(0,35),ylim=c(0,100))

# Deming regression using functions from {mcr}
library(mcr)     MCR_reg=mcreg(x1,y1,method.reg="Deming",error.ratio=1,method.ci="analytical")
MCR_intercept=getCoefficients(MCR_reg)[1,1]
MCR_slope=getCoefficients(MCR_reg)[2,1]

# CI for predicted values
x_to_predict=seq(0,35)
predicted_values=MCResultAnalytical.calcResponse(MCR_reg,x_to_predict,alpha=0.05)
CI_low=predicted_values[,4]
CI_up=predicted_values[,5]

# plot regression line and CI for predicted values
abline(MCR_intercept,MCR_slope, col="red")
lines(x_to_predict,CI_low,col="royalblue",lty="dashed")
lines(x_to_predict,CI_up,col="royalblue",lty="dashed")

# comments
text(7.5,60, "Deming regression", col="red")
text(7.5,40, "Confidence Interval for", col="royalblue")
text(7.5,35, "Predicted values - 95%", col="royalblue")

EDIT 2 主题移至Cross Validated:https://stats.stackexchange.com/questions/167907/deming-orthogonal-regression-measuring-goodness-of-fit

1 回答

  • 2

    有许多提出的方法来计算Deming回归的拟合度和公差间隔,但没有一种被广泛接受 . 我们用于OLS回归的传统方法可能没有意义 . 这是一个积极研究的领域 . 我不认为有很多R包可以帮助你计算,因为没有多少数学家同意任何特定的方法 . 大多数计算间隔的方法都基于重采样技术 .

    但是你可以查看'mcr'包的间隔... https://cran.r-project.org/web/packages/mcr/

相关问题