use "C:\Users\Aki\Documents\stata\crime4.dta" xtset county year ***1. sum statistics for data xtsum crmrte prbarr prbconv prbpris avgsen polpc // the total number of unique counties in the dataset is 90, there are 7 periods covered. Total number of observations is = 630 //all six variables change over time (are time-variant) //The average crimes committed per person is about 0.03, the esimated probability of arrest varies from 0.06 to 2.71, with a mean of 0.3. The estimated probability of conviction is between 0.07 and 37, with a mean of 0.69. //for variables crmrte, prbarr, polpc, t he between std deviation is higher than within std deviation. For variables prbconv, prbpris, avgsen, the between std deviation is smaller than the within std deviation. ***2. running a fixed effects model xtreg crmrte prbarr prbconv prbpris avgsen polpc, fe estimates store fixed //The number of groups is 90, the total number of observations is 630. //out of five variables, three are significant at 1%: prbarr, prbconv, polpc. //the variable avgsen is significant at 5%, and prbpris is not statistically significant. //prbarr, prbconv, prbpris negatively affect the crime rates, while avgsen and polpc positively affect the crime rates. //the signs for avgsen and polpc are not as expected, especially for polpc. You would expect that the larger number of police per capita would lead to higher security and less crimes. //when the number of police per capita increases by 1 person, the crimes committed per person increases on average by 2.08. ***3. random effects model xtreg crmrte prbarr prbconv prbpris avgsen polpc, re estimates store random //prbarr, prbconv, polpc are still significant at 1% //avgsen is still significant only at 5%. and prbpris is not significant // the direction of the effect/relationship, and the problem with unexpected signs for avgsen and polpc is the same as in fixed effects estimation results. ***4.run Hausman test and choose between random and fixed effects hausman fixed random //the Hausman test is not helpful here, because the model fitted on these data fails to meet the asymptotic assumptions of the Hausman test