Sorry for my delay..
If you do not know the breakpoint, I would suggest to estimate it..
Have a look to the segmented package. The relevant code here is
attach(d)
m0<-lm(percent~ year , weights=1/se)
library(segmented)
mseg<-segmented(m0,seg.Z=~year,psi=1995)
points(year, fitted(mseg))
Hope th
On 8/03/2009, at 3:54 AM, David Freedman wrote:
Hi - I'd like to construct and plot the percents by year in a small
data set
(d) that has values between 1988 and 2007. I'd like to have a
breakpoint
(buy no discontinuity) at 1996. Is there a better way to do this
than in
the code below
It actually looked reasonably economical but the output certainly is
ugly. I see a variety of approaches in the r-help archives. This
thread discusses two other approaches, degree-one splines from Berry
and hard coded-coefficients from Lumley:
http://finzi.psych.upenn.edu/R/Rhelp08/archive/
Hi,
Let me pick up this old thread. How does one extract the locations of the knots
(ends of the segments) from the fit object below?
Thanks,
Vadim
>From : roger koenker < roger_at_ysidro.econ.uiuc.edu >
Date : Tue 31 May 2005 - 10:23:19 EST
It is conventional to fit piecewise linear
4 matches
Mail list logo