R script - least squares solution to the following [duplicate]

本小妞迷上赌 提交于 2020-01-04 13:23:21

问题


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:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!