Deming regression. MethComp package May

Σχετικά έγγραφα
3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

ST5224: Advanced Statistical Theory II

Other Test Constructions: Likelihood Ratio & Bayes Tests

Areas and Lengths in Polar Coordinates

Statistical Inference I Locally most powerful tests

Areas and Lengths in Polar Coordinates

6.3 Forecasting ARMA processes

Section 8.3 Trigonometric Equations

2 Composition. Invertible Mappings

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

Matrices and Determinants

Second Order Partial Differential Equations

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Section 7.6 Double and Half Angle Formulas

HW 3 Solutions 1. a) I use the auto.arima R function to search over models using AIC and decide on an ARMA(3,1)

SOLUTIONS TO MATH38181 EXTREME VALUES AND FINANCIAL RISK EXAM

Bayesian statistics. DS GA 1002 Probability and Statistics for Data Science.

Solutions to Exercise Sheet 5

derivation of the Laplacian from rectangular to spherical coordinates

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

Math221: HW# 1 solutions

Homework 3 Solutions

EE512: Error Control Coding

The Simply Typed Lambda Calculus

Queensland University of Technology Transport Data Analysis and Modeling Methodologies

Introduction to the ML Estimation of ARMA processes

C.S. 430 Assignment 6, Sample Solutions

Homework 8 Model Solution Section

Approximation of distance between locations on earth given by latitude and longitude

5.4 The Poisson Distribution.

CRASH COURSE IN PRECALCULUS

k A = [k, k]( )[a 1, a 2 ] = [ka 1,ka 2 ] 4For the division of two intervals of confidence in R +

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

CHAPTER 48 APPLICATIONS OF MATRICES AND DETERMINANTS

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =?

Problem Set 3: Solutions

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Solution Series 9. i=1 x i and i=1 x i.

FORMULAS FOR STATISTICS 1

Finite Field Problems: Solutions

b. Use the parametrization from (a) to compute the area of S a as S a ds. Be sure to substitute for ds!

Exercises to Statistics of Material Fatigue No. 5

Differentiation exercise show differential equation

Exercises 10. Find a fundamental matrix of the given system of equations. Also find the fundamental matrix Φ(t) satisfying Φ(0) = I. 1.

6.1. Dirac Equation. Hamiltonian. Dirac Eq.

4.6 Autoregressive Moving Average Model ARMA(1,1)

Μηχανική Μάθηση Hypothesis Testing

Appendix to On the stability of a compressible axisymmetric rotating flow in a pipe. By Z. Rusak & J. H. Lee

9.09. # 1. Area inside the oval limaçon r = cos θ. To graph, start with θ = 0 so r = 6. Compute dr

1 String with massive end-points

( ) 2 and compare to M.

2. THEORY OF EQUATIONS. PREVIOUS EAMCET Bits.

Section 9.2 Polar Equations and Graphs

Uniform Convergence of Fourier Series Michael Taylor

Strain gauge and rosettes

(a,b) Let s review the general definitions of trig functions first. (See back cover of your book) sin θ = b/r cos θ = a/r tan θ = b/a, a 0

Concrete Mathematics Exercises from 30 September 2016

Quadratic Expressions

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

w o = R 1 p. (1) R = p =. = 1

6. MAXIMUM LIKELIHOOD ESTIMATION

forms This gives Remark 1. How to remember the above formulas: Substituting these into the equation we obtain with

Example Sheet 3 Solutions

F-TF Sum and Difference angle

Srednicki Chapter 55

Tridiagonal matrices. Gérard MEURANT. October, 2008

Every set of first-order formulas is equivalent to an independent set

Inverse trigonometric functions & General Solution of Trigonometric Equations

Congruence Classes of Invertible Matrices of Order 3 over F 2

Partial Differential Equations in Biology The boundary element method. March 26, 2013

An Inventory of Continuous Distributions

Homework for 1/27 Due 2/5

A Note on Intuitionistic Fuzzy. Equivalence Relation

Overview. Transition Semantics. Configurations and the transition relation. Executions and computation

Phys460.nb Solution for the t-dependent Schrodinger s equation How did we find the solution? (not required)

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

Solution to Review Problems for Midterm III

ECE 308 SIGNALS AND SYSTEMS FALL 2017 Answers to selected problems on prior years examinations

Math 6 SL Probability Distributions Practice Test Mark Scheme

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Instruction Execution Times

PARTIAL NOTES for 6.1 Trigonometric Identities

Partial Trace and Partial Transpose

Problem Set 9 Solutions. θ + 1. θ 2 + cotθ ( ) sinθ e iφ is an eigenfunction of the ˆ L 2 operator. / θ 2. φ 2. sin 2 θ φ 2. ( ) = e iφ. = e iφ cosθ.

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

SCITECH Volume 13, Issue 2 RESEARCH ORGANISATION Published online: March 29, 2018

Statistics 104: Quantitative Methods for Economics Formula and Theorem Review

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

Answer sheet: Third Midterm for Math 2339

Numerical Analysis FMN011

Pg The perimeter is P = 3x The area of a triangle is. where b is the base, h is the height. In our case b = x, then the area is

Reminders: linear functions

Durbin-Levinson recursive method

Mean-Variance Analysis

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

CHAPTER 101 FOURIER SERIES FOR PERIODIC FUNCTIONS OF PERIOD

Econ Spring 2004 Instructor: Prof. Kiefer Solution to Problem set # 5. γ (0)

DESIGN OF MACHINERY SOLUTION MANUAL h in h 4 0.

MATHEMATICS. 1. If A and B are square matrices of order 3 such that A = -1, B =3, then 3AB = 1) -9 2) -27 3) -81 4) 81

Transcript:

Deming regression MethComp package May 2007 Anders Christian Jensen Steno Diabetes Center, Gentofte, Denmark acjs@steno.dk

Contents 1 Introduction 1 2 Deming regression 1 3 The likelihood function 1 4 Solving for ξ i 2 5 Solving for α 2 6 Solving for β 3 7 Solving for ξ i - again 6 8 Solving for σ 2 6 9 Summing up 7 10 The Deming function 8

Deming regression 1 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 x i, y i, i = 1,..., n, a model may be written x i = ξ i + e xi, y i = η i + e yi = α + βξ i + e yi, where e xi and e yi 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 e xi s are iid with e yi N0, σ 2, and that the e yi s are iid with e yi N0, λσ 2, for some λ > 0. Furthermore e xi is assumed to be independent of e yi. The aim of this document is to derive the maximum likelihood estimates for α, β, ξ i and σ 2 in the functional model stated above. 3 The likelihood function The likelihood function f x1,x 2,...,x n,y 1,y 2,...,y n α, β, ξ 1, ξ 2,..., ξ n, σ 2 denoted f is f = n 2πσ 2 1 2 exp x i ξ i 2 2πλσ 2 1 2 exp y i α βξ i 2 2σ 2 and the loglikelihood, denoted L, is L = 1 2 log 2πσ 2 x i ξ i 2 1 2σ 2 2 log 2πλσ 2 y i α βξ i 2 = n 2 log 4π 2 n 2 log λσ 4 n x i ξ i 2 2σ 2 y i α βξ i 2. It follows that the likelihood function is not bounded from above when σ 2 goes to 0, so in the following it is assumed that σ 2 > 0.

2 4 Solving for ξ i 4 Solving for ξ i Differentiation of L with respect to ξ i gives = x i ξ i 2 ξ i ξ i 2σ 2 = x i ξ i σ 2 + βy i α βξ i λσ 2. y i α βξ i 2 Setting ξ i equal to zero yields ξ i = 0 ξ i = λσ2 x i + βσ 2 y i βασ 2 λσ 2 + β 2 σ 2 = λx i + βy i α λ + β 2. 1 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 α = y i α βξ i 2 α = y i α βξ i λσ 2, and putting α equal to zero yields α = 0 α = 1 n y i βξ i.

Deming regression 3 Now one can use 1 to dispense with ξ i α = 1 n = 1 n = 1 n y i βξ i y i β λx i + βy i α λ + β 2 y i β λx i + βy i + β2 α λ + β 2 λ + β 2 α 1 β2 λ + β 2 = 1 n = 1 n y i β λx i + βy i λ + β 2 y i 1 β2 βλ x λ + β 2 i λ + β 2 α = 1 n = 1 n βλ λ + β 2 y i x i λ + β 2 λ y i x i β = y xβ. Hence the estimate for α becomes ˆα = y x ˆβ. 6 Solving for β Differentiation of L with respect to β gives β = y i α βξ i 2 = β y i α βξ i ξ i λσ 2. Setting β equal to zero yields β = 0 y i α βξ i ξ i = 0,

4 6 Solving for β and using 1 0 = = y i α βξ i ξ i y i α β λx i + βy i α λxi + βy i α. λ + β 2 λ + β 2 This implies that 0 = = y i αλ + β 2 βλx i β 2 y i α λx i + βy i α λ 2 x i y i α + β 2 λx i y i α βλ 2 x 2 i β 2 λx i y i α + βλy i α 2 + β 3 λy i α 2 β 2 λx i y i α β 3 y i α 2 = β 2 λ x i y i βλ 2 x 2 i + λ 2 x i y i +β 2 λα x i + βλ y i α 2 λ 2 α x i. Dividing with λ and using the fact that α = y. x.β it is seen that 0 = β 2 x i y i βλ x 2 i + λ x i y i + β 2 y. x.β x i +β yi y. x.β 2 λy. x.β x i = β 2 x i y i βλ β 3 x.β x i + β x 2 i y 2 i + λ x i y i + β 2 y. x i + β y. x.β 2 2β y i y. x.β λy. x i + λx.β x i.

Deming regression 5 Splitting up the sums even more gives 0 = β 2 x i y i βλ +β y 2 i x 2 i + λ x i y i + β 2 y. x i β 3 x.β x i + β y. 2 + β x.β 2 2β y.x.β 2β +2β y i x.β λy. x i + λx.β x i. Finally the terms are sorted and collected according to powers of β: 0 = β 3 x. 2 x. x i Since +β 2 y. x i +β yi 2 λ x i y i 2 x 2 i + +λ x i y i y. x.2 x. x i = 0 y.x. + 2 y. 2 2 x i. y i x. y i y. + λx. y. x i x iy i 2 y.x. + 2 y ix. = SPD xy x i y2 i λ x2 i + y.2 2 y iy. + λx. x i = SSD y λssd x x iy i y. x i = SPD xy it is clear that the derivation of β comes down to solve For SPD xy 0 this implies that y i y. β 2 SPD xy + βssd y λssd x + λspd xy = 0. 2 β = SSD y λssd x ± SSD y λssd x 2 4SPD xy λspd xy 2SPD xy = SSD y λssd x ± SSD y λssd x 2 + 4λSPD 2 xy 2SPD xy.

6 7 Solving for ξ i - again Since SSD y λssd x SSD y λssd x 2 + 4λSPD 2 xy there is always a positive and a negative solution to 2. The desired solution should always have the same sign as SPD xy, hence the solution with the positive numerator is selected. Therefore ˆβ = SSD y λssd x + SSD y λssd x 2 + 4λSPD 2 xy 2SPD xy. 7 Solving for ξ i - again With estimates for β and α it is now possible to estimate ξ i using 1: ˆξ i = λx i + ˆβy i ˆα λ + ˆβ 2. 8 Solving for σ 2 Differentiation of L with respect to σ 2 gives and setting σ 2 = n σ 2 σ 2 2 logλσ4 x i xi i 2 2σ 2 = nσ2 + x i xi i 2 n + y i α βξ i 2 σ 4 2σ 4 2λσ 4 y i α βξ i 2 = 2λnσ2 + λ x i xi i 2 + y i α βξ i 2 2λσ 4, equal to zero yields σ 2 = 0 2λnσ2 + λ x i xi i 2 + y i α βξ i 2 = 0 σ 2 = λ x i ξ i 2 + y i α βξ i 2. 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 ˆσ 2 = λ x i ˆξ i 2 + y i ˆα ˆβ ˆξ i 2. 2λn 2

Deming regression 7 9 Summing up ˆα = y x ˆβ ˆβ = ˆσ = SSD y λssd x + SSD y λssd x 2 + 4λSPD 2 xy 2SPD xy λ x i ˆξ i 2 + y i ˆα ˆβ ˆξ i 2 2λn 2 ˆξ i = λx i + ˆβy i ˆα λ + ˆβ 2 These formula are implemented in the Deming function in the MethComp package.

8 10 The Deming function 10 The Deming function Deming <- function x, y, vr=sdr^2, sdr=sqrtvr, boot=false, keep.boot=false, alpha=0.05 { if missing vr & missing sdr var.ratio <- 1 else var.ratio <- vr vn <- c deparse substitute x, deparse substitute y pn <- c "Intercept", "Slope", paste "sigma", vn, sep="." alfa <- alpha dfr <- data.frame x=x, y=y dfr <- dfr[complete.casesdfr,] x <- dfr$x y <- dfr$y n <- nrow dfr SSDy <- var y *n-1 SSDx <- var x *n-1 SPDxy <- cov x, y *n-1 beta <- SSDy - var.ratio*ssdx + sqrt SSDy - var.ratio*ssdx ^2 + 4*var.ratio*SPDxy^2 / 2*SPDxy alpha <- mean y - mean x * beta ksi <- var.ratio*x + beta*y-alpha /var.ratio+beta^2 sigma.x <- var.ratio*sum x-ksi^2 + sum y-alpha-beta*ksi^2 / # The ML-estiamtes requires 2*n at this point bu we do not think we have that # many observations so we stick to n-2. Any corroboation from litterature? n-2*var.ratio sigma.y <- var.ratio*sigma.x sigma.x <- sqrt sigma.x sigma.y <- sqrt sigma.y if!boot { res <- c alpha, beta, sigma.x, sigma.y names res <- pn res else { if is.numeric boot N <- boot else N <- 1000 res <- matrix NA, N, 4 for i in 1:N { wh <- sample 1:n, n, replace=true res[i,] <- Deming x[wh], y[wh], vr=var.ratio, boot=false ests <- cbind calpha,beta,sigma.x, sigma.y, se <- sqrt diag cov res, t apply res, 2, quantile, probs=c0.5,alfa/2,1-alfa/2, na.rm=t colnames res <- rownames ests <- pn colnames ests <- c"estimate", "S.e.boot", colnamesests[3:5] ifkeep.boot { print ests invisible res else { cat vn[2], " = alpha + beta*", vn[1], "\n" ests