Basis function regression for 3 parameters

조회 수: 3 (최근 30일)
Yash Bhatia
Yash Bhatia 2022년 11월 30일
편집: Torsten 2022년 11월 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