# Time-invariant variables not being removed in Fixed Effects model. And feasibility of addional time dummies in Fixed Effect/Random modelling

I am working with severely unbalanced Panel Data of a nations Fisheries where I have individual data from all deliveries made by every single vessel. Thus far I have reshaped the data so that every observation amounts to a single delivery by a single vessel on a single day. The reason I think they are unbalanced is that every time period consists of different vessels as they're not landing fish every day.

In Stata I use xtset to define the individual vessels as my panels and use days as my time variable as they in certain periods will deliver as often as every day.

Seeing as I want to control for the vessels characteristics to explain my dependent variables(weight landed and quality on weight landed) I am using time invariant variables such as vessel length and engine power, in addition to a lot of time-varying variables.

Based on what I read I thought this meant that I had to use a Random Effects model in order for the time-invariant variables within panels not to be removed, but when running a Fixed effects regression Stata keeps all the variables. This leads me to think I might have specified the model wrongfully?

Running a Hausman test on the two regressions gives a large but negative chi-square statistic.

Additionally I'd like to control for differences in seasons, which I have done by adding quarterly dummies, and also differences in years by adding yearly dummies for the eight year period. These come out as statistically significant and plausible based on what I know about the fisheries. However, I am wondering if adding yearly/quarterly dummies is wrong as the Xtset command have already defined time dummies for each day?

Any input would be greatly appreciated. I have also included my lines of code below. The reason for included the clustering is heteroskedasticity.

xtset fartyid landingsdato_ny
xtreg ln_r_prisperkg_Frst_102202 Dflere_mottak_tur i.landingsfylkekode i.kvartiler_ny markedsk_torsk gjenv_TAC_NØtorsk_år_prct lalder_fartøy i.fangstr r_minst_Frst_torsk gjenv_kvote_NØtorsk_fartøy_prct i.lengde_gruppering mobilitet, re vce(cluster fartyid)
xtreg ln_r_prisperkg_Frst_102202 Dflere_mottak_tur i.landingsfylkekode i.kvartiler_ny markedsk_torsk gjenv_TAC_NØtorsk_år_prct lalder_fartøy i.fangstr r_minst_Frst_torsk gjenv_kvote_NØtorsk_fartøy_prct i.lengde_gruppering mobilitet, fe vce(cluster fartyid)

• You say observations are boat-delivery-day, but did xtset for just boat-day, that leaves out delivery. Can you have more than 1 delivery per boat-day, or is boat-delivery-day=boat-day? Also, xtset just tells Stata how the data are set up, it doesn't add any dummies in. – robin.datadrivers Dec 5 '14 at 14:07
• Sorry if that wasn't clear. There's never more than one delivery in a day so boat-delivery-day=boat-day holds. And thanks for the specification, that helps a lot! – August Schirmer Dec 5 '14 at 14:26
• I'm not sure your desire to include time-invariant variables should be the only reason to select a random effects model. There are other important differences between the two models that should go into your decision process (including the Hausman test, but there are theoretical ones as well). – robin.datadrivers Dec 5 '14 at 14:50

Having an unbalanced panel is not a problem nowadays. In the past, when econometrics had to be done by hand, inverting matrices for unbalanced panels was more difficult but for computers this is not a problem. The only worry connected today with this is the question why the panel is unbalanced: is it due to attrition? If yes, is this attrition random or related to characteristics of the statistical units? For instance, in surveys people with higher education tend to be more responsive and stay in the panel longer for that reason.

Regarding the fixed effects model, have you checked whether the variables that are time-invariant in theory are actual not varying over time? Sometimes coding errors sneak in and then all the sudden a variable varies over time when it shouldn't. One way of checking this is to use the xtsum command which displays overall, between, and within summary statistics. The time-invariant variables should have a zero within standard deviation. If they don't then something went wrong in the coding.

Having a negative Hausman test statistics is a bad thing because the matrices that the test is built on are positive semi-definite and therefore the theoretical values of the test are positive. Negative values point towards model misspecification or a too small sample (related to this is this question).

If you cluster your standard errors you also need a modified version of the Hausman test. This is implemented in the xtoverid command. You can use it like this:

xtreg ln_r_prisperkg_Frst_102202 Dflere_mottak_tur i.landingsfylkekode i.kvartiler_ny markedsk_torsk gjenv_TAC_NØtorsk_år_prct lalder_fartøy i.fangstr r_minst_Frst_torsk gjenv_kvote_NØtorsk_fartøy_prct i.lengde_gruppering mobilitet, fe vce(cluster fartyid)
xtoverid


Rejecting the null rejects the validity of the assumptions underlying the random effects mode.

The xtset command only takes into account the unit id for fixed effects estimation. The time variable does not eliminate time fixed effects. So if you do

xtset id time
xtreg y x, fe


will give you the exact same results as

xtset id
xtreg y x, fe


The time variable is only specified for commands for which the sorting order of the data matters, for instance xtserial which tests for panel autocorrelation requires this. This has been discussed here. So if you want to include time fixed effects, you need to include the day dummies separately via i.day, for example. In this context, the season and year dummies make sense so it's good that you use them.

• As a follow-up to Andy's point about time invariant variables not actually being time invariant, even if you have one observation where it varies Stata will treat the entire variable as such. Definitely dig into your data to clean it up before running your xtregs. – robin.datadrivers Dec 5 '14 at 14:49
• Thanks for the elaborate answer, Andy! Regarding time-invariant variables: The variables are only invariant within panels(boats), not for the entire set as boats differ in their characteristics, but this should be enough for them to be omitted as time-demeaning happens within panels? However it’s likely that boats are improved upon over the period, which will break the invariance. The same goes for sloppy documentation, which has mostly been done by hand for my 5,000,000 observations. As far as I can gather only one such break would mean that the variable is not omitted? – August Schirmer Dec 5 '14 at 15:12
• This also makes me wonder can I now make inferences about these variables from an FE-regression eventhough the variation in them is mininal? – August Schirmer Dec 5 '14 at 15:13
• As long as a variable is not time-varying within a panel the FE estimator will cancel it. If boats' characteristics are improved in one way or another, then this is not a time-invariant characteristic. – Andy Dec 5 '14 at 21:37

Andy brings up the reason for the imbalance. This isn't your original question, but it may be something you need to consider. From your description it looks like the imbalance is part of the data generating process (fishing boats coming to port or whatever). I don't know the subject area well enough, but if by weight landed you mean amount of fish, the imbalance may mean there is a selection problem. You don't observe values for a given boat because they didn't catch anything that day. That means if you treat the data as unbalanced, you will actually be misspecifying the process you want to model. If this is the case, you should think about creating a record for these ships and adding in a 0, unless you know they didn't bring any catch because they never left in the first place. If you don't know which is the case, then you may have to consider actually modeling that as well. For example, a zero-inflated Poisson or negative binomial model will model the 0s separate from the counts, treating it as a separate process. A censored model like a Tobit model could be appropriate as well.

• The boats are not landing every day as they have different capacitites and opereate in different areas, using different tools. Which means that the rate at which they will be filling up their boats differs, which in turn implies that the rate at which they deliver is different. Furthermore, after a long trip they are likely to take days off. Attrition and seasonality is also a factor. During the season filling up the boat is likely faster. What you're saying is that this is not imbalance, but something which I should model? I am already controlling for capacity, quota size, tools, etc – August Schirmer Dec 6 '14 at 9:52
• If your interest is in factors related to the amount of fish brought in, then I think you may want to approach it from a broader perspective. You are controlling for capacity of the ships to catch fish, but you are only look at how those factors relate to the amount of fish caught when they catch fish and bring to port. If those factors are also related to whether they a) catch fish at all, or b) whether they take their catch to port, in a way different than how much they catch, you may want to consider modeling that. A ZIP or Tobit may do that (though I'm no expert on those models). – robin.datadrivers Dec 7 '14 at 3:15
• I think you're right. I'll read up on it and report back. Thanks! – August Schirmer Dec 8 '14 at 11:34
• I don't know if you're still following this, but thought I'd update anyways. What I've realised is that if we ignore the time dimension and consider each trip to be independent from the others we could just consider all the trips as one population and run a cross-sectional analysis. Years and quarters would then just be characteristics differing across the population. – August Schirmer Dec 8 '14 at 17:02
• Can you ignore the time component? Have you tested for serial dependence? Would a boats catch today depend on its catch yesterday? If not that may be fine, at the least I would then consider the observations nested within boats. What about seasonality? Aren't there times of year when there are more fish? Changes in the market price? Availability of supplies like gas? Changes in supply from other sources? It seems to me those are global factors that affect all vessels alike, and you will have unobserved heterogeneity among observations sharing the temporal factor if you ignore it. – robin.datadrivers Dec 9 '14 at 14:28