Hello,

I'm struggling to figure out the right setup and model for my data, as this is my first time working with panel data.

My final goal is to test the influence of heteronomy (referring to the level of autonomy an investor has) on patent output of a company the investor invests in.

Setup

In terms of setup, I have the following question: The observations for some of my variables start when a company is founded (e.g. patents), but others only when the company receives an investment (e.g. geographical distance to the investor).
Does that imply that I need to code the variables related to the investment as missing before the investment happened? Coding them as 0 does not seem to make intuitive sense to me. For reference, the variables related to the investment are heteronomy (how autonomous is the investor, measured as binary) and logdeodist (geographical distance between investor and company).

Additionally, I'm wondering whether I need to cut the number of years after the investment happened, so that they are all equal? This seems reasonable, but I'm not sure.

Model

My dependent variable is a count variable (patents) and indicates overdispersion, hence I assume a negative binomial model is the right approach here. So far, I've used the following code:

Code:
xtset id year
xtgee patents heteronomy geodistancelog portfolio_size investorage,f(nb)
However, I'm not sure whether this is correct. Heteronomy is a fixed-effect variable, meaning that it does not change over the course of the panel - if this is relevant.

Would be great if someone could give me some advice. Thanks in advance!



I have also attached a dataex:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input int id float year int investmentyear byte(patents heteronomy) float(geodistancelog portfolio_size priorpatents investorage lengthinvestment)
1 1999 2004  0 1        .   0  .  10  .
1 2000 2004  0 1        .   0  3  11  .
1 2001 2004  0 1        .   0  0  12  .
1 2002 2004  0 1        .   0  2  13  .
1 2003 2004  0 1        .   0  0  14  .
1 2004 2004  0 1 9.161939   4  0  15  0
1 2005 2004  0 1 9.161939   4  3  16  1
1 2006 2004  0 1 9.161939   6  2  17  2
1 2007 2004  0 1 9.161939  10  2  18  3
1 2008 2004  0 1 9.161939  11  3  19  4
1 2009 2004  0 1 9.161939  14  2  20  5
1 2010 2004  0 1 9.161939  15  0  21  6
1 2011 2004  1 1 9.161939  17  3  22  7
1 2012 2004  0 1 9.161939  20  0  23  8
1 2013 2004  1 1 9.161939  23  0  24  9
1 2014 2004  0 1 9.161939  24  0  25 10
1 2015 2004  0 1 9.161939  29  0  26 11
1 2016 2004  0 1 9.161939  35  0  27 12
1 2017 2004  0 1 9.161939  36  2  28 13
1 2018 2004  0 1 9.161939  41  0  29 14
1 2019 2004  0 1 9.161939  45  2  30 15
2 1999 2003  0 0        .   5  .   3  .
2 2000 2003  0 0        .   8  2   4  .
2 2001 2003  0 0        .  18  3   5  .
2 2002 2003  0 0        .  24  2   6  .
2 2003 2003  0 0 9.161939  31  0   7  0
2 2004 2003  0 0 9.161939  35  0   8  1
2 2005 2003  0 0 9.161939  37  3   9  2
2 2006 2003  0 0 9.161939  41  1  10  3
2 2007 2003  0 0 9.161939  51  2  11  4
2 2008 2003  0 0 9.161939  59  0  12  5
2 2009 2003  0 0 9.161939  67  0  13  6
2 2010 2003  0 0 9.161939  70  3  14  7
2 2011 2003  1 0 9.161939  72  1  15  8
2 2012 2003  0 0 9.161939  78  0  16  9
2 2013 2003  1 0 9.161939  79  2  17 10
2 2014 2003  0 0 9.161939  84  3  18 11
2 2015 2003  0 0 9.161939  93  2  19 12
2 2016 2003  0 0 9.161939 100  2  20 13
2 2017 2003  0 0 9.161939 106  1  21 14
2 2018 2003  0 0 9.161939 112  2  22 15
2 2019 2003  0 0 9.161939 121  3  23 16
3 1985 2001  0 0        .   0  . -11  .
3 1986 2001  0 0        .   0  0 -10  .
3 1987 2001  0 0        .   0  1  -9  .
3 1988 2001  1 0        .   0 16  -8  .
3 1989 2001  1 0        .   0 11  -7  .
3 1990 2001  1 0        .   0  0  -6  .
3 1991 2001  1 0        .   0 15  -5  .
3 1992 2001  1 0        .   0 28  -4  .
3 1993 2001  1 0        .   0 45  -3  .
3 1994 2001  2 0        .   0 26  -2  .
3 1995 2001  3 0        .   0 33  -1  .
3 1996 2001  3 0        .   0 23   0  .
3 1997 2001  3 0        .   2 12   1  .
3 1998 2001  3 0        .   3 46   2  .
3 1999 2001  1 0        .   5 44   3  .
3 2000 2001  5 0        .   8 17   4  .
3 2001 2001  5 0 8.693225  18 39   5  0
3 2002 2001  4 0 8.693225  24 29   6  1
3 2003 2001 10 0 8.693225  31  1   7  2
3 2004 2001  1 0 8.693225  35 22   8  3
3 2005 2001  1 0 8.693225  37 38   9  4
3 2006 2001  1 0 8.693225  41 37  10  5
3 2007 2001  1 0 8.693225  51 36  11  6
3 2008 2001  0 0 8.693225  59 11  12  7
3 2009 2001  0 0 8.693225  67  1  13  8
3 2010 2001  0 0 8.693225  70 36  14  9
3 2011 2001  0 0 8.693225  72 33  15 10
3 2012 2001  0 0 8.693225  78 49  16 11
3 2013 2001  0 0 8.693225  79  1  17 12
3 2014 2001  0 0 8.693225  84 17  18 13
3 2015 2001  0 0 8.693225  93 11  19 14
3 2016 2001  0 0 8.693225 100 29  20 15
3 2017 2001  0 0 8.693225 106 46  21 16
3 2018 2001  0 0 8.693225 112  0  22 17
3 2019 2001  0 0 8.693225 121 15  23 18
5 1991 2001  0 1        .   0  . 103  .
5 1992 2001  0 1        .   0 11 104  .
5 1993 2001  0 1        .   0  2 105  .
5 1994 2001  0 1        .   0 11 106  .
5 1995 2001  0 1        .   0 11 107  .
5 1996 2001  0 1        .   2 11 108  .
5 1997 2001  0 1        .   4  2 109  .
5 1998 2001  0 1        .   5  2 110  .
5 1999 2001  0 1        .   6  7 111  .
5 2000 2001  0 1        .   7 11 112  .
5 2001 2001  0 1 7.296291   8 16 113  0
5 2002 2001  1 1 7.296291   8 13 114  1
5 2003 2001  0 1 7.296291   9 16 115  2
5 2004 2001  2 1 7.296291   9 11 116  3
5 2005 2001  0 1 7.296291  11 11 117  4
5 2006 2001  0 1 7.296291  11 11 118  5
5 2007 2001  0 1 7.296291  12 11 119  6
5 2008 2001  0 1 7.296291  12 11 120  7
5 2009 2001  0 1 7.296291  13 13 121  8
5 2010 2001  3 1 7.296291  15  4 122  9
5 2011 2001  0 1 7.296291  15 11 123 10
5 2012 2001  1 1 7.296291  15  0 124 11
5 2013 2001  2 1 7.296291  15 14 125 12
end