Solved – the value of “X” in a regression equation when dealing with a time series

excelpolynomialregressionregression coefficients

I am using excel to add a polynomial trend line to a chart. The chart and the formula of the trend line are shown below. I want to add lines indicating different confidence intervals so I need to find out the y values representing the trend line drawn on the chart.

If I had 2 columns of "normal" data – e.g. height and weight – I understand that I could just plug in the x value into the equation and get the result of the trend line. However, in this case my x axis is a series of dates. What is the value of x that you would plug into the equation to generate that line? I can't plug in a date (or can I?) and if I play with the formatting, excel turns the dates into very large numbers (my guess is number of days since a certain start date). What I am missing? Is there an easier way to do this?

Thank you

Picture of chart with formula

Best Answer

The value of x used to generate any point on that trend line is indeed the "very big number" that is the way Excel actually stores dates. It is - as you partially surmised - the number of days since Jan. 1, 1900 - so for any remotely current dates, the number is pretty large. If you are keeping not just dates, but dates and times - the time portion is kept as a fraction of a day (so 12 noon on a particular day is stored with a number 0.5 larger than the preceding midnight).

You will also want to be careful to stick just to the region of your data - with a 6th order polynomial - if you move very far outside the range between 2005 and 2012 - the values of the trend line are quite likely to become quite extreme (I think, looking at your coefficients, that if you tried to plot a value for a date in 1970 - or 2050 - it would be incredibly huge, but I might have things backwards, and those values could be extremely negative numbers).

Edited to add - User777 below is correct. Excel stores dates so that Jan. 1, 1900 is 1 - so it stores a number that is either the number of days since "Jan. 0, 1900" - or "Dec. 31, 1899" - whichever way is easier for you to understand.