Basis function regression for 3 parameters
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Torsten
le 30 Nov 2022
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 commentaires
Torsten
le 30 Nov 2022
Modifié(e) : Torsten
le 30 Nov 2022
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 ?
Voir également
Catégories
En savoir plus sur Linear Regression dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!