If you want to minimize absolute error for this, then you can
try the rqss fitting in the quantreg package and tune lambda
to get one break in the fitted function.


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    [EMAIL PROTECTED]            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820


On Aug 29, 2007, at 8:05 PM, Achim Zeileis wrote:

> On Wed, 29 Aug 2007, Naxerova, Kamila wrote:
>
>> Dear list,
>>
>> I have a series of data points which I want to approximate with  
>> exactly two
>> linear functions. I would like to choose the intervals so that the  
>> total
>> deviation from my fitted lines is minimal. How do I best do this?
>
>> From the information you give it seems that you want to partition  
>> a model
> like
>    lm(y ~ x)
> along a certain ordering of the observations. Without any further
> restrictions you can do that with the function breakpoints() in  
> package
> "strucchange". If there are continuity restrictions or something like
> that, you want to look at the "segmented" package.
>
> hth,
> Z
>
>> Thanks!
>> Kamila
>>
>>
>> The information transmitted in this electronic communication... 
>> {{dropped}}
>>
>> ______________________________________________
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting- 
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting- 
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to