Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.43.0903240115150.11646@hymn11.u.washington.edu>
Date: 2009-03-24T08:15:15Z
From: Thomas Lumley
Subject: confidence interval or error of x intercept of a linear regression
In-Reply-To: <1237865492.586760.alphamail@mailapps1.uoregon.edu>

On Mon, 23 Mar 2009, Kevin J Emerson wrote:


> Now, it is simple enough to calculate the x-intercept itself ( - intercept / 
> slope ), but it is a whole separate process to generate the confidence 
> interval of it.  I can't figure out how to propagate the error of the slope 
> and intercept into the ratio of the two.  The option option I have tried to 
> figure out is to use the predict function to look for where the confidence 
> intervals cross the axis but this hasn't been too fruitful either.
> 


A few people have written code to do nonlinear transformations automatically. 
There's one in my 'survey' package, and I think there's an example in Venables 
& Ripley's "S Programming", and I'm sure there are others.

For example
> library(survey)
> m<-lm(Dev.Rate~Temperature, data=t)
> svycontrast(m, quote(-`(Intercept)`/Temperature))
          nlcon     SE
contrast 3.8061  0.1975

The `backquotes` are necessary because the coefficient name, (Intercept), isn't a legal variable name.

The svycontrast() function works on anything that has coef() and vcov() methods. The actual delta-method computations are in survey:::nlcon

        -thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle