Basis function regression for 3 parameters

3 次查看(过去 30 天)
I am currently working on finding the coefficients for a linear regression model, given its dependence on basis functions. The model is y(x1, x2, x3) = a_0 f_0(x1, x2, x3) + a_1 f_1(x1, x2, x3) + a_2 f_2(x1, x2, x3).... up to a_10 f_10(x1, x2, x3). The functions are, for example, f_0 = 1, f_1 = sin(x1*x2), f_2 = x1*x3^2 and so on.
Given this, I am aware that for a bivariate regression model y(x1, x2) , the matrices would look something like the attached picture. Then we can simply solve for X given the model is a linear system Ax = B
My question is, is there an analogous set of matrices for 3 predictors? I would imagine this would make A an (11x11x11) matrix, and B would still be (11x1) matrix. But when I construct these matrices in MATLAB and try to solve the system using the expression
X = A\B;
it informs me the matrices must be 2 dimensional.

回答(1 个)

Torsten
Torsten 2022-11-30
Put the equations
y(x1(i),x2(j),x3(k)) = a_0*f_0(x1(i), x2(j), x3(k)) + a_1*f_1(x1(i), x2(j), x3(k)) + a_2*f_2(x1(i), x2(j), x3(k)) + ... + a_10*f_10(x1(i), x2(j), x3(k))
in matrix form
Y = F*a
and solve for a as
a = F\Y
  2 个评论
Yash Bhatia
Yash Bhatia 2022-11-30
I don't see how I can decompose y(x1, x2, x3) into matrices F and a. Can you go more into detail on that?
Torsten
Torsten 2022-11-30
编辑:Torsten 2022-11-30
Write
y(x1(i),x2(j),x3(k)) = a_0*f_0(x1(i), x2(j), x3(k)) + a_1*f_1(x1(i), x2(j), x3(k)) + a_2*f_2(x1(i), x2(j), x3(k)) + ... + a_10*f_10(x1(i), x2(j), x3(k))
as
y(x1(i),x2(j),x3(k)) = [f_0(x1(i), x2(j), x3(k)) f_1(x1(i), x2(j), x3(k)) f_2(x1(i), x2(j), x3(k)) ...f_10(x1(i), x2(j), x3(k))]*[a_0 ;a_1 ;a_2 ;...;a_10]
Can you see what the (ijk)-th row of F and the (ijk)-th entry of Y is ?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Linear Regression 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by