R script - least squares solution to the following

2019-07-16 11:58发布

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:

  1. Two linear lines
  2. The lines must intersect
  3. 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条回答
叼着烟拽天下
2楼-- · 2019-07-16 12:37

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.

查看更多
登录 后发表回答