-1
$\begingroup$

Given a set of points, a trend line is a function $f(x)$ that is defined as

$f(x) = a x + b$

Creating a trend line means to find the values of the constants $a$ and $b$. Given some data, A is the $x$ value, B is $y$:

       A      B
---  -----  -----
  1    0,1   1483
  2    0,0   1383
 …
842   -0,2    943

I can use =SLOPE(B1:B842;A1:A842) to get $a$, and =INTERCEPT(B1:B842;A1:A842) to get $b$. This is how far I got.

My question is: What if I have several $x$es that all influence the outcome? The function am thinking of should look like this:

$f(x_1, x_2) = a_1 x_1 + a_2 x_2 + b$

What I want to get is $a_1$, $a_2$ and $b$. Given a table of data with many rows (A is $x_1$, B is $x_2$, C is $y$), how can I do this in a spreadsheet?

       A      B      B
---  -----  -----  -----
  1    0,1  92,85   1483
  2    0,0   94,7   1383
 …
842   -0,2   93,8    943

What if I have three $x$es?

1 Answers 1

1

For any number of $x$es, you can use the matrix function $\texttt{LINEST}$, to do want you want, you can use the fuction $\texttt{LINEST(A1:B842,C1:C842)}$. Remember to enter the array function with $\textsf{Strg} + \textsf{Shift} + \textsf{Return}$.