A trend line is a line showing the patterns or trends emerging from data points. Trend lines are used to predict the continuation of a certain trend of a variable. It also helps to identify the correlation between two variables by observing the trend in both of them simultaneously.
Trend lines are considered to be of great use in data visualization and analysis. In Tableau, we get a lot of options to create different types of trend lines which helps in inferring important patterns and trends in our data.
Trend lines help us in interpreting data trends, predicting future scenarios, and draw a correlation between two variables in the analysis.
In Tableau, You can have a straight or curved trend line depending on the model you select from the different trend line models available in Tableau.
Tableau has a total of five types of trend lines:
In this section, we are going to learn how to add a trend line to our visualizations/Charts.
As I said earlier there are five different trend lines available in Tableau, let us discuss them one by one as below.
Linear trend lines are used to estimate a linear relationship between the given data. The linear equation is :
Y=β0+β1*X //**Where Y is the dependent variable that we are interested in and X is the independent variable that affects Y**//
The above formula represents the simplest trend line model, the linear trend line estimates a relationship that is increasing or decreasing at a steady rate
β1 and is, therefore, best used when the trend of the data resembles a linear pattern.
Example : The cost of products tends to be linear. If one apple costs $1 then five apples will cost $5.
The below image shows the linear trend line of profit and sales.
In the exponential trend line model, the natural log of the data values are taken and then those values are plotted after exponentiating them. The equation of an exponential trend line is:
Y = exp(b0)* exp(b1 * X).
To change the data values into their natural logs, the equation used is
ln(Y) = b0 + b1 * X
The exponential trend line does not accept values less than zero. That is why, while calculating for an exponential trend line, Tableau eliminates all the negative values from the set.
The below image represents the exponential trend line.
Right-click on the trend line and select the Describe Trend line option will show you the details of the trend line:
The logarithmic trend lines represent the logarithm values in a data field. The equation of a logarithmic trend line is given as:
Y = b0 + b1 * ln(X).
In order to create a logarithm, Tableau filters out all the negative values, and as the exponential trend line, the logarithm cannot be defined with values less than zero.
The below image shows the algorithm trend line with its description:
Polynomial trend lines are curved lines, which deals with variables with a fluctuating relationship. This is why these trend lines have different shapes depending on the user-defined order of the polynomial.
You can select the degree for the polynomial series between 2 to 8. The accuracy of a polynomial model depends on the values taken and the polynomial degree. You can check for a warning message underlined in red in the description of the model to see if your model is accurate or not.
The equation or formula to create a polynomial trend line is:
Y = b0 + b1 * X + b2 * X^2 + …
The below images shows the polynomial trend line.
The description of the polynomial trend line is as below:
Power trend lines are curved lines that are used when the dependent variable increases at a predetermined rate β_1.
The formula or equation for a power trend line is:
Y = b0 * X^b1
In the power model, both variables are transformed by the natural logarithm ln(Y), ln(X) before the model is estimated.
Since these quantities are not defined for negative values, any marks with negative values in either variable will be filtered out. And the power trend lines should be used with caution to avoid information loss.
The below image shows the power trend line.
The below image shows the description of the Power Trend Line
Whenever you want to create a trend line model in Tableau, the calculations are based on some assumptions. They are known as trend line assumptions. Every trend line is created by doing computations that depend upon these assumptions.
The trend line assumptions are :