0

I have a time series model y(t)= h^T y(t-1) + n(t) where n(t) is a white Gaussian noise that excites and drives the process. y is the output of a linear regression model for t = 1,2,... denoting the number of data points.

Question: If the Correlation matrix is Ryy = E[y(t)*y(t)^T], then is it possible to compute Correlation of the lagged random variables such as

 [E[y(t-1)*y(t-1)']]

In general, these operators and expressions are also found in:

Slide2 mentions the Autocorrelation matrix. In the formula, there is the Expectation operator. So how do I implement the expectation of the product of the lagged random variable with itself and other such expressions without using the inbuilt commands?

I am unable to implement these kind of formulae. Please help.

Thank you for any explanation!

UPDATE: After doing multiple revisions to this Question, it has boiled down to another Question asked Matlab: Calculating Correlation of time series . So, these two Questions have become duplicate.

Here is a sample code

y = randn(10,1);

for t = 1:10
disp(y(t));
end

Expectation_y =  sum(y(1:end))/10 % this give a scalar

Mean_y = mean(y); % This returns 10 values 
Community
  • 1
  • 1
SKM
  • 959
  • 2
  • 19
  • 45
  • It is not clear if you are after an analytic expression, or simply how to calculate the mean of the above expression in Matlab. – bavaza Nov 23 '14 at 06:16
  • I would like to know how to calculate the analytical expression (A) E[y(t)] (B) E[y(t-1)*y(t-1)^T] (c) trace of the inverse of the expression in (B) without using the inbuilt functions of Matlab. – SKM Nov 23 '14 at 06:46
  • it looks like you're describing an autoregressive AR(1) model? https://en.wikipedia.org/wiki/Autoregressive_model – Amro Nov 23 '14 at 11:24
  • @Amro: You are right, it is an AR(1) model but this is just for the sake of an example. The expressions are applicable to ARMA also and in general. So, if t=10 the E[y(9)*y(9)'] will be only a single element. But this is not so otherwise the paper would no have mentioned trace, which is taken for a matrix. I believe my understanding is wrong. Hence, the Question. – SKM Nov 23 '14 at 19:54
  • What is `y(t)`? Is it a single number? Because then doing the transpose does nothing, so you're doing `E[y(t-1)^2]^-1`? – David Nov 23 '14 at 21:29
  • 2
    @SKM: what paper? you are not giving us the whole picture here.. – Amro Nov 23 '14 at 23:20
  • Most of this question, as worded, is related to mathematics/statistics and is off-topic for StackOverflow. Edit it. Also, StackOverflow does not support TeX, so please edit your question to make it readable (use images or, better, code). – horchler Nov 24 '14 at 01:47
  • @horchler: I had asked this question in Cross validate where it went unanswered for several days. I was hen advised to post it here stating that it is related to programming. Hence, I deleted from there. – SKM Nov 24 '14 at 03:03
  • @SKM: Perhaps you didn't ask your question clearly at CrossValidated (it seems much better-suited for there) or tailor it sufficiently to make it on-topic. You need to do that here because, as is, it's even more off-topic (I recommend reading the help section of these sites if you need suggestions). Simply asking "how do I implement" this does not make it a programming question? – horchler Nov 24 '14 at 03:19
  • @horchler: I have deleted most parts so as to keep I on topic and asked the Question http://stats.stackexchange.com/questions/125216/matlab-how-to-calculate-expectaion-for-the-random-variable which is the original Question that I had posted earlier. – SKM Nov 24 '14 at 07:21
  • For a random variable X, the expected value E[X] is the weighted mean value. For your random variable Y with observations y(t), assuming the time steps t are identical, E[y(t)] is simply mean(y(t)) – hbaderts Nov 25 '14 at 08:18
  • @hbaderts: When I invoke the command mean(y(1:end)) where end = 10 (say). This gives 10 scalar values. However, if I write the analytical form which is sum(y(1:end))/10 then I get a single scalar that is the mean. In the similar tone, how would I find the Expectation for lagged variables - doing something like E[y(2:end)*y(2:end)'] ?? – SKM Nov 25 '14 at 08:28
  • I think `mean(y(1:end))` should work. If I try `y=rand(1,10);mean(y)` this gives me a scalar value. Could you run `whos y` and post the output here? – hbaderts Nov 25 '14 at 08:52
  • @hbaderts: Thank you for your effort and time. Please find the updates. – SKM Nov 25 '14 at 09:01
  • This is strange: in my case your samples results in a scalar too. If you explicitly define the dimension along which you need the mean it should work anyways. To achieve that, try `Mean_y = mean(y,1);` – hbaderts Nov 25 '14 at 09:05
  • mean(y,1) works. So, if mean(y,1) == E[y(t)], then how to solve for E[y(t-1)*y(t-1)'] which will give a matrix; E[y(t-1)*w(t-1)'] where y,w are two different time series vector – SKM Nov 25 '14 at 09:17
  • (This is such a morphing question containing 15 edits from the OP - finally duping another question - it is hard to know what version to roll back to. I'll leave it be for now). – halfer Jun 20 '16 at 09:43

1 Answers1

1

You might be confusing the Correlation matrix of a random vector (multivariate random variable), and the autocorrelation matrix of a random process (stochastic process)...

So if your serie is a vector autoregressive model of order 1 (which it seems to be, so h' is your coefficient matrix), then indeed E[y(t-1)*y(t-1)'] makes sense, and is the Correlation matrix of the random vector itself.

Now under the assumption of stationarity, which you can check by checking that the roots x_i of det(I - h'*x) = 0 are outside the unit circle (have modulus greater than 1), then the statistical properties of y[t_1] are equivalent to those of y[t_2] for all t_1, t_2 that are large enough. So in effect:

E[y(t-1)*y(t-1)'] = E[y(t)*y(t)']

If your process is NOT stationary, you're in trouble, since now your correlation matrix depends on the boundary conditions of t_0...

What you might be looking for, however, are expressions like:

E[y(t)*y(t-1)'] = E[(h'*y(t-1) + n(t))*y(t-1)']

But I don't know if there are analytical representations of these in function of E[y(t)*y(t)']... You can research that online, or in the references that your slides provide...

EDIT:

Since the OP has mentioned that this is a simple autoregressive model and not a vector autoregressive model, things are greatly simplified.

For stationary AR(1) models, there are nice analytical representations of the mean, variance and autocovariance (and thus autocorrelation), I'll give them here for the more general model: y(t) = c + h*y(t-1) + n(t)

E[y(t)] = c/(1-h) --> so in your case: 0
Var[y(t)] = Var[n(t)]/(1-h^2) --> this is equal to the E[y(t)y(t)] or E[y(t-1)y(t-1)] that you are looking for
Cov[y(t)y(t-j)] = Var[n(t)]*h^j/(1-h^2)
Corr[y(t)y(t-j)] = h^j --> this is the autocorrelation in function of the timedifference j

You can find all the mathematical derivations for these nicely explained in a reference book, or on the french wikipedia page: here, in the section "Moments d'un processus AR(1)"

It really boils down now to what you are looking for... E[y(t-1)y(t-1)] is simply equal to E[y(t)y(t)] by definition of stationarity, maybe you were really looking for the derivation of E[y(t)y(t-1)], which I will develop here:

 E[y(t)y(t-1)] = E[(h*y(t-1) + n(t))*y(t-1)] = E[(h*y(t-1))*y(t-1)] + E[n(t)*y(t-1)]

Now since n(t) is the white noise in t, it is uncorrelated with y(t-1), so E[n(t)*y(t-1)] = 0, so we have:

E[y(t)y(t-1)] = E[(h*y(t-1))*y(t-1)] = h*E[(y(t-1))*y(t-1)] = h*Var[y(t)] = h*Var[N(t)]/(1-h^2)

Which matches exactly the definition of Cov[y(t)y(t-j)]given above...

Hope this helps.

reverse_engineer
  • 4,239
  • 4
  • 18
  • 27
  • Thank you for your response. COuld you please clarify these points? I am not familiar with what you mean by "vector autoregressive model of order 1". The AR model has 1 variable $y$ & $h$ is only 1 parameter/coefficent. Does this mean vector AR model of order 1? Lastly, the process is stationary. My issue is if one can calculate the correlation for y(t), then surely it must be possible to calculate for y(t-1) or y(t-2) etc. Next, if I were to calculate the correlation matrix for y(t) and y(t-1) where y is the only variable, then will the command be xcorr(y(t),y(t)') and xcorr(y(t-1),y(t-1)')? – SKM Nov 27 '14 at 18:20
  • Ok, I didn't understand that it was a simple AR model (the `h^T` confused me I thought it was a transpose operator), so your model is not a vector autoregressive model, but just an autoregressive model... That makes things really easy actually, I'll amend my answer with relevant information. – reverse_engineer Nov 28 '14 at 07:39
  • @SKM By the way I see I didn't answer your question of calculating your expressions in Matlab without builtins... If you have the vector y of realizations of your AR(1) process, you can just calculate the variance `E[y(t)*y(t)']` with `y'*y/(length(y)-1)` – reverse_engineer Nov 28 '14 at 15:35
  • Thank you once again very much! Can you please clarify few things? Appreciate your effort and time and patience. (1)Could you please state why you have done length(y)-1 ? (why take out 1 element?) (2)In general, say y(t) = [x(t),x(t-1),..,x(t-p)]' where p = 2 (model order) then for stationary process what will y(t-1) be? (3)The derivation of E[y(t)*y(t-1)] really adds lot of knowledge. Hoever, I am interested in the expression E[y(t-1)y(t-1)']. Will I use the command cov(y(t-1),cov(y(t-1)') and follow the same logic as in your answer? – SKM Nov 28 '14 at 18:17
  • 1
    @SKM Hi again, the `length(y)-1` is just to get the sample variance without bias (see chapter 'Sample Variance' in Wikipedia's article about variance for example)... Now if like you say `y(t) = [x(t),x(t-1),..,x(t-p)]'` with p=2 then the process is not an `AR(1)` but `AR(2)` actually... I'll update my answer later today with relevant information... – reverse_engineer Dec 01 '14 at 07:36
  • Thank you for your continued help and time. Will look forward for your answer. Please don't delete the one which you have already posted, it is very informative and these stuff cannot be asked to the course instructor. So, it is useful for record keeping :) – SKM Dec 01 '14 at 07:47
  • @SKM Hi, I wanted to answer the question given the new information, but can you first give me some more info maybe about the model then, so that I'm sure I get the structure: is the vector form then really like this: `[x(t),x(t-1),x(t-2)]' = h'*[x(t-1),x(t-2),x(t-3)]' + [n(t),n(t-1),n(t-2)]'`, and you want the correlation matrix of `y(t-1)`, right? Because this is not the usual form for autoregressive models, and I'm not sure if it will be a valid model since I see redundancy in the equations... – reverse_engineer Dec 02 '14 at 14:08
  • Thank you for re-visiting the problem. The AR model is not like the one you have written. For p =2, we can expand the AR equation as: y(t) = ay(t-1) + by(t-2) + epsilon(t). In vector form it becomes, y(t) = \mathbf{h^T y(t-1)} + epsilon(t) where \mathbf{y(t-1)} = [y(t-1), y(t-2)]^T (T = transpose). Then, I want the correlation matrix or a way to implement E[\mathbf{y(t-1)y(t-1)'}]. – SKM Dec 02 '14 at 21:37