Справка LibreOffice 24.8
Trend lines can be added to all 2D chart types except for Pie and Stock charts.
If you insert a trend line to a chart type that uses categories, like Line or Column, then the numbers 1, 2, 3, … are used as x-values to calculate the trend line. For such charts the XY chart type might be more suitable.
To insert a trend line for a data series, first double-click the chart to enter edit mode and select the data series in the chart to which a trend line is to be created.
Choose
, or right-click the data series to open the context menu, and choose .Mean Value Lines are special trend lines that show the mean value. Use
to insert mean value lines for data series.To delete a trend line or mean value line, click the line, then press the Del key.
The menu item
is only available when the chart is in edit mode. It will appear grayed out if the chart is in edit mode but no data series is selected.Линия тренда имеет тот же самый цвет, что и соответствующий ряд данных. Для изменения свойств линии выделите линию тренда и выберите
.A trend line is shown in the legend automatically. Its name can be defined in options of the trend line.
When the chart is in edit mode, LibreOffice gives you the equation of the trend line and the coefficient of determination R2, even if they are not shown: click on the trend line to see the information in the status bar.
To show the trend line equation, select the trend line in the chart, right-click to open the context menu, and choose .
To change format of values (use less significant digits or scientific notation), select the equation in the chart, right-click to open the context menu, and choose
.Default equation uses x for abscissa variable, and f(x) for ordinate variable. To change these names, select the trend line, choose and enter names in X Variable Name and Y Variable Name edit boxes.
To show the coefficient of determination R2, select the equation in the chart, right-click to open the context menu, and choose
.If intercept is forced, coefficient of determination R2 is not calculated in the same way as with free intercept. R2 values can not be compared with forced or free intercept.
The following regression types are available:
Linear trend line: regression through equation y=a∙x+b. Intercept b can be forced.
Polynomial trend line: regression through equation y=Σi(ai∙xi). Intercept a0 can be forced. Degree of polynomial must be given (at least 2).
Logarithmic trend line: regression through equation y=a∙ln(x)+b.
Exponential trend line: regression through equation y=b∙exp(a∙x).This equation is equivalent to y=b∙mx with m=exp(a). Intercept b can be forced.
Power trend line: regression through equation y=b∙xa.
Moving average trend line: simple moving average is calculated with the n previous y-values, n being the period. No equation is available for this trend line.
При расчёте линии тренда учитываются только пары данных со следующими значениями:
Logarithmic trend line: only positive x-values are considered.
Exponential trend line: only positive y-values are considered, except if all y-values are negative: regression will then follow equation y=-b∙exp(a∙x).
Power trend line: only positive x-values are considered; only positive y-values are considered, except if all y-values are negative: regression will then follow equation y=-b∙xa.
Необходимо преобразовать данные соответствующим образом; рекомендуется создать копию исходных данных и работать с ней.
Также параметры можно вычислить с помощью функций Calc следующим образом.
Линейная регрессия соответствует уравнению y = m*x + b.
m = НАКЛОН(Данные_Y; Данные_X)
b = ОТРЕЗОК(Данные_Y; Данные_X)
Расчёт коэффициента определения по
r2 = КВПИРСОН(Данные_Y; Данные_X)
Besides m, b and r2 the array function LINEST provides additional statistics for a regression analysis.
The logarithmic regression follows the equation y=a*ln(x)+b.
a = SLOPE(Данные_Y; LN(Данные_X))
b = ОТРЕЗОК(Данные_Y; LN(Данные_X))
r2 = КВПИРСОН(Данные_Y; LN(Данные_X))
Для кривых экспоненциальной регрессии выполняется преобразование в линейную модель. Оптимальное соответствие кривой достигается по линейной модели, результаты которой интерпретируются соответствующим образом.
The exponential regression follows the equation y=b*exp(a*x) or y=b*mx, which is transformed to ln(y)=ln(b)+a*x or ln(y)=ln(b)+ln(m)*x respectively.
a = SLOPE(LN(Данные_Y); Данные_X)
Переменные для второго варианта вычисляются следующим образом:
m = EXP(SLOPE(LN(Данные_Y); Данные_X))
b = EXP(ОТРЕЗОК(LN(Данные_Y); Данные_X))
Расчёт коэффициента определения по
r2 = КВПИРСОН(LN(Данные_Y); Данные_X)
Besides m, b and r2 the array function LOGEST provides additional statistics for a regression analysis.
For power regression curves a transformation to a linear model takes place. The power regression follows the equation y=b*xa, which is transformed to ln(y)=ln(b)+a*ln(x).
a = SLOPE(LN(Данные_Y); LN(Данные_X))
b = EXP(ОТРЕЗОК(LN(Данные_Y); LN(Данные_X))
r2 = КВПИРСОН(LN(Данные_Y); LN(Данные_X))
For polynomial regression curves a transformation to a linear model takes place.
Create a table with the columns x, x2, x3, … , xn, y up to the desired degree n.
Use the formula =LINEST(Data_Y,Data_X) with the complete range x to xn (without headings) as Data_X.
The first row of the LINEST output contains the coefficients of the regression polynomial, with the coefficient of xn at the leftmost position.
The first element of the third row of the LINEST output is the value of r2. See the LINEST function for details on proper use and an explanation of the other output parameters.