Deming Regression: Methcomp Package May 2007
Deming Regression: Methcomp Package May 2007
MethComp package
May 2007
2 Deming regression 1
4 Solving for ξi 2
5 Solving for α 2
6 Solving for β 3
8 Solving for σ 2 6
9 Summing up 7
1 Introduction
This document is related to the Deming function in the package MethComp and contains the
derivation of the maximum likelihood estimates related to the Deming regression model. It
is based on the book ’Models in regression and related topics’ (chapter three), from 1969
by Peter Sprent, but with more detailed calculations included.
2 Deming regression
The mathematical model η = α + βξ describes a linear relationship between two variables ξ
and η. Observations x and y of two variables are usually desribed by a regression of y on x
where x is assumed to be observed without error (or, equivantly using the conditional
distribution of y given x). In linear regression with observations subject to additive
random variation on both x and y and observed values for individuals (xi , yi ), i = 1, . . . , n,
a model may be written
xi = ξi + exi ,
where exi and eyi denotes the random part of the model. This is known as a functional
relationship because the ξi ’s are assumed to be fixed parameters, as oppposed to a
structural relationship where some distribution for the ξi ’s is assumed. In the following it is
assumed that the exi s are iid with eyi ∼ N (0, σ 2 ), and that the eyi s are iid with
eyi ∼ N (0, λσ 2 ), for some λ > 0. Furthermore exi is assumed to be independent of eyi .
The aim of this document is to derive the maximum likelihood estimates for α, β, ξi and
2
σ in the functional model stated above.
4 Solving for ξi
Differentiation of L with respect to ξi gives
Pn 2
Pn 2
∂L ∂ i=1 (xi − ξi ) i=1 (yi − α − βξi )
= − −
∂ξi ∂ξi 2σ 2 2λσ 2
∂L
Setting ∂ξi
equal to zero yields
So to estimate ξi , estimates for β and α are needed. Therefore focus is turned to the
derivation of α̂.
5 Solving for α
Differentiation of L with respect to α gives
Pn 2
∂L ∂ i=1 (yi − α − βξi )
= −
∂α ∂α 2λσ 2
Pn
i=1 (yi− α − βξi )
= ,
λσ 2
∂L
and putting ∂α
equal to zero yields
n
∂L 1X
=0 ⇒ α= (yi − βξi ).
∂α n i=1
Deming regression 3
n
1X λxi + β(yi − α)
= yi − β
n i=1 λ + β2
n
β 2α
1X λxi + βyi
= yi − β +
n i=1 λ + β2 λ + β2
m
n
β2
1X λxi + βyi
α 1− = yi − β
λ + β2 n i=1 λ + β2
n
β2
1X βλ
= yi 1 − − xi
n i=1 λ + β2 λ + β2
m
n
βλ λ + β 2
1X
α = y i − xi
n i=1 λ + β2 λ
n
1X
= (yi − xi β)
n i=1
= y − xβ.
Hence the estimate for α becomes
α̂ = y − xβ̂.
6 Solving for β
Differentiation of L with respect to β gives
Pn 2
Pn
∂L ∂ (yi − α − βξ i ) (yi − α − βξi )ξi
= − i=1 2
= i=1 .
∂β ∂β 2λσ λσ 2
∂L
Setting ∂β
equal to zero yields
n
∂L X
=0⇔ (yi − α − βξi )ξi = 0,
∂β i=1
4 6 Solving for β
n
X λxi + β(yi − α) λxi + β(yi − α)
= yi − α − β .
i=1
λ + β2 λ + β2
n
X
= λ2 xi (yi − α) + β 2 λxi (yi − α) − βλ2 x2i − β 2 λxi (yi − α) +
i=1
n
X
βλ(yi − α)2 + β 3 λ(yi − α)2 − β 2 λxi (yi − α) − β 3 (yi − α)2
i=1
n
X n
X n
X
2 2
= −β λ xi yi − βλ x2i +λ 2
xi y i
i=1 i=1 i=1
n
X n
X n
X
+β 2 λα xi + βλ (yi − α)2 − λ2 α xi .
i=1 i=1 i=1
Dividing with λ and using the fact that α = y. − x.β it is seen that
n
X n
X n
X n
X
0 = −β 2 xi yi − βλ x2i + λ xi yi + β 2 (y. − x.β) xi
i=1 i=1 i=1 i=1
n
X n
2 X
+β yi − (y. − x.β) − λ(y. − x.β) xi
i=1 i=1
n
X n
X n
X n
X
= −β 2 xi yi − βλ x2i + λ xi yi + β 2 y. xi
i=1 i=1 i=1 i=1
n
X n
X n
X
3
−β x.β xi + β yi2 +β (y. − x.β)2
i=1 i=1 i=1
n
X n
X n
X
−2β yi (y. − x.β) − λy. xi + λx.β xi .
i=1 i=1 i=1
Deming regression 5
n
X n
X n
X n
X n
X
+β yi2 + β y.2 + β (x.β)2 − 2β y.x.β − 2β yi y.
i=1 i=1 i=1 i=1 i=1
n
X n
X n
X
+2β yi x.β − λy. xi + λx.β xi .
i=1 i=1 i=1
n n n n
!
X X X X
+β 2 y. xi − xi yi − 2 y.x. + 2 yi x.
i=1 i=1 i=1 i=1
n n n n n
!
X X X X X
+β yi2 − λ x2i + y.2 − 2 yi y. + λx. xi
i=1 i=1 i=1 i=1 i=1
n n
!
X X
+λ xi yi − y. xi .
i=1 i=1
Since
Pn
x.2 − x. ni=1 xi = 0
P
• i=1
q
Since SSDy − λSSDx ≤ (SSDy − λSSDx )2 + 4λSPD2xy there is always a positive and a
negative solution to (2). The desired solution should always have the same sign as SPDxy ,
hence the solution with the positive numerator is selected. Therefore
q
SSDy − λSSDx + (SSDy − λSSDx )2 + 4λSPD2xy
β̂ = .
2SPDxy
8 Solving for σ 2
Differentiation of L with respect to σ 2 gives
Pn Pn
− xii )2 − α − βξi )2
∂L ∂ n i=1 (xi i=1 (yi
2
= − log(λσ 4 ) − −
∂σ ∂σ 2 2 2σ 2 2λσ 2
Pn 2
Pn 2
−nσ 2 i=1 (x i − xi i ) i=1 (yi − α − βξi )
= + +
σ4 2σ 4 2λσ 4
n n
∂L 2
X
2
X
= 0 ⇒ −2λnσ + λ (x i − xi i ) + (yi − α − βξi )2 = 0
∂σ 2 i=1 i=1
Pn
− ξi )2 + ni=1 (yi − α − βξi )2
P
2 λ i=1 (xi
⇒ σ = .
2λn
To get a central estimate of σ 2 one must divide by n − 2 instead of 2n since there are n + 2
parameters to be estimated, namely ξ1 , ξ2 , . . . , ξn , α and β. Hence the degrees of freedom
are 2n − (n + 2) = n − 2. Therefore
9 Summing up
α̂ = y − xβ̂
q
SSDy − λSSDx + (SSDy − λSSDx )2 + 4λSPD2xy
β̂ =
2SPDxy
s P
λ ni=1 (xi − ξˆi )2 + ni=1 (yi − α̂ − β̂ ξˆi )2
P
σ̂ =
2λ(n − 2)
λxi + β̂(yi − α̂)
ξˆi =
λ + β̂ 2
These formula are implemented in the Deming function in the MethComp package.
8 10 The Deming function