Hi All:
I have a problem where I have a (balanced) panel data set, and each cross-sectional unit in the data set comes with two neighbors, contained in the variables nb1 and nb2 (although some neighbor values are missing). I'd like to put the values of some of the neighbors' covariates on the proper line so I can include them in regression analysis. I know how to do this without a panel structure, and I found a recent helpful entry by Nick Cox that confirms what I thought. But I'm stuck for the panel data case.
The identities of the neighbors do not change over time.
The first block below gives a simple example of the structure, and the second block gives what I would like to have. I'd really appreciate any hints. Thanks, Jeff.
I have a problem where I have a (balanced) panel data set, and each cross-sectional unit in the data set comes with two neighbors, contained in the variables nb1 and nb2 (although some neighbor values are missing). I'd like to put the values of some of the neighbors' covariates on the proper line so I can include them in regression analysis. I know how to do this without a panel structure, and I found a recent helpful entry by Nick Cox that confirms what I thought. But I'm stuck for the panel data case.
The identities of the neighbors do not change over time.
The first block below gives a simple example of the structure, and the second block gives what I would like to have. I'd really appreciate any hints. Thanks, Jeff.
Code:
id year nb1 nb2 x 1 2000 2 3 100 1 2001 2 3 110 1 2002 2 3 120 2 2000 1 4 200 2 2001 1 4 210 2 2002 1 4 220 3 2000 4 . 300 3 2001 4 . 310 3 2002 4 . 320 4 2000 3 2 400 4 2001 3 2 410 4 2002 3 2 420 id year nb1 nb2 x x_nb1 x_nb2 1 2000 2 3 100 200 300 1 2001 2 3 110 210 310 1 2002 2 3 120 220 320 2 2000 1 4 200 100 400 2 2001 1 4 210 110 410 2 2002 1 4 220 120 420 3 2000 4 . 300 400 . 3 2001 4 . 310 410 . 3 2002 4 . 320 420 . 4 2000 3 2 400 300 200 4 2001 3 2 410 310 210 4 2002 3 2 420 320 220
Comment