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.
0 个评论
回答(1 个)
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 个评论
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 Center 和 File Exchange 中查找有关 Linear Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!