 Hello folks, in this final presentation here, I'm just going to talk through a do file that has been created to compare a set of models and to enable us to compare fixed and random effects models. So you can see here we've got a fully annotated syntax file and this syntax file produces a set of models that relate to the document that I've produced for this ncrm resource on fixed and random effects models. So this file produces all of the models and tables that are available in that written resource that you can read alongside the presentations. So we can see at the top of the file here we have this instruction stop, now that isn't a command, this is just a failsafe in case I accidentally hit the wrong command and tell stata to run the whole file while this will prevent that. So that's not a command and it won't run. So the third thing I'm going to do here is clear the memory and its data. Then I'm going to open up the data that we use for the analysis. So this just opens straight from the web, so I'll run that file command and the data should be open now so we can take a look and see if there's any data there and we can see that there's a variable byte case matrix that's been populated with the set of data that we will take a look at. So that's good news. Now this example is an expansion of an example that was presented in Rab Perkes and Scroondyle 2008 and in that book and in their example they were looking at some interesting age, period and cohort effects so these first commands just reproduce the variables that were included in their analysis so I'll run those commands to produce those variables. Now although they were interested in age, period and cohort effects we are not really interested in this resource and disentangling age, period and cohort effects. We are more interested in comparing fixed and random effects models so we're not really particularly interested in the results for those variables beyond how they compare between fixed and random effects models. So this next line of command will just keep the variables that we're going to analyze so I'll just run that to keep those variables and get rid of all of the rest of the variables in the data. So we can take a look at the data that we have for our analysis and if I run this codebook command this produces table three from the document resource and this is a table that I talked through in the previous presentation and we can also use some of the XT suite of commands to take a look at the panel data structure of these data. So there are 545 individual cases in this data and they are measured at 4,360 different occasions and we can see from this but each of the individuals have been measured on eight occasions so there's a balanced panel. Every individual has been measured at each occasion when they were observed so some of them in some data might be missing not everyone might be measured at every single occasion but in this case all the cases are measured on eight different occasions. So next we go on to estimate a set of models and these models appear in table four of the written document so it begins we begin here by estimating a standard regression model with our variables of interest. The next model is a regression model with clustered standard errors and the next model is a fixed effects model followed by a random effects model and their housement test and we saw this example in the previous presentation and I talked through it at that point. We also estimate here the MUNLAC model that we saw in the presentation and there are a couple of ways where we can specify the MUNLAC so we can ask for the full MUNLAC model or a restricted MUNLAC output so there's often a number of ways that we can visualize and take a look at outputs and status so here's just an example of that for this MUNLAC model and then this command will usefully put all the models side by side so we can take a look take a look at things so we can compare effect sizes and standard errors between for example a fixed effect in MUNLAC model and between the standard OLS models with the fixed and random effects models and again as we saw in the previous presentation a number of the time and variable variants have been omitted omitted by the fixed effect model so we cannot estimate these and we can see the fixed and random effect models gives different effect sizes but the MUNLAC model appears to give effect sizes that are consistent with the fixed effect models we've got we've got these comparisons here that we can make if we were interested in doing these analyses and we can also here compare the results to the fixed and random effects models with the OLS models and you can read more about this in the document that's produced for this resource in addition to these models and also in the document we have an example of Allison's 2009 hybrid model and again there's a couple of ways we can use in Stata to specify this model and produce the output and estimate the model so we can use MUNLAC command and asking for a hybrid so for running that it will give us a hybrid model and we can also use the hybrid command if we install the hybrid package so if you have not got the hybrid package installed in your version of Stata then you might want to run the code here XSC and install XT hybrid and that will enable you enable you to run the XT hybrid model so I'll go ahead and do that this one takes a little bit longer to run sometimes and we'll wait for that to be done but we can see it should be giving us the same results as the MUNLAC command of the hybrid model so we can see the effect size is negative 0.1414 for the covariate black and we can see for the MUNLAC version the estimate and the effect size is exactly the same so this produces set of random effects and fixed effect models that we compare we can compare with one another and we can also compare these to more standard regression model approaches in the final part of the syntax file here this code produces the same models again except it also reads all of the models out to a Word document if you want to take a look at them in a Word document you can do so and it uses the azdoct command to do this so if you have not installed azdoct on your Stata system you might want to run the command ssc install azdoct to do so and then you can run this code to produce this set of model results in a Word document which is a nice nice nice place to look at it so it makes it makes it simpler to take a look at the results so the first the first bit of code here makes a directory now you might want to set this up differently so that the these commands all read out to a specific place in your and on your computer computer system but if you run this command here it will make a directory in your C drive called fe and write and fe re models so it will put that onto your computer system and the next commands will all read out the models that we've just produced and it will read them out to your C drive into that fe re models directory and it will produce an output in there in a Word document with all of the model results so we'll estimate all of the models one after the other and I'll click on the command and we can see we've produced a nice set of model results and this again is a table that's in the document that you can read that is included in this resource so that is that is everything I hope that you found this resource useful and thank you for listening