R脚本-最小二乘解决方案 [英] R script - least squares solution to the following

查看:62
本文介绍了R脚本-最小二乘解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
查找两个线性拟合在R中相交的地方

考虑到图表上的一些点(通常只有6或7个点),我需要找到一个最合适的解决方案,其中的解决方案包括以下内容:

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. 两条直线
  2. 线必须相交
  3. 交点(x点)必须位于我指定的两个值(例如xLow和xHigh)之间

我将如何使用nls(或更好的东西)来做到这一点?

How would I do this using nls (or something better?)?

如果有多个最佳拟合,那么任何一个都可以.基本上,这两行形成一个V.

If there are multiple best fits, then any of them are fine. Basically, the two lines form a V.

推荐答案

通常,如果您先对x进行y拟合,然后对y进行x拟合,则线将以其联合平均值穿过数据,并且它们最小二乘均适合,尽管适用于不同的数据情况.

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.

这篇关于R脚本-最小二乘解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆