You are on page 1of 2

Regression in Open Office/ Libre Office

In Open Office (OO) there are several ways to compute a regression equation. The first method is
providing explicitly the slope and intercept while the second method is supplying all regression
coefficients simultaneously, including multiple regression. Both methods can be used by writing OO
code or by point-and-click.
1. The first method is suitable for simple linear regression and uses the SLOPE and INTERCEPT
functions, which will give you the slope and the intercept of the regression line. Depending on
the regression type, such as linear, exponential, or logarithmic, you should use the following OO
code:
The linear regression equation
The linear regression follows the equation y=m*x+b.
m = SLOPE(Data_Y;Data_X)
b = INTERCEPT(Data_Y ;Data_X)
Calculate the coefficient of determination by
r = RSQ(Data_Y;Data_X)

The logarithm regression equation


The logarithm regression follows the equation y=a*ln(x)+b.
a = SLOPE(Data_Y;LN(Data_X))
b = INTERCEPT(Data_Y ;LN(Data_X))
r = RSQ(Data_Y;LN(Data_X))

The exponential regression equation


The exponential regression follows the equation y=b*exp(a*x).
a = SLOPE(LN(Data_Y);Data_X)
b = EXP(INTERCEPT(LN(Data_Y);Data_X))

2. The second method is using LINEST function. LINEST returns a table of statistics for a straight
line that best fits a data set. The LINEST fucntion therefore, is an array function, which returns
an array of parameters extracted from the X-Y data. The material below uses the example from
the OpenOffice Cal Tips website located at http://www.openofficetips.com. The LINEST function
can be accessed by typing it inside a cell after the = sign or by clicking on the function wizard.
The syntax for LINEST command is:
LINEST(data_Y; data_X; linearType; stats)
data_Y is a single row or column range specifying the y coordinates in a set of data
points.
data_X is a corresponding single row or column range specifying the x coordinates. If
data_X is omitted it defaults to 1, 2, 3, ..., n. If there is more than one set of variables
data_X may be a range with corresponding multiple rows or columns.
LINEST finds a straight line y = a + bx that best fits the data, using linear regression (the
"least squares" method). With more than one set of variables the straight line is of the
form y = a + b1x1 + b2x2 ... + bnxn.

If linearType is FALSE the straight line found is forced to pass through the origin (the
constant a is zero; y = bx). If omitted, linearType defaults to TRUE (the line is not
forced through the origin).
If stats is omitted or FALSE only the top line of the statistics table is returned. If TRUE
the entire table is returned.

NOTE: For the LINEST function to work, you must have marked the Array check box in the Function
Wizard.

You might also like