Re: [R] Fitting multiple horizontal lines to data

2013-11-07 Thread Carl Witthoft
You already asked this on StackOverflow. The answer remains the same, pretty much what David W. wrote: this is not a question about fitting lines to data. You need to step back and think about what message you want to deliver to those who will view your graph, and what the meaning of your data

Re: [R] Fitting multiple horizontal lines to data

2013-11-06 Thread MacQueen, Don
Possibly see the strucchange package -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 11/6/13 9:19 AM, "Sashikanth Chandrasekaran" wrote: >I am not trying to fit a horizontal line at every unique value of y. I am >trying f

Re: [R] Fitting multiple horizontal lines to data

2013-11-06 Thread David Winsemius
On Nov 6, 2013, at 9:19 AM, Sashikanth Chandrasekaran wrote: > I am not trying to fit a horizontal line at every unique value of y. I am > trying fit the y values with as few horizontal lines by trading off the > number of horizontal lines with the error. The actual problem I am trying > to solve

Re: [R] Fitting multiple horizontal lines to data

2013-11-06 Thread David Carlson
] On Behalf Of Sashikanth Chandrasekaran Sent: Wednesday, November 6, 2013 11:20 AM To: r-help@r-project.org Subject: [R] Fitting multiple horizontal lines to data I am not trying to fit a horizontal line at every unique value of y. I am trying fit the y values with as few horizontal lines by trading

[R] Fitting multiple horizontal lines to data

2013-11-06 Thread Sashikanth Chandrasekaran
I am not trying to fit a horizontal line at every unique value of y. I am trying fit the y values with as few horizontal lines by trading off the number of horizontal lines with the error. The actual problem I am trying to solve is to smooth data in a time series. Here is a realistic example of y

Re: [R] Fitting multiple horizontal lines to data

2013-10-30 Thread Carl Witthoft
Your question doesn't make much sense if you really believe that the best fit is to draw a horizontal line at every unique value of y. What is the actual problem you are trying to solve? Clearly it's not a matter of linear fits, so forget about using "lm" or other regression tools. -- View

[R] Fitting multiple horizontal lines to data

2013-10-29 Thread Sashikanth Chandrasekaran
Dear R-users, I am trying to fit my data using one or more horizontal lines. If my data is in "y", I understand that "lm(y~1)" will fit a single horizontal line at mean(y). However, I want to try and fit the data with multiple horizontal lines if that reduces the error while still keeping the numbe