Trend Lines and Error Bars
Trend Lines and Error Bars are analytical elements that can be added to a
series in order to highlight some statistical aspect of the series'
values. Trend Lines, sometimes called
curve fittings, are mathematically determined lines that approximate the
general path that the series data takes.
Error Bars are graphical elements which display a fixed or calculated
region within which the series data exists, or display the error or the
probability of error in the series data.
Trend Lines
Trend Lines can be added to the following series
types:
Bar
Base-Error
High-Low
High-Low-Open-Close
Histogram
Intensity
Scatter
Line
XY
Scatter
To add trend lines to a given series, select the
series and bring forward the Inspector Panel.
Select the
"Trends" tab at the top of the Inspector Panel. This tab panel allows you to add, manage and delete any
number of trends associated with the series.
When no trends have been added to the series, the
Trends panel has only one active control on it: the "Add Trend"
button. For each trend that you
want to add to the series, you click this button once. The popup at the top of the Trends
panel allows you to select a given trend.
Once a trend is selected, its attributes are displayed with the other
controls in the panel.
Each trend that is added to a series can have an
entry in the legend that represents the trend. This entry is labeled (its default label is "<Series
Name>(Trend #)"), and will always be adjacent to its series within the
legend. This entry can be removed
from the legend, without removing the trend from the chart, from within the
Inspector Panel. The default behavior is that the entry is shown.
Trend Lines are not applicable for series drawn on
a horizontal grid, nor for series which have a 3D effect when drawn on a 3D
grid (e.g. Line series has a 3D effect on a 3D grid, so trends cannot be
applied to a 3D Line series; however, XY series do not have a 3D effect on a 3D
grid so trends are applicable). Series
that draw with a 3D effect include Bar, Line, and Histogram. Modifying the grid orientation from
vertical to horizontal, or from 2D to 3D, once a trend has been added to a
series will hide the trend line.
Similarly, the Trends tab is removed from a series' Inspector Panel if the
series is drawn on a horizontal or 3D grid.
Each
trend is calculated based on its type, or mathematical model. Chartsmith offers six models to choose
from.
Moving Average - A moving average trend calculates
each point of the trend by adding the values of the previous p points and then
dividing by p. Where the number of points (p) is called the period, and is
specified by the user using the text-field labeled "Period".
Linear - A linear trend is plotted using the
equation:
y
= a + b(x).
where
a and b are determined by performing a least squares analysis for a
first-degree polynomial on the (xi,yi) data points of the series.
Polynomial - An nth degree polynomial
trend is plotted using the equation:
y
= a0 + a1(x) + a2(x2) +...+ an(xn)
where
(a0, a1, a2,... an) are determined by performing a least squares analysis for
an nth-degree polynomial on the (xi,yi) data points in the series. The order,
n, is specified in the text-field labeled "Order," and can range from
2 to 6. If an inappropriate order
is provided, for example only 3 data points exist in the series but an order of
5 is specified, Chartsmith will reduce the order to a value that is applicable
for the number of points in the series.
Exponential - An exponential trend is plotted using
the equation:
y
= abx, or log(y) = log(a) + (log(b))(x)
where
log(a) and log(b) are determined by performing a least squares analysis for a first-degree
polynomial on the (xi,log(yi)) data points of the series. The coefficients a
and b are determined by:
a
= 10(log(a)), and b = 10(log(b))
Power - A power trend is plotted using the
equation:
y
= axb, or log(y) = log(a) + b(log(x))
where
log(a) and b are determined by performing a least squares analysis for a
first-degree polynomial on the (log(xi),log(yi)) data points of the series. The
coefficients a and b are determined by:
a
= 10(log(a)), and b = b
Logarithmic - A logarithmic trend is plotted using
the equation:
y
= a + b(log(x))
where
a and b are determined by performing a least squares analysis for a
first-degree polynomial on the (log(xi),yi) data points of the series.
Note: Trend lines can be applied to chart types that have one dimensional data - this includes Bar, Line, High-Low, High-Low-Open-Close, and Base-Error - however, two dimensional data must be used to undergo the linear regression. So in these cases, a numeric reference of 1 is used for the X data, meaning that the first element in a series gets a X value of 1, the second gets a X value of 2, and so on. This approach is used for all of the trend types.
Error Bars
Error bars can be added to the following series
types:
Bar
Line
Intensity Scatter
XY
Scatter
To add error bars to a given series, select the
series and bring forward the Inspector.
Select the
"ErrorBars" tab at the top of the Inspector. This tab panel allows you to activate
error bars for the selected series.
The error bars are activated by clicking on the
switch at the top of the Error Bars tab. If the series type is XY, Scatter or
Intensity Scatter, then there will also be a popup button at the top of the tab.
This is used to address the X Axis or Y Axis error bars, which can both be
activated for these series types. Once the error bars are activated, then the
attributes of the error bars can be specified.
Specifying a series' error bars requires you to indicate
whether the positive and negative error bars will be identical or different. This choice is
made in the inspector by selecting one of two choices provided by the Mode radio button:
the icon that symbolizes the top and bottom will be identical, or the one that indicates they
will be different (the 'different' icon is the one with the red top and blue bottom).
The error bar type can be one of five different
models, as follows.
Percentage
Ð Extends error bars above and/or below series element a distance that is a
percentage of that series elementÕs value. The percentage is set using
the modifier field to the right of the popup.
Fixed -
Extends error bars above and/or below each series element a distance whose
magnitude is set to a fixed amount. The fixed value is set using the modifier
field to the right of the popup.
Standard Deviation - Extends error bars above and/or below the mean of the
series by some number of standard deviations, as set in the modifier field to
the right of the popup. Standard deviation is calculated as:
Std_Dev = sqrt( sum(D) /
N-1 ), where
D = square of a valueÕs difference from the mean,
Sum(D) = sum of all D over the value set
N = number of values.
This is the 'sample standard deviation' algorithm.
This algorithm provides the best representation of uncertainty in a numeric
distribution, especially if the sample size is small.
Standard Error - Extends error bars above and/or below each series
element a distance that is calculated as:
Std_Dev / sqrt( N ), where Std_Dev and N are defined above.
Variable -
Extends error bars from series element a distance whose
magnitude is set based on a value that is input in the Data View.
Other attributes of error bars include the
direction, which establishes the relative direction the error bars are drawn;
and the related axis, which establishes which axis, X or Y, the error bars are
measured by, thus orienting the error bars to be parallel to the axis that is
selected.
If invalid data is encountered in the data set, it is ignored in the calculation of error bars.