필터 지우기
필터 지우기

find lagged values of variables

조회 수: 1 (최근 30일)
Fernando
Fernando 2014년 6월 3일
Hi,
I have a matrix of data in which and observation is defined by i (people), j (alternatives), t (time). For each i, j, and t there is a random variable u_{ijt}, and I would like to generate a vector with lagged values of u. So, I have
i=[1 1 1 1 1 1 1 1 2 2 2 2 2]';
j=[1 2 3 1 2 1 2 4 1 2 1 2 4]';
t=[1 1 1 2 2 3 3 3 2 2 3 3 3]';
And I have u=[u_{111} u_{121} u_{131} u_{112} u_{112} u_{122} u_{113} u_{123} u_{143} u_{212} u_{222} u_{213} u_{223} u_{243}]'; where the u_{}'s are, of course, numbers.
Now I want to define the lagged value of u for every i and j, over t. In case the lagged value doesn't exist, as it is the case for j=4 in period 3, then replace by zero.
How can I do this?
Thanks

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by