-2

パッケージでデミング回帰を使用して回帰パラメータを計算しましたmcreg

dem.reg <- mcreg(x, y, method.reg="Deming")
printSummary(dem.reg)

推定値の標準誤差を計算する方法を知っている人はいますか?

4

1 に答える 1

-1

パッケージの説明によるとmcr、標準エラーは直接利用できないようです。そのような場合、ここここで説明されている原則に従って、特定の関数を再計算して書き直す必要があります。

mcreg関数の説明で例を挙げると、次のようになります。

# requirements
library("mcr")
data(creatinine,package="mcr")
x <- creatinine$serum.crea
y <- creatinine$plasma.crea

# Deming regression fit.
# The confidence intercals for regression coefficients
# are calculated with analytical method
model1<- mcreg(x,y,error.ratio=1,method.reg="Deming", method.ci="analytical",
               mref.name = "serum.crea", mtest.name = "plasma.crea", na.rm=TRUE)

# Results
printSummary(model1)
getCoefficients(model1)
plot(model1)

これにより、次の出力と図が得られます。

# ------------------------------------------
#   
#   Reference method: serum.crea
# Test method:     plasma.crea
# Number of data points: 108
# 
# ------------------------------------------
#   
#   The confidence intervals are calculated with analytical method.
# Confidence level: 95%
# Error ratio: 1
# 
# ------------------------------------------
#   
#   DEMING REGRESSION FIT:
#   
#   EST         SE        LCI        UCI
# Intercept -0.05891341 0.04604315 -0.1501984 0.03237162
# Slope      1.05453934 0.03534361  0.9844672 1.12461148
# NULL

デミング回帰の結果

グラフィックに書かれているように、切片と勾配があり、standard.errorたとえば次のように計算をコーディングするだけです。

f.reg <- function(x){
  y <- x * 1.05453934 - 0.05891341 
  return(y)
}
y.hat <- f.reg(x)
n.items <- length(y.hat)
# please note that y has 'NA' values so you have to filter them 
standard.error <- sqrt(sum((y[ !is.na(y)]-y.hat[ !is.na(y)])^2)/n.items)
# > standard.error
# [1] 0.1566329
于 2016-01-26T14:03:16.683 に答える