What is HTML and CSS? A great beginner question and one that I will explain here with an analogy.
 This means no fonts, colours or images. It'd look pretty boring right? Well HTML is basically what that poster would be, you would be building a website with content and stucture, but no fonts, colours or images. This is where CSS comes in. CSS allows you to add that flair to your paper flyer!
Control flow and loops can be described as three statements : if, for and while.
Using an everyday example to explain, 'if' statements basically use a specific condition
before allowing actions to take place. For example let's say I have awoken from my slumber in the morning,
if it is to the sound of my alarm clock then I will go brush my teeth. If not, then go back to sleep.
Does that make sense?
'For' loops are a process used to cycle through arrays and objects usually with some code to do something
(like add to a count or even use an if statement to check for something). Imagine you've got a weird art project and you need to
paint some eggs. For every even number egg, you will paint it blue and for every odd number egg you will paint it green.
That's basically for loops in a nutshell (or should I say... eggshell. Sorry)
'While' loops can be an infinite cycle of doom if you let it. It works just like it sounds, while a condition is still true then commit to the action. For example, you're at the gym running the treadmill, burning away last night's guilty pleasure. While the timer is less than 10 minutes, keep running. Simple as that.
Document Object Model (or DOM for short) was confusing for me to understand at first, but much simpler once I got my head around it.
Okay here goes. So we know HTML is used to put content and structure into our website, right? Going a step deeper into HTML, the code
is structured from top to bottom. Like in a poster, you would have the title at the top (most of the time) and then the good stuff
underneath. Now 'The Dom' is a model that represents what the structure of the HTML file looks like and it actually looks like a big
family tree.
Cool thing is that anybody with a computer and internet can access the DOM and see what the website is made up of. For a beginner coder like me,
I like to use this fact and copy awesome looking code for my own projects. And if you wanted, you could look at Google's homepage DOM and change
the search button to say something funny (though it wouldn't be made public for everyone else).
Both arrays and objects are ways to store data together for ease of access when needed. Now, the are both very similar in intention but the situations you might use them are what set them apart.
Arrays are useful when you want to store data in an ordered list (known as elements). Each element is stored with an index (number) based on its position in the array. Let's say you're shopping for a big dinner that you're hosting next Sunday and you've written up a shopping list. Think of an array like your shopping list and it has things like [beef, spaghetti, milk, eggs] etc. Each product in your list is an element. To access your array, you could say "I want the third thing in my shopping list" and that would come up as milk.
Objects are useful when you need to record characteristics of a person, a place, a building etc. Looking back at your big dinner you have planned, you could treat each person coming as an object (just not in real life!). You would record things like their name, location and maybe their dietary requirements. Accessing objects are different to arrays because instead of thinking of the number in the list, you just think about the key (characteristic) like diet and check if they are vegetarian or vegan.
Functions are set lines of codes ready for you to use. The benefit of functions is that if you think you need to use that same set of code more than once then you can create a function that stores them and runs it on command. A very simple example would be like locking and unlocking your door. You need to put your key in the door, turn it and take the key out. A function is like putting a button on your key so that when you press it, it will do all of the steps without you having to do it again.


It has been a challenging journey, but we have finally finished updating the entire platform and have launched most of the major improvements. We appologize for the period of instability while the code was updated, but we are sure the new improvements are worth it.
'I definitely personally hope centralized exchanges burn in hell:' Ethereum founder blasts the most powerful players in crypto https://read.bi/2KYofel via @businessinsider
I try to avoid the cultism that's common in crypto and am openly critical of anything that contradicts science and good engineering.
Don't take a critical view as bearishness. I invested far more in crypto than most, want the entire space to succeed, and believe it will.
@etherdelta is the official account for information release on Twitter.Our official e-mail is<EMAIL_ADDRESS>There are no more Tweets in this timeline.


Python FAST API
Electron JS
Type your Name
Submit
38% Complete
Open Path to Explorer
Submit
38% Complete
Log From Python.js
API Response from FASTAPI


TASK SELECTION
Please select the desired task
TRIGGER
Please select the desired triggers
Please select a Task
FILE UPLOAD
Please upload the File(s)
Please select the desired task
Please select the desired triggers
Please select a Task
Please upload the File(s)


The introduction is an important part of your documentthough it should not be the most important part.
It is generally a very good to write other section except the introduction too.
You can use the following ways to write lists:
Shell commands look like ls -l
. Python
snippets look like print 1
.
Longer python things should be in pre
def foo(): pass
Or they can be outlined
rootscript.pyLikewise, HTML can be outlined too:
example.html


Maps one of the viridis colour palettes, or a user-specified palette to values. Viridis colour maps are created by Stéfan van der Walt and Nathaniel Smith. They were set as the default palette for the 'Python' 'Matplotlib' library, introduced at SciPy 2015 conference <http://scipy2015.scipy.org/ehome/index.php?eventid=115969&>.
| Version: | 0.2.0 |
| Imports: | Rcpp |
| LinkingTo: | Rcpp, BH |
| Suggests: | covr, microbenchmark, ggplot2, scales, testthat, viridisLite |
| Published: | 2018-11-07 |
| Author: | David Cooley [aut, cre] |
| Maintainer: | David Cooley <dcooley at symbolix.com.au> |
| License: | GPL-3 |
| NeedsCompilation: | yes |
| Materials: | README NEWS |
| CRAN checks: | colourvalues results |
| Reference manual: | colourvalues.pdf |
| Package source: | colourvalues_0.2.0.tar.gz |
| Windows binaries: | r-devel: colourvalues_0.2.0.zip, r-release: colourvalues_0.2.0.zip, r-oldrel: colourvalues_0.2.0.zip |
| OS X binaries: | r-release: colourvalues_0.2.0.tgz, r-oldrel: colourvalues_0.2.0.tgz |
| Old sources: | colourvalues archive |
Please use the canonical form https://CRAN.R-project.org/package=colourvalues to link to this page.


Before Change
// Create random Tensors for weights, and wrap them in Variables.
w1 = Variable(torch.randn(D_in, H).type(dtype), requires_grad=True)
w2 = Variable(torch.randn(H, D_out).type(dtype), requires_grad=True)
learning_rate = 1e-6
for t in range(500):
// To apply our Function, we use Function.apply method. We alias this as "relu".
After Change
// Create random Tensors for weights.
w1 = torch.randn(D_in, H, device=device, dtype=dtype, requires_grad=True)
w2 = torch.randn(H, D_out, device=device, dtype=dtype, requires_grad=True)
learning_rate = 1e-6
for t in range(500):
// To apply our Function, we use Function.apply method. We alias this as "relu".
relu = MyReLU.apply
// Forward pass: compute predicted y using operations; we compute
// ReLU using our custom autograd operation.
y_pred = relu(x.mm(w1)).mm(w2)
// Compute and print loss
loss = (y_pred - y).pow(2).sum()
print(t, loss.item())
// Use autograd to compute the backward pass.
loss.backward()
// Update weights using gradient descent
with torch.no_grad():
w1 -= learning_rate * w1.grad
w2 -= learning_rate * w2.grad
// Manually zero the gradients after updating weights
w1.grad.zero_()
w2.grad.zero_()


Action Cable Chat Part 2
07 Jul 2016Last post we went through and built out the chat app without any of the realtime features. If you want to work along you can fork the repo from here action-cable-chat-example.
Alright so one of the first things we want to do with our action cable is set up the connection between the client and the server. When you create your rails 5 app a lot of this is already given to you. We have to unomment out the bit in config/routes to mount the action cable.
Make sure that your application head you include the action_cable_meta_tag
And for the enviroment configuration make sure that the localhost:3000/cable is set as the action cable url.
Finally since we only want logged in users to be the ones who have access to any of the pub/sub data we need to verify them when the connection is made. Let’s go ahead and modify our channels connection file. The following snippet is taken from the rails edge guide.
As you can see this makes a call to cookies.signed to check the user id. We need to make sure we give the user this signed cookie for the verification. Let’s do that on login and signup right after we create the session.
Now let’s build out the room channel which will broadcast messages as they come in. rails has a generator for this so we can call. It builds out the javascript channel file and the ruby channel file.
We only want users to see messages that are sent to the channel that they are currently in so we are going to scope them out to the specific room. Let’s build out the client portion first.
We send back the name of the room which will link up with the created ruby file. We also send back the param of room which is optional and let’s us scope out this channel. You can configure it however you want, I am just going to grab the room id off the end of the url. as you can see we are going to append the data we receive back through this channel to a messages div. Let’s wrap the rendered messages in a div with an id of messages.
Now let’s make our server side connection. When a user calls the subscription.create method on the front-end, it will call the subscribed method for the specified channel on the backend. Let’s wire that up.
Now we want to broadcast to all of the subscribed users any new created message. We are going to use a job that will perform this after creation. We can use rails generate job for this
now in our jobs folder lets modify the newly created file.
Let’s put in our message model that any time that a model is created and committed that we want to broadcast it to the room.
Now to see if all of this is working we are going to have to ajax our message submit. Let’s remove the redirect_to :back in the messages create controller we had previously and build out an ajax call.
Restart your server and if everything is working we should have chats being posted in realtime! WHAT! crazy. Test it out, open two browsers, one incognito and login as two different users. You should see it appear on both screens after a submit.
Alright now that we have that working lets get those users displaying in realtime. Now this one is a bit more tricky. Since users can only get data published to them when they are subscribed it’s not as simple to show the users that were logged in before you entered the room. Let’s add an online field to our memberships table as a way to manage peoples status. create a new migration to add the field online as a boolean to memberships
Drop, create, migrate and seed your database again. You may have to also delete your browser history to get rid of the session[:user_id] on your browser. now create the appearance channel, we are going to scope it out the same way with the room index. Everytime someone subscribes to the room we are going to set the status to true and publish that membership data to the room. Same for when they unsubscribe and we set the status to false. We will first create the appearance channel
Let’s work out the server side code which is going to call two methods that we need to define in the membership model – is_online and is_offline
And then the server side channel code.
Let’s make a job similar to how we did for messages after a commit for the membership model. We are going to want to publish data whenever a membership status changes from true to false or vice versa.
Now let’s finish up our connection with the javascript channel code. We are going to subscribe to the scoped room, when subscribed we will be waiting for broadcasts from the job we just put together. When we receive that broadcast we are going to use the data to target the li that contains that username and active green dot.
Now let’s switch our rooms/show controller and view to iterate through memberships rather than users so we have access to the online status from the start.
The plan is at first when we load the room show page we are going to display all currently active members by using the membership online status.
Set the css to have the green dot display for the class active and not display for inactive
Now when the pageload initially occurs we see all of the current statuses of users online. That paired with the appearance channel we will see the green dot vanish when users leave the room and appear when they enter. Test it out, login with one user in incognito and another user in a seperate browser. when one of them exits the dot disappears, when they enter again it comes back.
We have a full fledged chat app at this point, users can talk in realtime and you can view all of the users currently in the room. All that is left to do is style the app. Let’s deploy this guy to heroku. Create your new app on heroku and grab the app name.
Now most of this section is taken line for line from this post by Sophie DeBenedetto. It is a great tutorial and much more informative than this one!
add redistogo to your app
now run the following command to grab to view your config variables
copy and paste the redistogo url from your config variables to your config cable.yml
Add the following to your config environments production file
that last bit says any address that matches our own with a wildcard for anything to follow. You may want to get more strict on the channels you allow.
specify cable on the client side when you call create consumer
Now all that’s left to do is deploy and pray
Hope that worked out for you! Obviously this app could use some styling but I am going to leave that up to you. If you are looking to keep working your action cable skills I would recommend trying to build out a channel for user to user channel within the room. Also check out this cool post on building chess with action cable.


Chapter 2 ARIMA models
- AR: autoregressive (lagged observations as inputs)
- I: integrated (differencing to make series stationary)
- MA: moving average (lagged errors as inputs)
An ARIMA model is rarely interpretable in terms of visible data structures like trend and seasonality. But it can capture a huge range of time series patterns.
2.1 Stationarity and differencing
2.1.1 Stationarity
Definition
If \(\{y_t\}\) is a stationary time series, then for all \(s\), the distribution of \((y_t,\dots,y_{t+s})\) does not depend on \(t\).
A stationary series is:
- roughly horizontal
- constant variance
no patterns predictable in the long-term
- Transformations help to stabilize the variance.
For ARIMA modelling, we also need to stabilize the mean.
Identifying non-stationary series
- time plot.
- The ACF of stationary data drops to zero relatively quickly
- The ACF of non-stationary data decreases slowly.
- For non-stationary data, the value of r1 is often large and positive.
- A time series, \(\{Y_t, t=0, \pm1,\dots\}\) is said to be strict stationary, if \((Y_1, \dots, Y_n)\) and \((Y_{1+h}, \dots, Y_{n+h})\) have the same joint distribution for all integers \(h\) and \(n>0.\)
<IP_ADDRESS> Weak Stationarity
Definition: Covariance function (in (Brockwell et al. 2016), p. 15; the notations have been changed for consistency within this note)
Let \(\{Y_t\}\) be a time series with \(E(Y_t^2)<\infty.\) The mean function of \(\{Y_t\}\) is
\[\mu_Y(t)= E(Y_t)\]
The covariance function of \(\{Y_t\}\) is
\[\gamma_Y(r,s)=Cov(Y_r, Y_s)=E[(Y_r-\mu_Y(r))(Y_s-\mu_Y(s))]\]
for all integers \(r\) and \(s\).
Definition: Weakly stationary (in (Brockwell et al. 2016), p. 15; the notations have been changed for consistency within this note)
\(\{Y_t\}\) is weakly stationary if
- \(\mu_Y(t)\) is independent of \(t\),
and
- \(\gamma_Y(t+h,t)\) is independent of \(t\) for each \(h\).
- Unless specifically indicate otherwise, whenever we use the term stationary we shall mean weakly stationary.
2.1.2 Differencing
- Differencing helps to stabilize the mean.
- The differenced series is the change between each observation in the original series: \(y'_t = y_t - y_{t-1}\).
- The differenced series will have only \(T-1\) values since it is not possible to calculate a difference \(y_1'\) for the first observation.
<IP_ADDRESS> Second-order differencing
Occasionally the differenced data will not appear stationary and it may be necessary to difference the data a second time:
\[y''_{t} = y'_{t} - y'_{t - 1}\] \[= (y_t - y_{t-1}) - (y_{t-1}-y_{t-2})\] \[= y_t - 2y_{t-1} +y_{t-2}.\]
- \(y_t''\) will have \(T-2\) values.
- In practice, it is almost never necessary to go beyond second-order differences.
<IP_ADDRESS> Seasonal differencing
A seasonal difference is the difference between an observation and the corresponding observation from the previous year.
\[y'_t = y_t - y_{t-m}\]
where \(m=\) number of seasons.
- For monthly data \(m=12\).
- For quarterly data \(m=4\).
Example : Electricity production
- Seasonally differenced series is closer to being stationary.
- Remaining non-stationarity can be removed with further first difference.
If \(y'_t = y_t - y_{t-12}\) denotes seasonally differenced series, then twice-differenced series is
\[y^*_t = y'_t - y'_{t-1}\] \[= (y_t - y_{t-12}) - (y_{t-1} - y_{t-13})\] \[= y_t - y_{t-1} - y_{t-12} + y_{t-13}.\]
When both seasonal and first differences are applied \(\dots\)
- it makes no difference which is done first—the result will be the same.
- If seasonality is strong, we recommend that seasonal differencing be done first because sometimes the resulting series will be stationary and there will be no need for further first difference.
It is important that if differencing is used, the differences are interpretable.
<IP_ADDRESS> Interpretation of differencing
- first differences are the change between one observation and the next;
- seasonal differences are the change between one year to the next.
But taking lag 3 differences for yearly data, for example, results in a model which cannot be sensibly interpreted.
2.1.3 Backshift notation
A very useful notational device is the backward shift operator, \(B\), which is used as follows: \[B y_{t} = y_{t - 1}\]
In other words,
- \(B\), operating on \(y_{t}\), has the effect of shifting the data back one period.
- Two applications of \(B\) to \(y_{t}\) shifts the data back two periods: \[B(By_{t}) = B^{2}y_{t} = y_{t-2}\]
- For monthly data, if we wish to shift attention to “the same month last year”, then \(B^{12}\) is used, and the notation is \[B^{12}y_{t} = y_{t-12}\].
- The backward shift operator is convenient for describing the process of differencing.
- A first difference can be written as \[y^{\prime}_{t}= y_{t} - y_{t-1}= y_t - By_{t} = (1 - B)y_{t}\]
- Note that a first difference is represented by \((1 - B)\).
Similarly, if second-order differences (i.e., first differences of first differences) have to be computed, then: \[y''_{t} = y_{t} - 2y_{t - 1} + y_{t - 2} = (1 - B)^{2} y_{t}\]
- Second-order difference is denoted \((1- B)^{2}\).
- Second-order difference is not the same as a second difference, which would be denoted \(1- B^{2}\);
In general, a \(d\)th-order difference can be written as
\[(1 - B)^{d} y_{t}\] * A seasonal difference followed by a first difference can be written as
\[(1-B)(1-B^m)y_t\] - The “backshift” notation is convenient because the terms can be multiplied together to see the combined effect.
\[(1-B)(1-B^m)y_t = (1 - B - B^m + B^{m+1})y_t\] \[= y_t-y_{t-1}-y_{t-m}+y_{t-m-1}.\] - For monthly data, \(m=12\) and we obtain the same result as earlier.
2.2 Non-seasonal ARIMA models
2.2.1 Autoregressive models
Autoregressive (AR) models: \[y_{t} = c + \phi_{1}y_{t - 1} + \phi_{2}y_{t - 2} + \cdots + \phi_{p}y_{t - p} + \varepsilon_{t},\] where \(\varepsilon_t\) is white noise. This is a multiple regression with of \(y_t\) as predictors.
<IP_ADDRESS> AR(1) model
\[y_{t} = 18 -0.8 y_{t - 1} + \varepsilon_{t}\] \[\varepsilon_t\sim N(0,1),\quad T=100.\]
\[y_{t} = c + \phi_1 y_{t - 1} + \varepsilon_{t}\]
- When \(\phi_1=0\), \(y_t\) is equivalent to WN
- When \(\phi_1=1\) and \(c=0\), \(y_t\) is equivalent to a RW
- When \(\phi_1=1\) and \(c\ne0\), \(y_t\) is equivalent to a RW with drift
- When \(\phi_1<0\), \(y_t\) tends to oscillate between positive and negative values.
<IP_ADDRESS> AR(2) model
\[y_t = 8 + 1.3y_{t-1} - 0.7 y_{t-2} + \varepsilon_t\] \[\varepsilon_t\sim N(0,1), \qquad T=100.\]
<IP_ADDRESS> Stationarity conditions
- We normally restrict autoregressive models to stationary data, and then some constraints on the values of the parameters are required.
General condition for stationarity
Complex roots of \(1-\phi_1 z - \phi_2 z^2 - \dots - \phi_pz^p\) lie outside the unit circle on the complex plane.
- For \(p=1\): \(-1<\phi_1<1\).
- For \(p=2\):\(-1<\phi_2<1\qquad \phi_2+\phi_1 < 1 \qquad \phi_2 -\phi_1 < 1\).
- More complicated conditions hold for \(p\ge3\).
- Estimation software takes care of this.
2.2.2 Moving Average (MA) models
Moving Average (MA) models: \[y_{t} = c + \varepsilon_t + \theta_{1}\varepsilon_{t - 1} + \theta_{2}\varepsilon_{t - 2} + \cdots + \theta_{q}\varepsilon_{t - q},\] where \(\varepsilon_t\) is white noise. This is a multiple regression with past errors as predictors.
- Don’t confuse this with moving average smoothing!
<IP_ADDRESS> MA(1) model
\[y_t = 20 + \varepsilon_t + 0.8 \varepsilon_{t-1}\] \[\varepsilon_t\sim N(0,1),\quad T=100.\]
<IP_ADDRESS> MA(2) model
\[y_t = \varepsilon_t -\varepsilon_{t-1} + 0.8 \varepsilon_{t-2}\] \[\varepsilon_t\sim N(0,1),\quad T=100.\]
<IP_ADDRESS> MA(\(\infty\)) models
It is possible to write any stationary AR(\(p\)) process as an MA(\(\infty\)) process.
Example: AR(1) \[y_t = \phi_1y_{t-1} + \varepsilon_t\] \[= \phi_1(\phi_1y_{t-2} + \varepsilon_{t-1}) + \varepsilon_t\] \[= \phi_1^2y_{t-2} + \phi_1 \varepsilon_{t-1} + \varepsilon_t\] \[= \phi_1^3y_{t-3} + \phi_1^2\varepsilon_{t-2} + \phi_1 \varepsilon_{t-1} + \varepsilon_t\] \[\dots\]
Provided \(-1 < \phi_1 < 1\): \[y_t = \varepsilon_t + \phi_1 \varepsilon_{t-1} + \phi_1^2 \varepsilon_{t-2} + \phi_1^3 \varepsilon_{t-3} + \cdots\]
2.2.3 Invertibility
- Any MA(\(q\)) process can be written as an AR(\(\infty\)) process if we impose some constraints on the MA parameters.
- Then the MA model is called “invertible”.
- Invertible models have some mathematical properties that make them easier to use in practice.
- Invertibility of an ARIMA model is equivalent to forecastability of an ETS model.
General condition for invertibility
Complex roots of \(1+\theta_1 z + \theta_2 z^2 + \dots + \theta_qz^q\) lie outside the unit circle on the complex plane.
- For \(q=1\): \(-1<\theta_1<1\).
- For \(q=2\):\(-1<\theta_2<1\qquad \theta_2+\theta_1 >-1 \qquad \theta_1 -\theta_2 < 1\).
- More complicated conditions hold for \(q\ge3\).
- Estimation software takes care of this.
2.2.4 ARIMA models
Autoregressive Moving Average models:
\[y_{t} = c + \phi_{1}y_{t - 1} + \cdots + \phi_{p}y_{t - p}\] \[+ \theta_{1}\varepsilon_{t - 1} + \cdots + \theta_{q}\varepsilon_{t - q} + \varepsilon_{t}\]
- Predictors include both lagged values of \(y_t\) and lagged errors.
- Conditions on coefficients ensure stationarity.
- Conditions on coefficients ensure invertibility.
Autoregressive Integrated Moving Average models
- Combine ARMA model with differencing.
- \((1-B)^d y_t\) follows an ARMA model.
Autoregressive Integrated Moving Average models
ARIMA(\(p, d, q\)) model
- AR: \(p =\) order of the autoregressive part
- I: \(d =\) degree of first differencing involved
MA: \(q =\) order of the moving average part.
- White noise model: ARIMA(0,0,0)
- Random walk: ARIMA(0,1,0) with no constant
- Random walk with drift: ARIMA(0,1,0) with const.
- AR(\(p\)): ARIMA(\(p\),0,0)
- MA(\(q\)): ARIMA(0,0,\(q\))
2.2.5 Backshift notation for ARIMA
- ARMA model:
\[y_{t} = c + \phi_{1}By_{t} + \cdots + \phi_pB^py_{t} + \varepsilon_{t} + \theta_{1}B\varepsilon_{t} + \cdots + \theta_qB^q\varepsilon_{t}\]
\[\text{or}\quad (1-\phi_1B - \cdots - \phi_p B^p) y_t = c + (1 + \theta_1 B + \cdots + \theta_q B^q)\varepsilon_t\]
ARIMA(1,1,1) model:
\[(1 - \phi_{1} B) (1 - B) y_{t} = c + (1 + \theta_{1} B) \varepsilon_{t}\]
NOTE:
Written out: \[y_t = c + y_{t-1} + \phi_1 y_{t-1}- \phi_1 y_{t-2} + \theta_1\varepsilon_{t-1} + \varepsilon_t\]
2.3 Estimation and order selection
2.3.1 Maximum likelihood estimation
Having identified the model order, we need to estimate the parameters \(c\), \(\phi_1,\dots,\phi_p\), \(\theta_1,\dots,\theta_q\).
- MLE is very similar to least squares estimation obtained by minimizing \[\sum_{t-1}^T e_t^2\]
- The
ARIMA()
function allows CLS or MLE estimation. - Non-linear optimization must be used in either case.
- Different software will give different estimates.
2.3.2 Partial autocorrelations
Partial autocorrelations measure relationship between \(y_{t}\) and \(y_{t - k}\), when the effects of other time lags — \(1, 2, 3, \dots, k - 1\) — are removed.
\[\alpha_k = k \text{th partial autocorrelation coefficient}\]
\[= \text{equal to the estimate of } \phi_k \text{ in regression:}\]
\[y_t = c + \phi_1 y_{t-1} + \phi_2 y_{t-2} + \dots + \phi_k y_{t-k}.\]
- Varying number of terms on RHS gives \(\alpha_k\) for different values of \(k\).
- \(\alpha_1=\rho_1\)
- same critical values of \(\pm 1.96/\sqrt{T}\) as for ACF.
- Last significant \(\alpha_k\) indicates the order of an AR model.
<IP_ADDRESS> Example: Mink trapping
2.3.3 ACF and PACF interpretation
AR(1)
\[\rho_k = \phi_1^k\qquad\text{for } k=1,2,\dots;\]
\[\alpha_1 = \phi_1 \qquad\alpha_k = 0\qquad\text{for } k=2,3,\dots.\]
So we have an AR(1) model when
- autocorrelations exponentially decay
- there is a single significant partial autocorrelation.
AR(\(p\))
- ACF dies out in an exponential or damped sine-wave manner
- PACF has all zero spikes beyond the \(p\)th spike
So we have an AR(\(p\)) model when
- the ACF is exponentially decaying or sinusoidal
- there is a significant spike at lag \(p\) in PACF, but none beyond \(p\)
MA(1)
\[\rho_1 = \theta_1\qquad \rho_k = 0\qquad\text{for }k=2,3,\dots;\]
\[\alpha_k = -(-\theta_1)^k\]
So we have an MA(1) model when
- the PACF is exponentially decaying and
- there is a single significant spike in ACF
MA(\(q\))
- PACF dies out in an exponential or damped sine-wave manner
- ACF has all zero spikes beyond the \(q\)th spike
So we have an MA(\(q\)) model when
- the PACF is exponentially decaying or sinusoidal
- there is a significant spike at lag \(q\) in ACF, but none beyond \(q\)
2.3.4 Information criteria
Akaike’s Information Criterion (AIC)
\[\text{AIC} = -2 \log(L) + 2(p+q+k+1),\] where \(L\) is the likelihood of the data, \(k=1\) if \(c\ne0\) and \(k=0\) if \(c=0\).
Corrected AIC:
\[\text{AICc} = \text{AIC} + \displaystyle\frac{2(p+q+k+1)(p+q+k+2)}{T-p-q-k-2}.\]
Bayesian Information Criterion: \[\text{BIC} = \text{AIC} + [\log(T)-2](p+q+k+1).\]
- Good models are obtained by minimizing either the AIC, AICc or BIC.
- Our preference is to use the AICc.
2.4 Seasonal ARIMA models
| ARIMA | \(~\underbrace{(p, d, q)}\) | \(\underbrace{(P, D, Q)_{m}}\) |
|---|---|---|
| \({\uparrow}\) | \({\uparrow}\) | |
| Non-seasonal part | Seasonal part of | |
| of the model | of the model |
where \(m =\) number of observations per year.
Example: ARIMA\((1, 1, 1)(1, 1, 1)_{4}\) model (without constant)
\[(1 - \phi_{1}B)(1 - \Phi_{1}B^{4}) (1 - B) (1 - B^{4})y_{t} ~= ~ (1 + \theta_{1}B) (1 + \Theta_{1}B^{4})\varepsilon_{t}. \]
All the factors can be multiplied out and the general model written as follows:
\[y_{t} = (1 + \phi_{1})y_{t - 1} - \phi_1y_{t-2} + (1 + \Phi_{1})y_{t - 4}- (1 + \phi_{1} + \Phi_{1} + \phi_{1}\Phi_{1})y_{t - 5} + (\phi_{1} + \phi_{1} \Phi_{1}) y_{t - 6}\] \[- \Phi_{1} y_{t - 8} + (\Phi_{1} + \phi_{1} \Phi_{1}) y_{t - 9} - \phi_{1} \Phi_{1} y_{t - 10} + \varepsilon_{t} + \theta_{1}\varepsilon_{t - 1} + \Theta_{1}\varepsilon_{t - 4} + \theta_{1}\Theta_{1}\varepsilon_{t - 5}.\]
2.4.1 Common ARIMA models
The US Census Bureau uses the following models most often:
2.4.2 Seasonal ARIMA models
The seasonal part of an AR or MA model will be seen in the seasonal lags of the PACF and ACF.
ARIMA(0,0,0)(0,0,1)\(_{12}\) will show:
- a spike at lag 12 in the ACF but no other significant spikes.
- The PACF will show exponential decay in the seasonal lags; that is, at lags 12, 24, 36, .
ARIMA(0,0,0)(1,0,0)\(_{12}\) will show:
- exponential decay in the seasonal lags of the ACF
- a single significant spike at lag 12 in the PACF.
2.5 Theoretical properties of the models
2.5.1 Autoregressive (AR) models
<IP_ADDRESS> Properties of AR(1) model
Consider the following \(AR(1)\) model.
\[\begin{equation} \label{eq:ar} Y_t=\phi_0+\phi_1Y_{t-1}+\epsilon_{t} \end{equation}\]
where \(\varepsilon_t\) is white noise.
<IP_ADDRESS>.1 Mean
Assuming that the series is weak stationary, we have \(E(Y_t)=\mu\), \(Var(Y_t)=\gamma_0\), and \(Cov(Y_t, Y_{t-k})=\gamma_k\), where \(\mu\) and \(\gamma_0\) are constants. Given that \({\epsilon_t}\) is a white noise, we have \(E(\epsilon_t)=0\). The mean of \(AR(1)\) process can be computed as follows:
\[ \begin{aligned} E(Y_t) &= E(\phi_0+\phi_1 Y_{t-1}) \\ &= E(\phi_0) +E(\phi_1 Y_{t-1}) \\ &= \phi_0 +\phi_1 E(Y_{t-1}). \\ \end{aligned} \] Under the stationarity condition, \(E(Y_t)=E(Y_{t-1})=\mu\). Thus we get
\[\mu = \phi_0+\phi_1\mu.\]
Solving for \(\mu\) yields
\[\begin{equation} \label{eq:2} E(Y_t)=\mu=\frac{\phi_0}{1-\phi_1}. \end{equation}\]
The results has two constraints for \(Y_t\). First, the mean of \(Y_t\) exists if \(\phi_1 \neq 1 .\) The mean of \(Y_t\) is zero if and only if \(\phi_0=0\).
<IP_ADDRESS>.2 Variance and the stationary condition of AR (1) process
First take variance of both sides of Equation (??)
\[Var(Y_t)=Var(\phi_0+\phi_1 Y_{t-1}+\epsilon_t)\]
The \(Y_{t-1}\) occurred before time \(t\). The \(\epsilon_t\) does not depend on any past observation. Hence, \(cov(Y_{t-1}, \epsilon_t)= 0\). Furthermore, \({\epsilon_t}\) is a white noise. This gives
\[Var(Y_t)=\phi_1^2 Var(Y_{t-1})+\sigma^2.\]
Under the stationarity condition, \(Var(Y_t)=Var(Y_{t-1})\). Hence,
\[Var(Y_t)=\frac{\sigma^2}{1-\phi_1^2}.\]
provided that \(\phi_1^2 < 1\) or \(|\phi_1| < 1\) (The variance of a random variable is bounded and non-negative). The necessary and sufficient condition for the \(AR(1)\) model in Equation (??) to be weakly stationary is \(|\phi_1| < 1\). This condition is equivalent to saying that the root of \(1-\phi_1B = 0\) must lie outside the unit circle. This can be explained as below
Using the backshift notation we can write \(AR(1)\) process as
\[Y_t = \phi_0 + \phi_1BY_{t} + \epsilon_t.\]
Then we get
\[(1-\phi_1B)Y_t=\phi_0 + \epsilon_t.\] The \(AR(1)\) process is said to be stationary if the roots of \((1-\phi_1B)=0\) lie outside the unit circle.
<IP_ADDRESS>.3 Covariance
The covariance \(\gamma_k=Cov(Y_t, Y_{t-k})\) is called the lag-\(k\) autocovariance of \(Y_t\). The two main properties of \(\gamma_k\): (a) \(\gamma_0=Var(Y_t)\) and (b) \(\gamma_{-k}=\gamma_{k}\).
The lag-\(k\) autocovariance of \(Y_t\) is
\[\begin{equation} \label{eq:3} \begin{aligned} \gamma_k &= Cov(Y_t, Y_{t-k}) \\ &= E[(Y_t-\mu)(Y_{t-k}-\mu)] \\ &= E[Y_tY_{t-k}-Y_t\mu-\mu Y_{t-k} +\mu^2] \\ &= E(Y_t Y_{t-k}) - \mu^2. \\ \end{aligned} \end{equation}\]
Now we have
\[\begin{equation} \label{eq:3} E(Y_t Y_{t-k}) = \gamma_k + \mu^2 \end{equation}\]
<IP_ADDRESS>.4 Autocorrelation function of an AR(1) process
To derive autocorrelation function of an AR(1) process we first multiply both sides of Equation (??) by \(Y_{t-k}\) and take expected values:
\[E(Y_tY_{t-k})=\phi_0E(Y_{t-k})+\phi_1 E(Y_{t-1}Y_{t-k})+E(\epsilon_tY_{t-k})\] Since \(\epsilon_t\) and \(Y_{t-k}\) are independent and using the results in Equation (??)
\[\gamma_k + \mu^2 = \phi_0 \mu+\phi_1(\gamma_{k-1}+\mu^2)\]
Substituting the results in Equation (??) to Equation (??) we get
\[\begin{equation} \label{eq:5} \gamma_k = \phi_1 \gamma_{k-1}. \end{equation}\]
The autocorrelation function, \(\rho_k\), is defined as
\[\rho_k = \frac{\gamma_k}{\gamma_0}\].
Setting \(k=1\), we get \(\gamma_1 = \phi_1\gamma_0.\) Hence,
\[\rho_1=\phi_1.\]
Similarly with \(k=2\), \(\gamma_2 = \phi_1 \gamma_1\). Dividing both sides by \(\gamma_0\) and substituting with \(\rho_1=\phi_1\) we get
\[\rho_2=\phi_1^2.\]
Now it is easy to see that in general
\[\begin{equation} \label{eq:acfar1} \rho_k = \frac{\gamma_k}{\gamma_0}=\phi_1^k \end{equation}\]
for \(k=0, 1, 2, 3, ...\).
Since \(|\phi_1| < 1,\) the autocorrelation function is an exponentially decreasing as the number of lags \(k\) increases. There are two features in the ACF of AR(1) process depending on the sign of \(\phi_1\). They are,
If \(0 < \phi_1 < 1,\) all correlations are positive.
if \(-1 < \phi_1 < 0,\) the lag 1 autocorrelation is negative (\(\rho_1=\phi_1\)) and the signs of successive autocorrelations alternate from positive to negative with their magnitudes decreasing exponentially.
<IP_ADDRESS> Properties of AR(2) model
Now consider a second-order autoregressive process (AR(2))
\[\begin{equation} \label{eq:ar2} Y_t=\phi_0+\phi_1Y_{t-1}+\phi_2Y_{t-2}+\epsilon_t. \end{equation}\]
<IP_ADDRESS>.1 Mean
Question 1: Using the same technique as that of the AR(1), show that
\[E(Y_t) = \mu = \frac{\phi_0}{1-\phi_1 - \phi_2}\] and the mean of \(Y_t\) exists if \(\phi_1 + \phi_2 \neq 1\).
<IP_ADDRESS>.2 Variance
Question 2: Show that \[Var(Y_t) = \frac{(1-\phi_2)\sigma^2}{(1+\phi_2)((1+\phi_2)^2-\phi_1^2)}.\]
Here is a guide to the solution
Start with
\[Var(Y_t)=Var(\phi_0+\phi_1Y_{t-1}+\phi_2Y_{t-2}+\epsilon_t)\]
Solve it until you obtain the Eq. (a) as shown below.
\[\begin{equation} \tag{a} \gamma_0 (1-\phi_1^2 - \phi_2^2) = 2\phi_1\phi_2\gamma_1+\sigma^2. \end{equation}\]
Next multiply both sides of Equation (??) by \(Y_{t-1}\) and obtain an expression for \(\gamma_1\). Let’s call this Eq. (b).
Solve Eq. (a) and (b) for \(\gamma_0.\)
<IP_ADDRESS>.3 Stationarity of AR(2) process
To discuss the stationarity condition of the \(AR(2)\) process we use the roots of the characteristic polynomial. Here is the illustration.
Using the backshift notation we can write \(AR(2)\) process as
\[Y_t = \phi_0 + \phi_1 BY_{t} + \phi_2 B^2 Y_{t} + \epsilon_t.\]
Furthermore, we get
\[(1-\phi_1 B - \phi_2 B^2) Y_t = \phi_0 + \epsilon_t.\]
The characteristic polynomial of \(AR(2)\) process is
\[\Phi(B)=1-\phi_1 B - \phi_2 B^2.\]
and the corresponding AR characteristic equation
\[1-\phi_1 B - \phi_2 B^2=0.\]
For stationarity, the roots of AR characteristic equation must lie outside the unit circle. The two roots of the AR characteristic equation are
\[\frac{\phi_1 \pm \sqrt{\phi_1^2 + 4\phi_2}}{-2\phi_2}\]
Using algebraic manipulation, we can show that these roots will exceed 1 in modulus if and only if simultaneously \(\phi_1 + \phi_2 < 1,\) \(\phi_2-\phi_1 < 1,\) and \(|\phi_2| < 1.\) This is called the stationarity condition of \(AR(2)\) process.
<IP_ADDRESS>.4 Autocorrelation function of an AR(2) process
To derive autocorrelation function of an AR(2) process we first multiply both sides of Equation (??) by \(Y_{t-k}\) and take expected values:
\[\begin{align} E(Y_tY_{t-k}) &= E(\phi_0Y_{t-k}+\theta_1Y_{t-1}Y_{t-k}+\theta_2Y_{t-2}Y_{t-k}+\epsilon_tY_{t-k} )\\ &= \phi_0 E(Y_{t-k})+\phi_{1}E(Y_{t-1}Y_{t-k}) + \phi_2 E(Y_{t-2} Y_{t-k}) + E(\epsilon_tY_{t-k}). \end{align}\]
Using the independence between \(\epsilon_t\) and \(Y_{t-1}\), \(E(\epsilon_t Y_{t-k})=0\) and the results in Equation (??) (This is valid for AR(2)) we have
\[\gamma_k + \mu^2 = \phi_0 \mu + \theta_1 (\gamma_{k-1}+\mu^2)+\phi_2 (\gamma_{k-2}+\mu^2).\]
(Note that \(E(X_{t-1}X_{t-k})=E(X_{t-1}X_{(t-1)-(k-1)}=\gamma_{k-1})\))
Solving for \(\gamma_k\) we get
\[\begin{align} \label{eq:eq9} \gamma_k=\phi_1\gamma_{k-1}+\phi_2\gamma_{k-2}. \end{align}\]
By dividing both sides of Equation (??) by \(\gamma_0\), we have
\[\begin{align} \label{eq:yule2} \rho_k=\phi_1\rho_{k-1}+\phi_2\rho_{k-2}. \end{align}\]
for \(k>0\).
Setting \(k=1\) and using \(\rho_0=1\) and \(\rho_{-1}=\rho_1\), we get the Yule-Walker equation for \(AR(2)\) process.
\[\rho_1=\phi_1+\phi_2 \rho_1\] or
\[\rho_1 = \frac{\phi_1}{1-\phi_2}.\]
Similarly, we can show that
\[\rho_2 = \frac{\phi_2(1-\phi_2)+\phi_1^2}{(1-\phi_2)}.\]
<IP_ADDRESS> Properties of AR(p) model
The \(p\)th order autoregressive model can be written as
\[\begin{align} Y_t = \phi_0 + \phi_1Y_{t-1}+\phi_2 Y_{t-2}+ ... + \phi_p Y_{t-p}+\epsilon_t. \end{align}\]
The AR characteristic equation is
\[1-\phi_1B-\phi_2B^2-...-\phi_pB^p=0.\]
For stationarity of \(AR(p)\) process, the \(p\) roots of the AR characteristic must lie outside the unit circle.
<IP_ADDRESS>.1 Mean
Question 3: Find \(E(Y_t)\) of \(AR(p)\) process.
<IP_ADDRESS>.2 Variance
Question 4: Find \(Var(Y_t)\) of \(AR(p)\) process.
<IP_ADDRESS>.3 Autocorrelation function (ACF) of an AR(p) process
Question 5: Similar to the results in Equation (??) for \(AR(2)\) process, obtain the following recursive relationship for \(AR(p)\).
\[\begin{align} \label{eq:yulep} \rho_k = \phi_1\rho_{k-1}+\phi_2 \rho_{k-2} + ... + \phi_p \rho_{k-p}. \end{align}\]
Setting \(k=1, 2, ..., p\) into Equation (??) and using \(\rho_0=1\) and \(\rho_{-k}=\rho_k\), we get the Yule-Walker equations for \(AR(p)\) process
\[\begin{equation} \label{eq:13} \begin{aligned} \rho_1 &= \phi_1+\phi_2 \rho_{1} + ... + \phi_p \rho_{p-1}\\ \rho_2 &= \phi_1 \rho_1+\phi_2 + ... + \phi_p \rho_{p-2}\\ ... \\ \rho_p &= \phi_1 \rho_{p-1} +\phi_2 \rho_{p-2} + ... + \phi_p \\ \end{aligned} \end{equation}\]
The Yule-Walker equations in (??) can be written in matrix form as below.
\[\left[\begin{array} {r} \rho_1 \\ \rho_2 \\ .\\ .\\ .\\ \rho_p \end{array}\right] = \left[\begin{array} {rrrrrrr} 1 & \rho_1 & \rho_2 & .&.&.& \rho_{p-1} \\ \rho_1 & 1 & \rho_1 & .&.&.& \rho_{p-2} \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ \rho_{p-1} & \rho_{p-2} & \rho_{p-3} & .&.&.& 1 \\ \end{array}\right] \left[\begin{array} {r} \phi_1 \\ \phi_2 \\ .\\ .\\ .\\ \phi_p \end{array}\right] \]
or
\[\symbf{{\rho_{p}}} = \symbf{{P_{p}\phi}}.\]
where,
\[\symbf{\rho_p} = \left[\begin{array} {r} \rho_1 \\ \rho_2 \\ .\\ .\\ .\\ \rho_p \end{array}\right], \mathbf{P_p} = \left[\begin{array} {rrrrrrr} 1 & \rho_1 & \rho_2 & .&.&.& \rho_{p-1} \\ \rho_1 & 1 & \rho_1 & .&.&.& \rho_{p-2} \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ \rho_{p-1} & \rho_{p-2} & \rho_{p-3} & .&.&.& 1 \\ \end{array}\right], \symbf{{\phi}} = \left[\begin{array} {r} \phi_1 \\ \phi_2 \\ .\\ .\\ .\\ \phi_p \end{array}\right]\]
The parameters can be estimated using
\[\symbf{\phi}=\symbf{P_p^{-1}\rho_p}.\]
Question 6: Obtain the parameters of an \(AR(3)\) process whose first autocorrelations are \(\rho_1=0.9\); \(\rho_2=0.9\); \(\rho_3=0.5\). Is the process stationary?
<IP_ADDRESS>.4 The partial autocorrelation function (PACF)
Let \(\phi_{kj}\), the \(j\)th coefficient in an \(AR(k)\) model. Then, \(\phi_{kk}\) is the last coefficient. From Equation (??), the \(\phi_{kj}\) satisfy the set of equations
\[\begin{equation} \label{eq:pacf} \rho_j=\phi_{k1}\rho_{j-1}+...+\phi_{k(k-1)}\rho_{j-k+1}+\phi_{kk}\rho_{j-k}, \end{equation}\]
for \(j=1, 2, ...k\), leading to the Yule-Walker equations which may be written
\[\begin{equation} \label{eq:pacf} \left[\begin{array} {r} \rho_1 \\ \rho_2 \\ .\\ .\\ .\\ \rho_k \end{array}\right] = \left[\begin{array} {rrrrrrr} 1 & \rho_1 & \rho_2 & .&.&.& \rho_{k-1} \\ \rho_1 & 1 & \rho_1 & .&.&.& \rho_{k-2} \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ \rho_{k-1} & \rho_{k-2} & \rho_{k-3} & .&.&.& 1 \\ \end{array}\right] \left[\begin{array} {r} \phi_{k1} \\ \phi_{k2} \\ .\\ .\\ .\\ \phi_{kk} \end{array}\right] \end{equation}\]
or
\[\symbf{\rho_k}=\symbf{P_k\phi_k}.\]
where
\[\symbf{\rho_k} = \left[\begin{array} {r} \rho_1 \\ \rho_2 \\ .\\ .\\ .\\ \rho_k \end{array}\right], \mathbf{P_k} =\left[\begin{array} {rrrrrrr} 1 & \rho_1 & \rho_2 & .&.&.& \rho_{k-1} \\ \rho_1 & 1 & \rho_1 & .&.&.& \rho_{k-2} \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ . & . & . & .&.&.& . \\ \rho_{k-1} & \rho_{k-2} & \rho_{k-3} & .&.&.& 1 \\ \end{array}\right], \symbf{\phi_k} = \left[\begin{array} {r} \phi_{k1} \\ \phi_{k2} \\ .\\ .\\ .\\ \phi_{kk} \end{array}\right]\]
For each \(k\), we compute the coefficients \(\phi_{kk}\). Solving the equations for \(k=1, 2, 3...\) successively, we obtain
For \(k=1\),
\[\begin{equation} \label{eq:p1} \phi_{11}=\rho_1. \end{equation}\]
For \(k=2\),
\[\begin{equation} \label{eq:p2} \phi_{22}=\frac{\left[\begin{array} {rr} 1 & \rho_1 \\ \rho_1 & \rho_2 \\ \end{array}\right]}{\left[\begin{array} {rr} 1 & \rho_1 \\ \rho_1 & 1 \\ \end{array}\right]} = \frac{\rho_2-\rho_1^2}{1-\rho_1^2} \end{equation}\]
For \(k=3\),
\[\begin{equation} \label{eq:p3} \phi_{33}=\frac{\left[\begin{array} {rrr} 1 & \rho_1 & \rho_1 \\ \rho_1 & 1 & \rho_2 \\ \rho_2 & \rho_1 & \rho_3 \\ \end{array}\right]}{\left[\begin{array} {rrr} 1 & \rho_1 & \rho_2 \\ \rho_1 & 1 & \rho_1 \\ \rho_2 & \rho_1 & 1 \\ \end{array}\right]} \end{equation}\]
The quantity \(\phi_{kk}\) is called the partial autocorrelation at lag \(k\) and can be defined as \[\phi_{kk}=Corr(Y_tY_{t-k}|Y_{t-1}, Y_{t-2},..., Y_{t-k+1}).\] The partial autocorrelation between \(Y_t\) and \(Y_{t-k}\) is the correlation between \(Y_t\) and \(Y_{t-k}\) after removing the effect of the intermediate variables \(Y_{t-1}, Y_{t-2}, ..., Y_{t-k+1}\).
In general the determinant in the numerator of Equations (??), (??) and (??) has the same elements as that in the denominator, but replacing the last column with \(\symbf{\rho_k}= (\rho_1, \rho_2,...\rho_k).\)
<IP_ADDRESS>.5 PACF for AR(1) models
From Equation (??) we have
\(\rho_k=\phi_1^k\) for \(k=0, 1, 2, 3,...\)
Hence, for \(k=1\), the first partial autocorrelation coefficient is
\[\phi_{11}=\rho_1=\phi_1.\] From (??) for \(k=2\), the second partial autocorrelation coefficient is
\[\phi_{22}=\frac{\rho_2-\rho_1^2}{1-\rho_1^2}=\frac{\phi_1^2-\phi_1^2}{1-\phi_1^2} = 0\].
Similarly, for \(AR(1)\) we can show that \(\phi_{kk}=0\) for all \(k > 1\). Hence, for \(AR(1)\) process the partial autocorrelation is non-zero for lag \(1\) which is the order of the process, but is zero for lags beyond the order 1.
<IP_ADDRESS>.6 PACF for AR(2) model
Question 7: For \(AR(2)\) process show that \(\phi_{kk}=0\) for all \(k>2\). Sketch the PACF of \(AR(2)\) process.
<IP_ADDRESS>.7 PACF for AR(P) model
In general for \(AR(p)\) process, the partial autocorrelation function \(\phi_{kk}\) is non-zero for \(k\) less than or equal to \(p\) (the order of the process) and zero for all \(k\) greater than \(p\). In other words, the partial autocorrelation function of a \(AR(p)\) process has a cut-off after lag \(p\).
2.5.2 Moving average (MA) models
We first derive the properties of \(MA(1)\) and \(MA(2)\) models and then give the results for the general \(MA(q)\) model.
<IP_ADDRESS> Properties of MA(1) model
The general form for \(MA(1)\) model is
\[\begin{equation} \label{eq:ma1} Y_t = \theta_0 + \theta_1 \epsilon_{t-1} + \epsilon_t \end{equation}\]
where \(\theta_0\) is a constant and \({\epsilon_t}\) is a white noise series.
<IP_ADDRESS>.1 Mean
Question 8: Show that \(E(Y_t) = \theta_0\).
<IP_ADDRESS>.2 Variance
Question 9: Show that \(Var(Y_t) = (1+\theta_1^2)\sigma^2\).
We can see both mean and variance are time-invariant. \(MA\) models are finite linear combinations of a white noise sequence. Hence, \(MA\) processes are always weakly stationary.
<IP_ADDRESS>.3 Autocorrelation function of an MA(1) process
Method 1
To obtain the autocorrelation function of \(MA(1)\), we first multiply both sides of Equation (??) by \(Y_{t-k}\) and take the expectation.
\[\begin{equation} \label{eq: ma1acfs1} \begin{aligned} E[Y_tY_{t-k}] &= E[\theta_0 Y_{t-k} + \theta_1 \epsilon_{t-1} Y_{t-k} + \epsilon_t Y_{t-k}]\\ &= \theta_0 E(Y_{t-k}) + \theta_1 E(\epsilon_{t-1}Y_{t-k}) + E(\epsilon_t Y_{t-k})\\ \end{aligned} \end{equation}\]
Using the independence between \(\epsilon_t\) and \(Y_{t-k}\) (future error and past observation) \(E(\epsilon_t Y_{t-k}) = 0\). Now we have
\[\begin{equation} \label{eq:ma1acfs2} E[Y_tY_{t-k}] = \theta_0^2 + \theta_1 E(\epsilon_{t-1}Y_{t-k}) \end{equation}\]
Now let’s obtain an expression for \(E[Y_t Y_{t-k}]\).
\[\begin{equation} \label{eq:covma1} \begin{aligned} \gamma_k &= Cov(Y_t, Y_{t-k}) \\ &= E[(Y_t-\theta_0)(Y_{t-k}-\theta_0)] \\ &= E[Y_tY_{t-k}-Y_t\theta_0-\theta_0 Y_{t-k} +\theta_0^2] \\ &= E(Y_t Y_{t-k}) - \theta_0^2. \\ \end{aligned} \end{equation}\]
Now we have
\[\begin{equation} \label{eq:covma1} E(Y_t Y_{t-k}) = \gamma_k + \theta_0^2. \end{equation}\]
Using the Equations (??) and (??) we have
\[\begin{equation} \label{eq:covma2} \gamma_k = \theta_0^2 - \theta_0^2 + \theta_1E(\epsilon_{t-1}Y_{t-k}). \end{equation}\]
Now let’s consider the case \(k=1\).
\[\begin{equation} \label{eq:covma3} \gamma_1 = \theta_0^2 - \theta_0^2 + \theta_1E(\epsilon_{t-1}Y_{t-1}) \end{equation}\]
Today’s error and today’s value are dependent. Hence, \(E(\epsilon_{t-1}Y_{t-1}) \neq 0.\) We first need to identify \(E(\epsilon_{t-1}Y_{t-1})\).
\[\begin{equation} \label{eq:covma4} \begin{aligned} E(\epsilon_{t-1}Y_{t-1}) &= E(\theta_0 \epsilon_{t-1} + \theta_1 \epsilon_{t-2} \epsilon_{t-1}+ \epsilon_{t-1}^2)\\ \end{aligned} \end{equation}\]
Since, {\(\epsilon_t\)} is a white noise process \(E(\epsilon_{t-1}) = 0\) and \(E(\epsilon_{t-2} \epsilon_{t-1}) = 0\). Hence, we have
\[\begin{equation} \label{eq:covma5} \begin{aligned} E(\epsilon_{t-1}Y_{t-1}) &= E(\epsilon_{t-1}^2)=\sigma^2\\ \end{aligned} \end{equation}\]
Substituting (??) in (??) we get
\[\gamma_1=\theta_1\sigma^2\].
Furthermore, \(\gamma_0 = Var(Y_t)= (1+\theta_1^2)\sigma^2\). Hence
\[\rho_1=\frac{\gamma_1}{\gamma_0}=\frac{\theta_1}{1+\theta_1^2}.\]
When \(k=2\), from Equation (??) and \(E(\epsilon_{t-1}Y_{t-2}) = 0\) (future error and past observation) we get \(\gamma_2=0\). Hence \(\rho_2=0\). Similarly, we can show that
\[\gamma_k = \rho_k=0\] for all \(k \geq 2\).
We can see that the ACF of \(MA(1)\) process is zero, beyond the order of 1 of the process.
Method 2: By using the definition of covariance
\[\begin{equation} \label{eq:mtd21} \begin{aligned} \gamma_1 = Cov(Y_t, Y_{t-1}) &= Cov(\epsilon_t + \theta_1 \epsilon_{t-1}+ \theta_0, \epsilon_{t-1}+\theta_1 \epsilon_{t-2} + \theta_0)\\ &=Cov(\theta_1 \epsilon_{t-1}, \epsilon_{t-1})\\ &=\theta_1 \sigma^2. \end{aligned} \end{equation}\]
\[\begin{equation} \label{eq:mtd21} \begin{aligned} \gamma_2=Cov(Y_t, Y_{t-2}) &= Cov(\epsilon_t + \theta_1 \epsilon_{t-1}+ \theta_0, \epsilon_{t-2}+\theta_1 \epsilon_{t-3} + \theta_0)\\ &=0. \end{aligned} \end{equation}\]
We have \(\gamma_0=\sigma^2(1+\theta_1^2)\), (Using the variance).
Hence
\[\rho_1=\frac{\gamma_1}{\gamma_0}=\frac{\theta_1}{1+\theta_1^2}.\]
Similarly we can show \(\gamma_k=\rho_k=0\) for all \(k \geq 2\).
<IP_ADDRESS> Properties of MA(2) model
An \(MA(2)\) model is in the form
\[\begin{equation} \label{eq:ma2} Y_t = \theta_0 + \theta_1 \epsilon_{t-1} + \theta_2 \epsilon_{t-2} + \epsilon_t \end{equation}\]
where \(\theta_0\) is a constant and \({\epsilon_t}\) is a white noise series.
<IP_ADDRESS>.1 Mean
Question 10: Show that \(E(Y_t) = \theta_0.\)
<IP_ADDRESS>.2 Variance
Question 11: Show that \(Var(Y_t) = \sigma^2 (1+\theta_1^2 + \theta_2^2).\)
<IP_ADDRESS>.3 Autocorrelation function of an MA(2) process
Question 12: For \(MA(2)\) process show that,
\[\rho_1=\frac{\theta_1(1+\theta_2)}{1+\theta_1^2+\theta_2^2},\] \[\rho_2 = \frac{\theta_2}{1+\theta_1^2 + \theta_2^2},\]
and \(\rho_k=0\) for all \(k \geq 3.\)
<IP_ADDRESS> Properties of MA(q) model
\[\begin{equation} \label{eq:ma2} Y_t = \theta_0 + \theta_1 \epsilon_{t-1} + \theta_2 \epsilon_{t-2} +...+ \theta_q \epsilon_{t-q} +\epsilon_t \end{equation}\]
where \(\theta_0\) is a constant and \({\epsilon_t}\) is a white noise series.
<IP_ADDRESS>.1 Mean
Question 13: Show that the constant term of an \(MA\) model is the mean of the series (i.e. \(E(Y_t)=\theta_0\)).
<IP_ADDRESS>.2 Variance
Question 14: Show that the variance of an \(MA\) model is \[Var(Y_t)=(1+\theta_1^2+\theta_2^2+...+\theta_q^2)\sigma^2.\]
<IP_ADDRESS>.3 Autocorrelation function of an MA(q) process
Question 15: Show that the autocorrelation function of a \(MA(q)\) process is zero, beyond the order of \(q\) of the process. In other words, the autocorrelation function of a moving average process has a cutoff after lag \(q\).
<IP_ADDRESS>.4 Partial autocorrelation function of an MA(q) process
The partial autocorrelation functions for \(MA(q)\) models behave very much like the autocorrelation functions of \(AR(p)\) models. The PACF of \(MA\) models decays exponentially to zero, rather like ACF for \(AR\) model.
2.5.3 Dual relation between AR and MA process
Dual relation 1
First we consider the relation AR(p) <–> MA(\(\infty\))
Let \(AR(p)\) be a stationary \(AR\) model with order \(p\). Then,
\[Y_t = \phi_1Y_{t-1}+ \phi_2Y_{t-2}+...+ \phi_pY_{t-p}+\epsilon_t,\]
where \(\epsilon_t \sim WN(0, \sigma^2).\)
Using the backshift operator we can write the \(AR(p)\) model as
\[(1-\phi_1B-\phi_2B^2-...-\phi_pB^P)Y_t=\epsilon_t.\]
Then
\[\phi(B)Y_t=\epsilon_t,\]
where \(\phi(B)=1-\phi_1B-\phi_2B^2-...-\phi_pB^p.\) Furthermore, \(Y_t\) can be written as infinite sum of previous \(\epsilon\)’s as below
\[Y_t = \phi^{-1}(B)\epsilon_t,\]
where \(\phi(B)\psi(B)=1\) and \(\psi(B)=1+\Psi_1B+\psi_2B^2+...\) Then \[Y_t=\psi(B)\epsilon_t.\] This is a representation of \(MA(\infty)\) process.
Next, we consider the relation MA(q) <–> AR(\(\infty\))
Let \(MA(q)\) be invertible moving average process
\[Y_t = \epsilon_t + \theta_t\epsilon_{t-1}+\theta_2\epsilon_{t-2}+...+\theta_p\epsilon_{t-q}.\]
Using the backshift operator we can write the \(MA(q)\) process as
\[Y_t = (1+\theta_1B+\theta_2B^2-...+\theta_qB^q)\epsilon_t.\]
Then,
\[Y_t = \theta(B)\epsilon_t,\]
where \(\theta(B)=1+\theta_1B+\theta_2B^2+...+\theta_1B^q.\) Hence, for an invertible moving average process, \(Y_t\) can be represented as a finite weighted sum of previous error terms, \(\epsilon\). Furthermore, since the process is invertible \(\epsilon_t\) can be represented as an infinite weighted sum of previous \(Y\)’s as below
\[\epsilon_t=\theta^{-1}(B)Y_t,\] where \(\pi(B)\theta(B)=1\), and \(\pi(B) = 1+\pi_1B+\pi B^2+...\). Hence,
\[\epsilon_t = \pi(B)Y_t.\] This is an representation of a \(AR(\infty)\) process.
Dual relation 2
An \(MA(q)\) process has an ACF function that is zero beyond lag \(q\) and its PACF is decays exponentially to 0. Consequently, an \(AR(p)\) process has an PACF that is zero beyond lag-\(p\), but its ACF decays exponentially to 0.
Dual relation 3
For an \(AR(p)\) process the roots of \(\phi(B)=0\) must lie outside the unit circle to satisfy the condition of stationarity. However, the parameters of the \(AR(p)\) are not required to satisfy any conditions to ensure invertibility. Conversely, the parameters of the \(MA\) process are not required to satisfy any condition to ensure stationarity. However, to ensure the condition of invertibility, the roots of \(\theta(B)=0\) must lie outside the unit circle.
2.5.4 Autoregressive and Moving-average (ARMA) models
current value = linear combination of past values + linear combination of past error + current error
The \(ARMA(p, q)\) can be written as
\[Y_t=c+\phi_1 Y_{t-1}+\phi_2 Y_{t-2}+...+\phi_p Y_{t-p}+\theta_1\epsilon_{t-1}+\theta_2\epsilon_{t-2}+...+\theta_q\epsilon_{t-q}+\epsilon_t,\] where \(\{\epsilon_t\}\) is a white noise process.
Using the back shift operator
\[\phi(B)Y_t=\theta(B)\epsilon_t,\] where \(\phi(.)\) and \(\theta(.)\) are the \(p\)th and \(q\)th degree polynomials,
\[\phi(B)=1-\phi_1 \epsilon -...-\phi_p \epsilon^p,\]
and \[\theta(B)=1+\theta_1\epsilon+...+\theta_q\epsilon^q.\]
<IP_ADDRESS> Stationary condition
Roots of \[\phi(B)=0\] lie outside the unit circle.
<IP_ADDRESS> Invertible condition
Roots of \[\theta(B)=0\] lie outside the unit circle.
<IP_ADDRESS> Autocorrelation function and Partial autocorrelation function
The ACF of an ARMA model exhibits a pattern similar to that of an AR model. The PACF of ARMA process behaves like the PACF of a MA process. Hence, the ACF and PACF are not informative in determining the order of an ARMA model.
2.6 Unit root tests
- Many financial time series are with trending behavior or nonstationarity in the mean.
- Two common trend removal or de-trending procedures
- First differencing (appropriate for \(I(1)\) time series).
- time-trend regression (appropriate for trend stationary \(I(0)\) time series).
- Unit root tests are statistical tests to determine the required order of differencing or whether it should be regressed on deterministic functions of time to render the data stationary.
2.6.1 Dickey-Fuller test
Consider the model \[\Delta y_t = c+ \beta y_{t-1}+\epsilon_{t}\]
Hypothesis to be tested \(H_0: \beta = 0\) and \(H_1: \beta<0\)
Test statistics = \(\frac{\hat{\beta}}{SE(\hat{\beta})}\)
2.6.2 Augmented Dickey-Fuller test
The Dickey-Fuller Unit Root Test is valid if the time series \(y_t\) is well characterized by an AR(1) model with white noise errors.
Many financial time series have a more complicated dynamic structures
The Augmented Dickey-Fuller (ADF) test allows for higher-order autoregressive processes by including \(\Delta y_{t−p}\) in the model.
The number of lags included in the model should be just sufficient to remove any autocorrelation in errors.
Consider the model: \[\Delta y_t = c+ \beta y_{t-1}+ \alpha_1 \Delta y_{t-1}+\dots + \alpha_p \Delta y_{t-p} +\epsilon_{t}\]
Hypothesis to be tested \(H_0: \beta = 0\) and \(H_1: \beta<0\)
ADF test: null hypothesis is that the data are non-stationary and non-seasonal.
DF and ADF tests are not suitable when there is a deterministic trend
- Alternative tests:
- Phillips-Perron Unit Root Tests
The main difference between Phillips-Perron (PP) unit root tests and the ADF tests is in the way they deal with serial correlation and heteroskedasticity in the errors.
2.6.3 Stationarity Tests
- The ADF unit root test tests the null hypothesis that a time series \(y_t\) is \(I(1)\).
- In contrast, Stationarity tests are for the null that \(y_t\) is \(I(0)\).
- Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test is the most commonly used stationarity test that tests the null hypothesis that the data are stationary and non-seasonal.
- Other tests available for seasonal data
<IP_ADDRESS> Kwiatkowski-Phillips-Schmidt-Shin (KPSS) test
## # A tibble: 1 x 3
## Symbol kpss_stat kpss_pvalue
## <chr> <dbl> <dbl>
## 1 GOOG 0.573 0.0252
## # A tibble: 1 x 3
## Symbol kpss_stat kpss_pvalue
## <chr> <dbl> <dbl>
## 1 GOOG 0.0955 0.1
## # A tibble: 1 x 2
## Symbol ndiffs
## <chr> <int>
## 1 GOOG 1
<IP_ADDRESS> Automatically selecting differences
STL decomposition: \(y_t = T_t+S_t+R_t\)
Seasonal strength \(F_s = \max\big(0, 1-\frac{\text{Var}(R_t)}{\text{Var}(S_t+R_t)}\big)\)
If \(F_s > 0.64\), do one seasonal difference.
usmelec %>% mutate(log_gen = log(Generation)) %>%
features(log_gen, list(unitroot_nsdiffs, feat_stl))
## # A tibble: 1 x 10
## nsdiffs trend_strength seasonal_streng… seasonal_peak_y…
## <int> <dbl> <dbl> <dbl>
## 1 1 0.994 0.941 7
## # … with 6 more variables: seasonal_trough_year <dbl>,
## # spikiness <dbl>, linearity <dbl>, curvature <dbl>,
## # stl_e_acf1 <dbl>, stl_e_acf10 <dbl>
## # A tibble: 1 x 1
## nsdiffs
## <int>
## 1 1
usmelec %>% mutate(d_log_gen = difference(log(Generation), 12)) %>%
features(d_log_gen, unitroot_ndiffs)
## # A tibble: 1 x 1
## ndiffs
## <int>
## 1 1
2.7 ARIMA modelling in R
2.7.1 How does ARIMA() work?
A non-seasonal ARIMA process
\[\phi(B)(1-B)^dy_{t} = c + \theta(B)\varepsilon_t\] Need to select appropriate orders: \(p,q, d\)
Hyndman and Khandakar (JSS, 2008) algorithm:
- Select no. differences \(d\) and \(D\) via KPSS test and seasonal strength measure.
- Select \(p,q\) by minimising AICc.
- Use step-wise search to traverse model space.
\[\text{AICc} = -2 \log(L) + 2(p+q+k+1)\left[1 + \frac{(p+q+k+2)}{T-p-q-k-2}\right].\]
where \(L\) is the maximised likelihood fitted to the differenced data, \(k=1\) if \(c\neq 0\) and \(k=0\) otherwise.
Step1: Select current model (with smallest AICc) from: ARIMA\((2,d,2)\) ARIMA\((0,d,0)\) ARIMA\((1,d,0)\) ARIMA\((0,d,1)\)
Step 2: Consider variations of current model:
- vary one of \(p,q,\) from current model by \(\pm1\);
- \(p,q\) both vary from current model by \(\pm1\);
- Include/exclude \(c\) from current model.
Model with lowest AICc becomes current model.
Repeat Step 2 until no lower AICc can be found.
2.7.2 Choosing your own model
## Series: value
## Model: ARIMA(3,1,0)
##
## Coefficients:
## ar1 ar2 ar3
## 1.151 -0.6612 0.3407
## s.e. 0.095 0.1353 0.0941
##
## sigma^2 estimated as 9.656: log likelihood=-252
## AIC=512 AICc=512.4 BIC=522.4
## Series: value
## Model: ARIMA(1,1,1)
##
## Coefficients:
## ar1 ma1
## 0.6504 0.5256
## s.e. 0.0842 0.0896
##
## sigma^2 estimated as 9.995: log likelihood=-254.2
## AIC=514.3 AICc=514.5 BIC=522.1
## Series: value
## Model: ARIMA(3,1,0)
##
## Coefficients:
## ar1 ar2 ar3
## 1.151 -0.6612 0.3407
## s.e. 0.095 0.1353 0.0941
##
## sigma^2 estimated as 9.656: log likelihood=-252
## AIC=512 AICc=512.4 BIC=522.4
## # A tibble: 1 x 3
## .model lb_stat lb_pvalue
## <chr> <dbl> <dbl>
## 1 arima 4.49 0.722
2.7.3 Modelling procedure with ARIMA()
- Plot the data. Identify any unusual observations.
- If necessary, transform the data (using a Box-Cox transformation) to stabilize the variance.
- If the data are non-stationary: take first differences of the data until the data are stationary.
- Examine the ACF/PACF: Is an AR(\(p\)) or MA(\(q\)) model appropriate?
- Try your chosen model(s), and use the \(AICc\) to search for a better model.
- Check the residuals from your chosen model by plotting the ACF of the residuals, and doing a portmanteau test of the residuals. If they do not look like white noise, try a modified model.
- Once the residuals look like white noise, calculate forecasts.
2.7.4 Automatic modelling procedure with ARIMA()
- Plot the data. Identify any unusual observations.
- If necessary, transform the data (using a Box-Cox transformation) to stabilize the variance.
- Use
ARIMA
to automatically select a model.
- Check the residuals from your chosen model by plotting the ACF of the residuals, and doing a portmanteau test of the residuals. If they do not look like white noise, try a modified model.
- Once the residuals look like white noise, calculate forecasts.
2.7.5 Example in R
Seasonally adjusted electrical equipment
elecequip <- as_tsibble(fpp2::elecequip)
dcmp <- elecequip %>%
model(STL(value ~ season(window = "periodic"))) %>%
components() %>% select(-.model)
dcmp %>% as_tsibble %>%
autoplot(season_adjust) + xlab("Year") +
ylab("Seasonally adjusted new orders index")
## Series: season_adjust
## Model: ARIMA(3,1,0)
##
## Coefficients:
## ar1 ar2 ar3
## -0.3418 -0.0426 0.3185
## s.e. 0.0681 0.0725 0.0682
##
## sigma^2 estimated as 9.639: log likelihood=-493.8
## AIC=995.6 AICc=995.8 BIC=1009
## Series: season_adjust
## Model: ARIMA(3,1,1)
##
## Coefficients:
## ar1 ar2 ar3 ma1
## 0.0044 0.0916 0.3698 -0.3921
## s.e. 0.2201 0.0984 0.0669 0.2426
##
## sigma^2 estimated as 9.577: log likelihood=-492.7
## AIC=995.4 AICc=995.7 BIC=1012
## # A tibble: 1 x 3
## .model lb_stat lb_pvalue
## <chr> <dbl> <dbl>
## 1 arima 24.0 0.241
2.8 Forecasting
2.8.1 Point forecasts
- Rearrange ARIMA equation so \(y_t\) is on LHS.
- Rewrite equation by replacing \(t\) by \(T+h\).
- On RHS, replace future observations by their forecasts, future errors by zero, and past errors by corresponding residuals.
Start with \(h=1\). Repeat for \(h=2,3,\dots\).
Example:
ARIMA(3,1,1) forecasts: Step 1
\[(1-\phi_1B -\phi_2B^2-\phi_3B^3)(1-B) y_t = (1+\theta_1B)\varepsilon_{t},\]
\[[1-(1+\phi_1)B +(\phi_1-\phi_2)B^2 + (\phi_2-\phi_3)B^3 +\phi_3B^4] y_t = (1+\theta_1B)\varepsilon_{t}\]
\[y_t - (1+\phi_1)y_{t-1} +(\phi_1-\phi_2)y_{t-2} + (\phi_2-\phi_3)y_{t-3} \mbox{}+\phi_3y_{t-4} = \varepsilon_t+\theta_1\varepsilon_{t-1}.\]
\[y_t = (1+\phi_1)y_{t-1} -(\phi_1-\phi_2)y_{t-2} - (\phi_2-\phi_3)y_{t-3}\\\mbox{} -\phi_3y_{t-4} + \varepsilon_t+\theta_1\varepsilon_{t-1}.\]
<IP_ADDRESS> Point forecasts (h=1)
\[y_t = (1+\phi_1)y_{t-1} -(\phi_1-\phi_2)y_{t-2} - (\phi_2-\phi_3)y_{t-3}\\\mbox{} -\phi_3y_{t-4} + \varepsilon_t+\theta_1\varepsilon_{t-1}.\]
ARIMA(3,1,1) forecasts: Step 2
\[y_{T+1} = (1+\phi_1)y_{T} -(\phi_1-\phi_2)y_{T-1} - (\phi_2-\phi_3)y_{T-2}\\\mbox{} -\phi_3y_{T-3} + \varepsilon_{T+1}+\theta_1\varepsilon_{T}.\]
ARIMA(3,1,1) forecasts: Step 3
\[\hat{y}_{T+1|T} = (1+\phi_1)y_{T} -(\phi_1-\phi_2)y_{T-1} - (\phi_2-\phi_3)y_{T-2}\\\mbox{} -\phi_3y_{T-3} + \theta_1 e_{T}.\]
<IP_ADDRESS> Point forecasts (h=2)
\[y_t = (1+\phi_1)y_{t-1} -(\phi_1-\phi_2)y_{t-2} - (\phi_2-\phi_3)y_{t-3}\\\mbox{} -\phi_3y_{t-4} + \varepsilon_t+\theta_1\varepsilon_{t-1}.\]
ARIMA(3,1,1) forecasts: Step 2
\[y_{T+2} = (1+\phi_1)y_{T+1} -(\phi_1-\phi_2)y_{T} - (\phi_2-\phi_3)y_{T-1}\\\mbox{} -\phi_3y_{T-2} + \varepsilon_{T+2}+\theta_1\varepsilon_{T+1}.\]
ARIMA(3,1,1) forecasts: Step 3
\[\hat{y}_{T+2|T} = (1+\phi_1)\hat{y}_{T+1|T} -(\phi_1-\phi_2)y_{T} - (\phi_2-\phi_3)y_{T-1}\\\mbox{} -\phi_3y_{T-2}.\]
2.8.2 Prediction intervals
95% prediction interval \[\hat{y}_{T+h|T} \pm 1.96\sqrt{v_{T+h|T}}\]
where \(v_{T+h|T}\) is estimated forecast variance.
- \(v_{T+1|T}=\hat{\sigma}^2\) for all ARIMA models regardless of parameters and orders.
- Multi-step prediction intervals for \(ARIMA(0,0,q)\)):
\[y_t = \varepsilon_t + \sum_{i=1}^q \theta_i \varepsilon_{t-i}.\]
\[\hat{\sigma}_h = \hat{\sigma}^2 \left[ 1 + \sum_{i=1}^{h-1} \theta_i^2\right], \qquad\text{for~} h=2,3,\dots.\]
- AR(1): Rewrite as MA(\(\infty\)) and use above result.
- Other models beyond scope of this subject.
- Prediction intervals increase in size with forecast horizon.
- Prediction intervals can be difficult to calculate by hand
- Calculations assume residuals are uncorrelated and normally distributed.
- Prediction intervals tend to be too narrow.
- the uncertainty in the parameter estimates has not been accounted for.
- the ARIMA model assumes historical patterns will not change during the forecast period.
- the ARIMA model assumes uncorrelated future errors.
2.9 References:
Brockwell, P. J., Brockwell, P. J., Davis, R. A., & Davis, R. A. (2016). Introduction to time series and forecasting. springer.
Hyndman, R. J., & Athanasopoulos, G. (2018). Forecasting: principles and practice. OTexts.
Zivot, E., & Wang, J. (2006). Unit root tests. Modeling Financial Time Series with S-PLUS®, 111-139.
References
Brockwell, Peter J, Peter J Brockwell, Richard A Davis, and Richard A Davis. 2016. Introduction to Time Series and Forecasting. Springer.


Provides classes and interfaces specific to the core MEKON mechanisms, and the mechanisms of any extensions of the MEKON framework.


2019 Cinquante Cinq ViognierViognier from France
$9.87
List Price: $13.99
You're saving $4.12!
A really classic Viognier that has a ton of fruit and a light but satisfying finish. ...
$9.87
List Price: $13.99
You're saving $4.12!
A really classic Viognier that has a ton of fruit and a light but satisfying finish. ...


Search
Options
Search title only
Boost title
Search as you type
Show recent articles only
Seed
Seed articles
Results
Article name
Article body
Publish date


April 7
Now upon the first day of the week, very early in the morning, they came unto the sepulchre, bringing the spices which they had prepared, and certain others with them. And they found the stone rolled away from the sepulchre. And they entered in, and found not the body of the Lord Jesus.
Luke 24:1-3
Truly, it's time for us to stop looking for the living among the dead. It's time for us to stop wandering around in the cemetery of sin, sickness and failure and to step into resurrection life! As a resurrected creature, you're no accident going somewhere to happen. Your life isn't just a loose web of events and circumstances. God has specific plans for you.
Maybe He intends for you to have the greatest healing ministry of this century. Or perhaps He wants to turn you into a tremendous preacher. Maybe He has a revelation prepared for you that will enable you to bless the whole world. But you'll never know what He has in store for you until you put your attention on Him.
That's why the devil works hard to keep you focusing on the problems of life.
That's why he tries to keep your attention turned away from the living Word of God.  In fact, the prospect of it terrifies him.
Why?  You'll lay hands on the sick and they'll recover. You'll cast out demons. You'll preach the gospel to every creature. In short, you'll be just what God intended you to be. You'll be the Body of Christ on the earth.
Don't let Satan bind you with the grave clothes of yesterday's sin and defeat. You're not dead anymore. You've been raised with Jesus. Come out from the tombs and start living resurrection life!
Scripture Reading: Acts 17:16-34


Feel free to remix, copy, distribute and transmit this template. Just know that you must attribute the work in the manner specified by me. Please see the license. Also, if you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. All I ask is that you keep the credit links in the footer intact.
This is how it looks if you use pre
and code
together, for example to highlight and nicely markup a piece of code:
pre {
font-size : 12px;
background : #F0F0F0;
}
If you want to quote somebody, you can use this perfectly semantic example for a blockquote:
Jean-Luc PicardWith the first link, the chain is forged. The first speech censored, the first thought forbidden, the first freedom denied, chains us all irrevocably.
These sample styles for alerts and notices are useful if you want to use the template in content management systems.
Alert: This is how an alert looks like.
Notice: This is how a notice looks like.
Confirmation: This is how a confirmation looks like.
The following is the design for a table. The style is simple and user-friendly. Some of the effects were made with CSS3.
| Tag | Info | Attributes |
|---|---|---|
| <abbr> | abbreviation | global attributes** |
| <area> | in an image map | alt, coords, href, hreflang, media, ping, rel, shape, target, type |
| <article> | article/ content | global attributes** |
| <aside> | sidebar | global attributes** |
| <audio> | sound content | autobuffer, autoplay, controls, loop, src |
| <b> | bold text | global attributes** |
The following is a definition list in combination with the hCalendar microformat.
You can put your Video-Files here...
You can put your Audio-Files here...
Two different kinds of lists were styled: Ordered lists (ol) and unordered (ul) lists.
This is how a form will look like in this template.


Basic Functionality
The filtering extension displays a row of search boxes
below the column headers. Entering a text into a search box will filter rows based on whether they match the search
term in that column.
Search terms are interpreted as follows.
- Iff the search term contains no upper case letters, a case insensitive search is performed.
- An asterisk (*) matches any substring.
-
A search term containing no asterisks implies
- a substring search and
- a loose "hump search" (CR is matched by "Czech Republic" and "Costa Rica").
Example: Countries and dependencies by population
- Source
-
Wikipedia