What tool to use to perform Nonlinear Regression with more than 3 variables?

26 ビュー (過去 30 日間)
M.Abuasbeh
M.Abuasbeh 2015 年 5 月 13 日
コメント済み: Ruby Wei 2020 年 6 月 21 日
Hi
I am trying to perform a nonlinear regression in Matlab. I have one dependent variale (response) and 16 independent variables (predictors). I am trying to find any tool in Matlab that can perform the nonlinear regression or curve fitting for all of them together.
Is there any such tool in Matlab?

採用された回答

Star Strider
Star Strider 2015 年 5 月 13 日
The nlinfit function will do what you want.
The procedure for having multiple independent variables is not quite obvious, but easy enough to do. The nonlinear fitting functions will only take one argument for the independent variable, but that argument can be a matrix. To do a nonlinear regression with multiple independent variables, combine your different independent variables into a matrix, and pass that to nlinfit.
For example:
% EQUATION: y = exp(q*x1) * sin(r*x2)
% MAPPING: b(1) = q, b(2) = r, x(:,1) = x1, x(:,2) = x2
x = [x1(:), x2(:)];
f = @(b,x) exp(b(1).*x(:,1)) .* sin(b(2).*x(:,2));
B0 = [1; 1];
B = nlinfit(x, y, f, B0);
(Note: Untested code, for illustration purposes only!)
  1 件のコメント
Ruby Wei
Ruby Wei 2020 年 6 月 21 日
What if two indepent variables have different dimansions? In this case, they can't be combined into one matrix.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRegression についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by