0

I want to perform a 2 variable (linear) regression according to the following bilinear equation:

f(x,y) = a + b*x + c*y + d*x*y,

where the f(x,y) data is, for example, given by the following matrix:

x\y     6.0         7.0         8.0         9.0 
00000   005804.69   007999.53   009833.15   011476.38
00150   005573.34   007821.44   009687.63   011353.49
00500   005161.67   007488.53   009408.31   011112.30
01000   004718.80   007097.39   009060.98   010801.41
01500   004374.67   006773.64   008760.04   010523.11
02000   004082.90   006493.12   008492.45   010269.24
02500   003819.52   006240.45   008248.46   010035.37
03000   003571.24   006005.50   008021.36   009815.34

I have found a couple of ways to interpolate (e.g. passing arguments to a function for fitting), but it seems the x and y values must have the same dimension.

Thanks!

Community
  • 1
  • 1

1 Answers1

0

Indeed, the x and y values must have the same dimensions, from the viewpoint of a solver. You should organize your data in the format of [(x_0,y_0,f(x_0, y_0)),...,(x_n,y_n,f(x_n, y_n))] for n data points. So if your data for the function f is a matrix of dimension P X Q, you should represent it as a new matrix of dimension PQ X 3 where the rows are the observations and the columns are x,y,f(x,y).

nojka_kruva
  • 1,454
  • 1
  • 10
  • 23