 Hello again. So in this second presentation we are going to look at some worked examples of a modelling fixed and random effects and data. So we'll look at a specific example and we'll talk through the interpretation of fixed and random effects and then we'll look at some more advanced options. So to do this we will need some data and this slide shows a table of data that has been adapted from an example from DRAB, HFS and SCRONDAW 2008 where they modelled wages as the outcome variable. These data have an individual person identifier so this is a variable NR and we can see here that there are 545 unique cases on this variable and this is 545 individuals observed at 4,360 different occasions. So each individual in these data has been observed in eight different occasions and we therefore have a balance panel. The data are from the USA and they control for dummy categories for black ethnicities and also Hispanic ethnicities. In the USA this is often termed as dummies for race. In the UK we probably describe these as dummy variables for ethnicity. The variable experience captures years of experience in the labour market and this is the code EXPER from the table so that's the variable experience. There's a variable that is a dummy variable for marriage so capturing whether an individual is married or not in these data and there is a variable for union which codes whether an individual is a member of a trade union or not. As I mentioned the outcome variable is wages so it's a log of wages in these data and we have a variable that is edged which is years of education beyond the high school level so EDUCT is that variable and there is an additional variable called yearT which is the year from 1980 so these are the data that we would be modelling in our examples. Now this slide indicates the code in STATA for fitting a fixed effect and a random effect model and then undertaking a houseman test to compare the fixed and random effect results. The XT-REG command in STATA can be used to fit both fixed and random effect models and it is also common practice after doing this to compare the models using the houseman test. So RAB, HEF, KEF and SCRUNDAL 2008 provide a technical explanation of what the houseman test is undertaking but ALISON 2009 provides a piffy definition of the houseman test explaining that houseman tests the hypothesis that fixed effect coefficients are identical to random effect coefficients. If they are identical then ordinarily we would prefer the random effects model because it also provides correct standard errors. If the coefficients are not identical then we may prefer the fixed effect model because theoretically the coefficients are considered to be unbiased. This table provides modelling results from STATA comparing fixed and random effects models of our data. So in comparing the fixed and random effects it can be seen that the variables black and Hispanic have not been estimated in the fixed effect model they've dropped out of the model so they are time constant or time invariant so they've been excluded by the fixed effect approach which cannot which cannot estimate time and invariant variables. The variable education has also dropped out of the model as this is also time and invariant. UT which has years since 1980 has dropped out the model because it is defined by an individual level constant related to the variable experience. So at this point it may seem that the random effects model is preferential because of the greater possibility estimate to estimate substantively interesting associations. But if we were to compare the individual level covariance for union married and experience between the fixed effect and random effect models we notice that the random effects differ substantially from the fixed effect estimates. So in the fixed effect model we can see that the parameter for union is 0.084 but for the random effect it is 0.111. For the married variable the parameter is 0.061 but in the random effect the equivalent parameter is 0.076. In the fixed effect framework the parameter for experience is 0.06 and in the random effect it is 0.033. So if we accept that the fixed effect estimates are consistent and unbiased then it appears that the random effects model estimates are likely to be biased by correlation with unobserved variables. And indeed this is suggested by the results of the Hausmann test. So this slide shows the output for the Hausmann test in Stata and circled in red is the p-value of significance. And we can see that the p-value here is 0.0165 which is below 0.05. So it's showing that there is a statistically significant difference in the values for the parameters between the fixed effects and the random effects model. Now there are some alternatives and a growing number of alternatives to undertaking fixed and random effects analysis in this way. There's a growing body of work demonstrating the possibility of estimating consistent fixed effects style estimates within a random effects framework. So for example MUNLAC 1978 showed that the inclusion of cluster means for all within individual covariates can enable consistent estimation of within effects in a random effect framework. ALS in 2009 put forward a hybrid model similar to that suggested by MUNLAC using a group mean-sensoring approach. While Bell et al similarly suggest an approach where XIT is divided into two parts each with a separate effect. One part represents the average effect of XIT, the second part represents the average of the average between effect XIT. In these cases an additional parameter is reported in the model output and this represents the time and the effect of the time invariant variables or a between effect. So you get an additional term in your model that represents a between effect and we can take a look at this. So this table here shows the fixed effect and random effects output that we've already seen along with a MUNLAC specification of the model. So we can immediately see that there are two additional parameters MN union and MN married for the cluster means the individual means of the within individual covariates union and married and it can be seen that the MUNLAC estimates for union and married are identical to the fixed effect estimates. So this can be seen within the red boxes. So for example if we look at the fixed effect model the parameter for union is 0.084 and in the MUNLAC specification the parameter for union is also 0.084. In the fixed effect model the parameter for married is 0.061 and in the MUNLAC specification the parameter for married is also 0.061. However the estimate for the variable experience or exper very substantially between the MUNLAC and the fixed effect model. Now in this model experience is an age effect on wages whilst years since 1980 is a period effect so that's what the y e a r t variable. It can be seen that summing these two estimates gives exactly the 0.06 reported in the fixed effect model as the estimate for exper or experience so that's given in the green box here. So in the MUNLAC specification of the model the parameter estimated for experience is 0.08 and the parameter estimated for e r t is 0.032 and if we sum these two together you get exactly the 0.06 that is the estimate for experience or exper in the fixed effect model. So which approach should we choose when we're undertaking fixed and random effect modelling? Well classically in econometrics the preference is for the fixed effect approach and you can read this if you pick up the book Alison 2009. So in there Alison argues that individual level variation is likely to be correlated with the unobserved characteristics of individuals and partially out the contaminated variation produces approximately unbiased estimates so therefore in general terms we prefer a fixed effect approach but by contrast Belling colleagues argue that a well specified random effects model provides everything that a fixed effects model provides and more making this the superior method and that appears to be what we see in this specific example that we've shown today so yeah the MUNLAC model seems to give us everything that the fixed effect model does and more and also has consistent estimates. Some general recommendations so as analysts we probably want to think about what we want to know substantively and we will probably want to ask whether we're interested in the between effects or the within and between effect associations or whether you're interested in time invariant associations and if you're interested in these then probably a fixed effect approach isn't going to get you very far so as analysts it's always worth undertaking a sensitivity analysis and trying out different specific issues of models so trying out a range fixed and random effect approach and also reporting on the alternative methods perhaps an appendix for a paper and ultimately as analysts it's up to us to provide robust and considered explanations for the approach that we've chosen. So here are the references that I've used in this presentation but there's a whole set of other references available in some of the other documentation for the resource and I hope that you've found this resource useful for your work. Thank you.