Is there a method for polynomial regression in 2D dimensions?

Mackenzie Rios

Mackenzie Rios

Answered question

2022-05-24

Is there a method for polynomial regression in 2 D dimensions (fitting a function f ( x , y ) to a set of data X , Y, and Z)? And is there a way to apply a condition to the regression in 2 D that requires all functions fitted to go through the axis line x = 0?

Answer & Explanation

zepplinkid7yk

zepplinkid7yk

Beginner2022-05-25Added 11 answers

Linear regression works for polynomials of degree n. There's also non-linear regression for "any function", but there is polynomials.
In practice there are recommendations about how many parameters you should fit to a model: problems arise with over fitting.
Suppose you want to fit a polynomial based on a single parameter matrix X, we can write
X = ( 1 x 1 x 1 2 x 1 n 1 x 2 x 2 2 x 2 n 1 x m x m 2 x m n )
Then you want a coefficient vector to best fit the data, call it β. We want to find β ^ which best fits our data. In simple linear regression, we might consider a model Z = X β + ϵ where ϵ is an error term. We want to find the equation best fits the data and so has the smallest value of epsilon.
It turns out that the answer is β ^ = ( X T X ) 1 X T z.
Now, if we wanted to use both variables, we could just make a new matrix which instead of only include the x's, we also stuff all the y's in there. If you wanted you could define a new matrix Y and solve Z = X β x + Y β y and basically get the same thing:
β ^ x = ( X T X ) 1 X T z
β ^ y = ( Y T Y ) 1 Y T z
We end up solving the equation Z = X β our vector z = X β
The β ^ 's are our coefficient vectors for our polynomials.
If you wanted them all to go through the origin, you'd remove the columns with ones.

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Inferential Statistics

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?