# delimit ;
* Exercise 3: choice between different models for specifying the dynamics between advertising and sales;
* First we open our dataset and create the .log file where our results
will be registered;
use "C:\Users\AutoLogon\Desktop\palda.dta", clear;
log using "C:\Users\AutoLogon\Desktop\exercise3.log", replace;
* Identification of our time variable and creation of dummies;
tsset year;
generate dum1=0;
replace dum1=1 if tin(1908,1914);
generate dum2=0;
replace dum2=1 if tin(1915,1925);
generate dum3=0;
replace dum3=1 if tin(1926,1940);
* Before estimating the current effects model, letÂ´s investigate the presence of first-order serial correlation in our errors;
* First test: Durbin-Watson statistics;
regress sales adver dum1 dum2 dum3;
estat dwatson;
* Since we have a low DW statistic (DW=1.03), we reject the null hypothesis of absence of serial correlation. DW is very a popular test. However, it has some limitations: (i) it can just assess first-order serial correlation, (ii) it has inconclusive intervals for the DW distribution (DW between 1.2 and 1.6 or DW between 2.4 and 2.8), (iii) DW is only valid if all the explanatory variables are exogenous.;
* Alternatively, we have the Breusch-Godfrey test the circumvent these problems associated to DW;
regress sales adver dum1 dum2 dum3;
estat bgodfrey;
* Since we have a very low p-value, BG test also provides evidence of first-order serial correlation. BG is preferred to DW because do not have inconclusive regions, it is robust for endogenous explanatory variables and it can assess higher order serial correlation Example: suppose we want to estimate for second order serial correlation;
regress sales adver dum1 dum2 dum3;
estat bgodfrey, lag(2);
* The low p-value means that we reject the null hypothesis of absence of second-order serial correlation.;
* Since we have first-order serial correlation, the current effects model should be estimated by a generalized least square method that takes into account the serial correlation structure.
Two generalized least squares estimators are available: the GLS estimator using Prais-Winstein transformation and GLS estimator using the Cochrane-Orcutt transformation. Both provide unbiased and efficient estimators;
prais sales adver dum1 dum2 dum3;
* Note that the estimation of the first-order serial coorelation term (rho = 0.93) is very high. We should also note that, after applying the Prais-Winstein transformation, our model is not plagued with serial correlation anymore (DW for the transformed regression = 1.73, lying between 1.6 and 2.4);
* Second method: Cochrane-Orcutt transformation;
prais sales adver dum1 dum2 dum3, corc;
* We observe that both methods provide very similar results. In practice, which method should you choose? CO provides more precise estimates for the standard errors of the regressors. However, we will loose one observation with the CO transformation (it requires additional lagged variables). So, if you are working with a large sample, you should apply the CO transformation. But if you are working with a small sample, you should favor PW so that you do not loose observations.;
* Comments on the estimated coefficients: one additional dollar in advertising expenditures increase sales in approximately USD 0.65. Since variable dum3 was negative and significant, we conclude that sales were lower for the 1926-1940 when compared to the 1941-1960 period (the basis
period for our dummies);
* Implementing the Griliches test, which allows us to choose between
the lingering effects and the current effects model.;
* First, we run the transformed current effects regression (check in slide 8 of class notes) by OLS without imposing restrictions on the
coefficients;
regress sales l.sales adver l.adver dum1 dum2 dum3;
* Necessary condition to validate the lingering effects model.
- coefficient related to lagged advertising should not be statiscally
significant (i.e., we should not reject the hypothesis that the
coefficient is zero)
Since the coefficient associated to l.adver is significant at a 5%
significance level (p-value < 0.05), we have evidence against the
lingering effects model.;
* Conditions to validate the current effects model
- first criteria: coefficients associated to the three explanatory variables should be significant. This is verified in our case.
- second criteria: coefficient of lagged advertising should be (-1)X the product of the coefficients of lagged sales and current advertising.
This second criteria can be verified by conducting a nonlinear
statistical test;
testnl _b[l.adver]=-1*_b[adver]*_b[l.sales];
* Since we have a high p-value (0.46), we do not reject the null hypothesis. Since both criteria are verified, we have empirical evidence in favor of the current effects model;
* Limitation of the Griliches test: sometimes it may happen that
the test does not provide guidance on the most adequate model.
For example, suppose that you have a significant value for the
lagged advertising coefficient and you also reject the nonlinear hypothesis. In this case, you do not validate anyone of our two models. This inconclusive recommendation occurs because Griliches test is non-nested.;
* Second test to model selection: the brand loyalty model.
The brand loyalty model provides a more general test than Griliches, since both the current effects and the ligering effects may be seen as particular cases of this more general specification.
Since the error of the brand loyalty model follow a AR(1) structure, we should choose a GLS estimator (PW or CO). Here we choose CO.;
prais sales adver l.sales, corc;
* Since the coefficient on the lagged sales is statistically significant, we have evidence against the current effects model. By looking at the very low DW statistic of the original model, we reject the hypothesis of absence of serial correlation. This is evidence against the lingering effects model. So, the most adequate model to represent the dynamics of our advertising efforts is the brand loyalty
model.;
log close ;