Skip to content
Back to formatted view

Raw Message

Message-ID: <49C90769.2090806@biostat.ku.dk>
Date: 2009-03-24T16:16:41Z
From: Peter Dalgaard
Subject: confidence interval or error of x intercept of a linear
In-Reply-To: <XFMail.090324100434.Ted.Harding@manchester.ac.uk>

(Ted Harding) wrote:
> On 24-Mar-09 03:31:32, Kevin J Emerson wrote:
...
> When I have time for it (not today) I'll see if I can implement
> this neatly in R. It's basically a question of solving
> 
>   (N-2)*(1 - R(X0))/R(X0) = qf(P,1,(N-1))
> 
> for X0 (two solutions, maybe one, if any exist). 
<etc.>

A quick and probably not-too-dirty way is to rewrite it as a nonlinear
model:

x <- 1:10
Y <- 2*x - 3 + rnorm(10, sd=.1)
cf <- coef(lm(Y~x))
confint(nls(Y~beta*(x-x0), start=c(beta=cf[[2]],x0=-cf[[1]]/cf[[2]])))




-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907