Introducing the day-of-the-year temperature model

Continuing with the work we did in the previous example, I would like to propose a new model, where temperature is a function of the day of the year (between 1 and 366). Of course, this model is not complete, but can be used as a component in a more advanced model, which should take into account the previous autoregressive model that we did with lag 2. The procedure for this model is illustrated as follows:

  1. Fit the temperature data before the cutoff point to a quadratic polynomial just as in the previous section but without averaging:
    poly = np.polyfit(days[:cutoff], temp[:cutoff], 2)
    print poly

    Believe it or not, we get the same polynomial coefficients we got earlier:

    [ -4.91072584e-04 1.92682505e-01 ...

Get Learning NumPy Array now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.