フィルターのクリア

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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by