# delimit ;
* Code for estimating exercise 5: analysis of consumer choices between two
brands of ketchup;
use "C:\Users\AutoLogon\Desktop\chapter4_probit.dta",clear;
log using "C:\Users\AutoLogon\Desktop\exercise5.log", replace;
* Construction of the relative price variable and estimation of the probit model;
generate lrp_heinz = ln(priceheinz/pricehunts);
probit heinz lrp_heinz displheinz displhunts
featheinz feathunts featdisplheinz featdisplhunts, vce(robust);
* We observe that an increase in the relative price of Heinz decreases
the probability of buying this product (Prob Y=1). This probably happens because consumers substitute Heinz for Hunts, since the latter has become relatively more cheap.
The three marketing strategies adopted by Hunts have a negative impact on the probability of buying the rival brand Heinz (coefficients are negative and significant). This means that the three strategies are
effective in gaining market share over Heinz.
On the other hand, the only strategy for Heinz that seems effective in increasing the probability that consumers buy the brand is "display". Announcing the brand in the publicity chart and making both actions are not significant for increasing the probability of buying Heinz.
We should remark that we can only intepret the sign of the coefficients in logit and probit models. A positive (negative) sign means that a variation in the explanatory variable increases (decreases) the
probability of buying Y=1. We cannot tell anything about the magnitude of the marginal effect from the observed coefficients.;
* In order to assess the magnitude of the marginal, we use the command mfx;
mfx;
* We observe that a 1% increase in the relative price of Heinz is associated to a reduction of 24 percentage points in the probability of buying Heinz. This high sensitivity to price changes is probably due to
the market structure. The ketchup market has a monopolistic competition structure: products are differentiated but with a high degree of substitution. This means that consumers are very responsive to price changes.
Regarding marketing strategy effectiveness, we see that displaying brand Heinz is associated to a 1.69 percentage point increase in the probability of buying the brand. The other strategies for Heinz are not statistically significant (at a 5% significance level) so the firm should not undertake them. For Hunts, undertaking each strategy in an isolated form is not effective for decreasing the probability of buying the rival brand (at 5% significance level). But if Hunts does both strategies at the same time, the probability of buying Heinz decreases by 18.3 percentage points.;
* LetÂ´s re-estimate the model by the logit method.;
logit heinz lrp_heinz displheinz displhunts
featheinz feathunts featdisplheinz featdisplhunts, vce(robust);
mfx;
* Comparing the marginal effects of the probit and logit models, we
observe they are quite similar. The coefficients conserve the same
sign and marginal effects have similar magnitudes.
In practice, there is not a strict preference regarding which model to choose. From the analytical standpoint, logit model are more recommended if consumer (unobserved) tastes are more heterogeneous, since the logit distribution has thicker tails compared to the normal one.;
* Computing the probability of buying Heinz estimated by our logit model;
predict probheinz, pr;
correlate heinz probheinz;
* We observe a positive correlation between the decision to buy Heinz and the probability estimated by our model: higher values of Heinz (Y=1) are associated to higher estimated probabilities of buying Heinz.
However, we have a more formal way to validate the prediction capacity of our model. We will construct a hit rate table.;
* Construction of the hit rate table.
Model classification rule: the model will choose the Y value with the highest probability
If probheinz > 0.5 => model classifies as Y = 1 (i.e., model predicts "buy Heinz")
If probheinz < 0.5 => model classifies as Y = 0 (i.e., model predicts "buy Hunts") ;
estat class;
log close ;