General Least Squares Regression

版本 1.1.0.0 (3.4 KB) 作者: Husam Aldahiyat
Multi Dimensional Multivariable Least Squares Regression
5.2K 次下载
更新时间 2009/9/9

查看许可证

The code manually derives the expression fm(x1,x2,x3,...,xk) for
the equally spaced points in (k+1) dimensions, where m is the order of the approximation f.

Example:

x1=[6 7 8 5 3 2 1 2 5 8];
x2=[9 7 0 8 5 6 4 3 2 10];
y=[9 7 6 4 3 2 5 6 8 1];

mreg([x1;x2],y,1)
ans =
5.542073-.2829251*x2+.2310048*x1

mreg([x1;x2],y,2)
ans =
3.797949-.6754073*x2-.2393447e-1*x2^2
+2.256645*x1+.8248780e-1*x1*x2
-.2478672*x1^2

mreg([x1;x2],y,3)
ans =
-24.62814+33.15517*x2-9.837215*x2^2+.8316257*x2^3
-17.31119*x1+7.450905*x1*x2-.6438069*x1*x2^2
+.3614982*x1^2-.4148167*x1^2*x2+.2851207*x1^3

Example:

x1=[6 7 8 5 3 2 1 2 5 8 5 4];
x2=[9 7 0 8 5 6 4 3 2 10 5 7];
x3=[8 9 7 6 5 4 3 5 6 7 5 3];
y=[9 7 6 4 3 2 5 6 8 1 8 0];

mreg([x1;x2;x3],y,2)
ans =
32.48905-7.049319*x3+.1384845*x3^2-6.246954*x2
+1.259510*x2*x3-.4498889e-1*x2^2+5.668323*x1
-.4038119*x1*x3-.3257156*x1*x2-.1031725*x1^2

引用格式

Husam Aldahiyat (2024). General Least Squares Regression (https://www.mathworks.com/matlabcentral/fileexchange/22865-general-least-squares-regression), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2007a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Descriptive Statistics 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.1.0.0

Updated requirements.

1.0.0.0