问题
Possible Duplicate:
Finding where two linear fits intersect in R
Given some points on a graph (usually only about 6 or 7 points), I need to find a best fit solution where the solution consists of the following:
- Two linear lines
- The lines must intersect
- The intersection point (the x point) must lie between two values I specify (such as xLow and xHigh)
How would I do this using nls (or something better?)?
If there are multiple best fits, then any of them are fine. Basically, the two lines form a V.
回答1:
Generally if you first do a fit of y on x and then x on y the lines will cross within the data at their joint means and they are both least squares fits, albeit to different data situations.
来源:https://stackoverflow.com/questions/7123526/r-script-least-squares-solution-to-the-following