R函数搜索函数 [英] R function to search for a function

查看:261
本文介绍了R函数搜索函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新: 最初的问题是:是否存在使用在Matlab的"lsqnonlin"函数中实现的算法相同的R函数?但是,答案与在R中搜索功能更相关.我认为答案通常对R用户非常有帮助.因此,我编辑了标题,但在这里再次提出了原始问题:在R,如何进行涉及求解微分方程的非线性最小二乘优化?

Update: The original question is: Is there an R function using the same algorithm implemented in the "lsqnonlin" function in matlab? However, the answer is more related to searching a function in R. I think the answer is in general very helpful for R users. So I edited the title but asked the original question again here: In R, how to do nonlinear least square optimization which involves solving differential equations?

我正在进行非线性最小二乘优化,发现matlab函数lsqnonlin的性能比我在R中尝试过的所有优化算法(包括函数optimxnlmnlminbsolnp等),因为它速度更快,并且找到了更正确"的解决方案.

I am doing nonlinear least-square optimizations and found that the matlab function lsqnonlin performs better than all the optimization algorithms I tried in R (including the algorithms in function optimx, nlm, nlminb, solnp, etc.) in the sense that it is faster and found the "more correct" solution.

但是,我没有找到Matlab中使用的R中信任区域反射"算法的实现.有人知道是否已经实现了吗?而且,对于这种优化,信任区域反射"算法始终是更好的算法吗?

However, I did not find an implementation of the 'trust-region-reflective' algorithm in R that is used in Matlab. Does someone know if there is already an implementation? Also, is it always true that the 'trust-region-reflective' algorithm is a better algorithm for this kind of optimization?

推荐答案

听起来,您正在寻找pracma包中的lsqnonlin.

It sounds like lsqnonlin in the pracma package is what you're looking for.

我建议为R安装sos软件包.其目的是帮助您回答诸如是否有执行此操作的功能?"之类的问题.此软件包中的findFn将搜索您提供的术语在CRAN上的内容.

I recommend installing the sos package for R. Its purpose is to help you answer questions like 'Is there a function out there that does this?'. findFn in this package will search what's on CRAN for the term you supply.

library(sos)
findFn('lsqnonlin')

这篇关于R函数搜索函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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