Stata Exam

advertisement
Stata Exercise (may 2014)
Instructions


Duration 1 hour and 45 minutes
You should deliver a .do file (write down on the do file your matriculation number)
1) generate your dataset following the instructions below:
set seed 12315
set obs 1000+(last 2 numbers of your matriculation number)
generate double x3 = 0.3*rnormal(0)
generate double x2 = 0.5*rnormal(0)
generate double e = rnormal(0)
//if gender is male
generate double u = sqrt((x3^2))*e
// if gender is female
generate double u = sqrt((x3^2+0.5*x2^2))*e
// for all
generate double y=1+ 2*x2+3*x3+ u
1a) compute the conditional mean of y with respect to x2.
1b) compute the conditional variance of y with respect to x2.
1c) can you detect some kind of multicollinearity among the regressors?
2a) is there any form of autocorrelation among the errors?
2b) estimate the model by taking into account the relationship among the errors
2) generate a new dependent variable yy as a dummy variable taking the value of 1 when the
errors |u|>0.5 and 0 otherwise
2a) estimate the model considering yy=1 when an event occurs and zero otherwise by using
as regressors x2 and x3.
2b) estimate the model considering yy=1 when an event occurs and zero otherwise by using
as regressors the constant, x2 and x3.
2c) provide an interpretation of the marginal effects of both models
2d) compare the two models in terms of average prediction of yy.
3) Multinomial logit model:
summ x3
gen z=(x3>=r(mean))
gen choice=z+yy
3a) use descriptive statistics to show the relationship between the dependent variable choice
and the aternative specific regressors
3b) estimate the choice as function of the regressors in the dataset (set 0 the base outcome)
3c) what is the effect of an increase of x2 on the probability of buying the goods?
3d) what happens to the relative choices among goods as x2 increases?
3e) conduct a test for the joint significance of coefficient estimates for x3
3f) compare the predicted probabilities with the observed sample frequencies with and
without the intercept in the model. Comment the results
4) conditional logit model
transform the model in the following way:
gen choice1=choice +1
gen id = _n
expand 3
sort id
by id: gen chosen = choice1 == _n
by id: replace choice1 = _n
4a) estimate the conditional logit model and compare the results with those obtained for the
multinomial logit model
5) panel data set:
5a) transform the previous dataset in the form of a panel data model.
5b) estimate a panel FE model
Download