Dear Stata Listers,
I am running BLP model on an aggregated market data, over t= 3990 markets ( interactions of weeks and regions), to estimate market shares for j products across different markets, and using demograhics to capture the consumers' heterogenity. my product cahracterstics are x1= fair trade or not, x2= organic or not, x3= product size in grams, in Addition to Price, and brand dummies.
my data Looks as follow:
input float(s x1 x2 x3 p z d1 d2 d3 d4 d5 d6 d7 x12 x22 x32 x1z x2z x3z x1s x2s x3s) int Market
.009983872 0 0 500 .007252727 .0072385 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.61925 0 1 8500 1
.006143922 0 0 500 .00776 .007816923 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.908461 0 1 8500 1
.0015359804 0 0 500 .00798 .008424444 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 4.212222 0 1 8500 1
.0023039705 0 0 500 .006913333 .006850952 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.425476 0 1 8500 1
.0015359804 0 0 500 .00614 .006663959 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.331979 0 1 8500 1
.0015359804 0 1 500 .00798 .00798 57.55 .075 .075 56.8 .6 2.25 2211.25 0 1 250000 0 .00798 3.99 0 0 8500 1
.0007679902 0 0 500 .0057 .005685 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 2.8425 0 1 8500 1
.0023039705 0 0 500 .00776 .008159524 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 4.079762 0 1 8500 1
.003839951 0 0 500 .00798 .008551429 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 4.2757144 0 1 8500 1
I started by running the model without demograhics, but I face Problems in the convergance, when I run the following code: [CODE][import delimited \\winfs-uni.top.gwdg.de\ahmed12$\Downloads\Mahmoud\data\Da ten_RK_12-16\blpdata.txt, delimiter(space) bindquote(strict) case(preserve) asdouble clear
// destring variables:
destring, replace dpcomma ignore(" ")
encode Product, gen(product)
encode Brand, gen(brand)
// variables preparation:
gen x1= Fair
gen x2= Bio
gen x3= Size
gen s= VolShare
gen p= PriceGr
gen z= PriceIV
gen d1= AgeHead
gen d2= AbiturHead
gen d3= UniHead
gen d4= AgeSR
gen d5= FemaleSR
gen d6= HHSize
gen d7= HHIncome
generate x12=x1^2
generate x22=x2^2
generate x32=x3^2
generate z2=z^2
generate x1z=x1*z
generate x2z=x2*z
generate x3z=x3*z
bysort Market: egen x1s=sum(x1)
bysort Market: egen x2s=sum(x2)
bysort Market: egen x3s=sum(x3)
replace x1s=x1s-x1
replace x2s=x2s-x2
replace x3s=x3s-x3
blp s x1 x2 x3 brand_dummy*, stochastic(x1,x2,x3,p) endog(p=z z2 x12 x22 x32 x1z x2z x3z x1s x2s x3s) markets(Market) draws(200)/CODE]
It takes too much time and does not converge in the end, I got the following message after 50 iterations:[Iteration 44: f(p) = 2769.6874 (not concave)
Iteration 45: f(p) = 2769.6883 (not concave)
Iteration 46: f(p) = 2769.7062 (not concave)
Iteration 47: f(p) = 2769.6931 (not concave)
Iteration 48: f(p) = 2769.6912 (not concave)
Iteration 49: f(p) = 2769.6888 (not concave)
Iteration 50: f(p) = 2769.6968 (not concave)
convergence not achieved
Warning: variance matrix is nonsymmetric or highly singular]
the table of results looked as follows:
-------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
Mean utility |
cons | .8228627 . . . . .
x1 | .3926909 . . . . .
x2 | .070797 . . . . .
x3 | .0017025 . . . . .
brand_dummy1 | -1.754114 . . . . .
brand_dummy2 | -2.340487 . . . . .
brand_dummy3 | -1.062552 . . . . .
brand_dummy4 | -.5074868 . . . . .
brand_dummy5 | -2.578009 . . . . .
brand_dummy6 | -1.750712 . . . . .
brand_dummy7 | -1.294738 . . . . .
brand_dummy8 | -1.666641 . . . . .
brand_dummy9 | -1.704865 . . . . .
brand_dummy10 | -2.360217 . . . . .
brand_dummy11 | -1.462816 . . . . .
brand_dummy12 | -2.44297 . . . . .
brand_dummy13 | -1.660811 . . . . .
brand_dummy14 | -1.102351 . . . . .
brand_dummy15 | -1.558638 . . . . .
brand_dummy16 | -2.056598 . . . . .
brand_dummy17 | -1.492722 . . . . .
brand_dummy18 | -2.379745 . . . . .
brand_dummy19 | -1.886506 . . . . .
brand_dummy20 | -1.404502 . . . . .
brand_dummy21 | -2.707936 . . . . .
brand_dummy22 | -2.3914 . . . . .
brand_dummy23 | -2.607298 . . . . .
brand_dummy24 | -1.730492 . . . . .
brand_dummy25 | -2.306587 . . . . .
brand_dummy26 | -1.915122 . . . . .
brand_dummy27 | -2.90919 . . . . .
brand_dummy28 | -2.119405 . . . . .
brand_dummy29 | -2.833878 . . . . .
brand_dummy30 | -2.975195 . . . . .
brand_dummy31 | -2.586929 . . . . .
brand_dummy32 | -3.476073 . . . . .
brand_dummy33 | -3.384767 . . . . .
brand_dummy34 | -1.951016 . . . . .
brand_dummy35 | -1.649924 . . . . .
brand_dummy36 | -2.453735 . . . . .
brand_dummy37 | -1.460477 . . . . .
brand_dummy38 | -1.740989 . . . . .
brand_dummy39 | -1.506543 . . . . .
brand_dummy40 | -1.173403 . . . . .
brand_dummy41 | -2.410974 . . . . .
brand_dummy42 | -1.493008 . . . . .
brand_dummy43 | -1.897421 . . . . .
brand_dummy44 | -2.184064 . . . . .
brand_dummy45 | -2.694391 . . . . .
brand_dummy46 | -3.28812 . . . . .
brand_dummy47 | -2.4508 . . . . .
brand_dummy48 | -2.371292 . . . . .
brand_dummy49 | -.9735492 . . . . .
brand_dummy50 | -2.152592 . . . . .
brand_dummy51 | -4.435938 . . . . .
brand_dummy52 | -.9688985 . . . . .
brand_dummy53 | -2.148244 . . . . .
brand_dummy54 | -2.44406 . . . . .
brand_dummy55 | -1.555192 . . . . .
brand_dummy56 | -1.239317 . . . . .
brand_dummy57 | -1.395652 . . . . .
brand_dummy58 | -2.533191 . . . . .
brand_dummy59 | -1.436539 . . . . .
brand_dummy60 | -1.040952 . . . . .
brand_dummy61 | .0719828 . . . . .
brand_dummy62 | -1.351868 . . . . .
brand_dummy63 | -1.500132 . . . . .
brand_dummy64 | -.1410059 . . . . .
brand_dummy65 | -1.754581 . . . . .
brand_dummy66 | -2.51948 . . . . .
brand_dummy67 | -1.754044 . . . . .
brand_dummy68 | -.7651347 . . . . .
brand_dummy69 | -1.884069 . . . . .
p | -1191.584 . . . . .
--------------+----------------------------------------------------------------
x1 |
SD | 1.85e-85 . . . . .
--------------+----------------------------------------------------------------
x2 |
SD | .0423504 . . . . .
--------------+----------------------------------------------------------------
x3 |
SD | 1.00e-14 . . . . .
--------------+----------------------------------------------------------------
p |
SD | 508.4741 . . . . .
-------------------------------------------------------------------------------
I know not concave means the model is misspecified, but I do not know the source of it?
also i tried including the x1, x2, x3 and brand dummies as exogenous variables only and not stochastic, only the Price is treated as stochastic, it improved the results( converged), but for my Analysis i want to include also product cahracteristics, any idea how to include them in a specification that is not problematic.
thanks in advance for your replies.
Regards,
Mahmoud Ahmed
I am running BLP model on an aggregated market data, over t= 3990 markets ( interactions of weeks and regions), to estimate market shares for j products across different markets, and using demograhics to capture the consumers' heterogenity. my product cahracterstics are x1= fair trade or not, x2= organic or not, x3= product size in grams, in Addition to Price, and brand dummies.
my data Looks as follow:
input float(s x1 x2 x3 p z d1 d2 d3 d4 d5 d6 d7 x12 x22 x32 x1z x2z x3z x1s x2s x3s) int Market
.009983872 0 0 500 .007252727 .0072385 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.61925 0 1 8500 1
.006143922 0 0 500 .00776 .007816923 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.908461 0 1 8500 1
.0015359804 0 0 500 .00798 .008424444 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 4.212222 0 1 8500 1
.0023039705 0 0 500 .006913333 .006850952 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.425476 0 1 8500 1
.0015359804 0 0 500 .00614 .006663959 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 3.331979 0 1 8500 1
.0015359804 0 1 500 .00798 .00798 57.55 .075 .075 56.8 .6 2.25 2211.25 0 1 250000 0 .00798 3.99 0 0 8500 1
.0007679902 0 0 500 .0057 .005685 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 2.8425 0 1 8500 1
.0023039705 0 0 500 .00776 .008159524 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 4.079762 0 1 8500 1
.003839951 0 0 500 .00798 .008551429 57.55 .075 .075 56.8 .6 2.25 2211.25 0 0 250000 0 0 4.2757144 0 1 8500 1
I started by running the model without demograhics, but I face Problems in the convergance, when I run the following code: [CODE][import delimited \\winfs-uni.top.gwdg.de\ahmed12$\Downloads\Mahmoud\data\Da ten_RK_12-16\blpdata.txt, delimiter(space) bindquote(strict) case(preserve) asdouble clear
// destring variables:
destring, replace dpcomma ignore(" ")
encode Product, gen(product)
encode Brand, gen(brand)
// variables preparation:
gen x1= Fair
gen x2= Bio
gen x3= Size
gen s= VolShare
gen p= PriceGr
gen z= PriceIV
gen d1= AgeHead
gen d2= AbiturHead
gen d3= UniHead
gen d4= AgeSR
gen d5= FemaleSR
gen d6= HHSize
gen d7= HHIncome
generate x12=x1^2
generate x22=x2^2
generate x32=x3^2
generate z2=z^2
generate x1z=x1*z
generate x2z=x2*z
generate x3z=x3*z
bysort Market: egen x1s=sum(x1)
bysort Market: egen x2s=sum(x2)
bysort Market: egen x3s=sum(x3)
replace x1s=x1s-x1
replace x2s=x2s-x2
replace x3s=x3s-x3
blp s x1 x2 x3 brand_dummy*, stochastic(x1,x2,x3,p) endog(p=z z2 x12 x22 x32 x1z x2z x3z x1s x2s x3s) markets(Market) draws(200)/CODE]
It takes too much time and does not converge in the end, I got the following message after 50 iterations:[Iteration 44: f(p) = 2769.6874 (not concave)
Iteration 45: f(p) = 2769.6883 (not concave)
Iteration 46: f(p) = 2769.7062 (not concave)
Iteration 47: f(p) = 2769.6931 (not concave)
Iteration 48: f(p) = 2769.6912 (not concave)
Iteration 49: f(p) = 2769.6888 (not concave)
Iteration 50: f(p) = 2769.6968 (not concave)
convergence not achieved
Warning: variance matrix is nonsymmetric or highly singular]
the table of results looked as follows:
-------------------------------------------------------------------------------
| Coef. Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
Mean utility |
cons | .8228627 . . . . .
x1 | .3926909 . . . . .
x2 | .070797 . . . . .
x3 | .0017025 . . . . .
brand_dummy1 | -1.754114 . . . . .
brand_dummy2 | -2.340487 . . . . .
brand_dummy3 | -1.062552 . . . . .
brand_dummy4 | -.5074868 . . . . .
brand_dummy5 | -2.578009 . . . . .
brand_dummy6 | -1.750712 . . . . .
brand_dummy7 | -1.294738 . . . . .
brand_dummy8 | -1.666641 . . . . .
brand_dummy9 | -1.704865 . . . . .
brand_dummy10 | -2.360217 . . . . .
brand_dummy11 | -1.462816 . . . . .
brand_dummy12 | -2.44297 . . . . .
brand_dummy13 | -1.660811 . . . . .
brand_dummy14 | -1.102351 . . . . .
brand_dummy15 | -1.558638 . . . . .
brand_dummy16 | -2.056598 . . . . .
brand_dummy17 | -1.492722 . . . . .
brand_dummy18 | -2.379745 . . . . .
brand_dummy19 | -1.886506 . . . . .
brand_dummy20 | -1.404502 . . . . .
brand_dummy21 | -2.707936 . . . . .
brand_dummy22 | -2.3914 . . . . .
brand_dummy23 | -2.607298 . . . . .
brand_dummy24 | -1.730492 . . . . .
brand_dummy25 | -2.306587 . . . . .
brand_dummy26 | -1.915122 . . . . .
brand_dummy27 | -2.90919 . . . . .
brand_dummy28 | -2.119405 . . . . .
brand_dummy29 | -2.833878 . . . . .
brand_dummy30 | -2.975195 . . . . .
brand_dummy31 | -2.586929 . . . . .
brand_dummy32 | -3.476073 . . . . .
brand_dummy33 | -3.384767 . . . . .
brand_dummy34 | -1.951016 . . . . .
brand_dummy35 | -1.649924 . . . . .
brand_dummy36 | -2.453735 . . . . .
brand_dummy37 | -1.460477 . . . . .
brand_dummy38 | -1.740989 . . . . .
brand_dummy39 | -1.506543 . . . . .
brand_dummy40 | -1.173403 . . . . .
brand_dummy41 | -2.410974 . . . . .
brand_dummy42 | -1.493008 . . . . .
brand_dummy43 | -1.897421 . . . . .
brand_dummy44 | -2.184064 . . . . .
brand_dummy45 | -2.694391 . . . . .
brand_dummy46 | -3.28812 . . . . .
brand_dummy47 | -2.4508 . . . . .
brand_dummy48 | -2.371292 . . . . .
brand_dummy49 | -.9735492 . . . . .
brand_dummy50 | -2.152592 . . . . .
brand_dummy51 | -4.435938 . . . . .
brand_dummy52 | -.9688985 . . . . .
brand_dummy53 | -2.148244 . . . . .
brand_dummy54 | -2.44406 . . . . .
brand_dummy55 | -1.555192 . . . . .
brand_dummy56 | -1.239317 . . . . .
brand_dummy57 | -1.395652 . . . . .
brand_dummy58 | -2.533191 . . . . .
brand_dummy59 | -1.436539 . . . . .
brand_dummy60 | -1.040952 . . . . .
brand_dummy61 | .0719828 . . . . .
brand_dummy62 | -1.351868 . . . . .
brand_dummy63 | -1.500132 . . . . .
brand_dummy64 | -.1410059 . . . . .
brand_dummy65 | -1.754581 . . . . .
brand_dummy66 | -2.51948 . . . . .
brand_dummy67 | -1.754044 . . . . .
brand_dummy68 | -.7651347 . . . . .
brand_dummy69 | -1.884069 . . . . .
p | -1191.584 . . . . .
--------------+----------------------------------------------------------------
x1 |
SD | 1.85e-85 . . . . .
--------------+----------------------------------------------------------------
x2 |
SD | .0423504 . . . . .
--------------+----------------------------------------------------------------
x3 |
SD | 1.00e-14 . . . . .
--------------+----------------------------------------------------------------
p |
SD | 508.4741 . . . . .
-------------------------------------------------------------------------------
I know not concave means the model is misspecified, but I do not know the source of it?
also i tried including the x1, x2, x3 and brand dummies as exogenous variables only and not stochastic, only the Price is treated as stochastic, it improved the results( converged), but for my Analysis i want to include also product cahracteristics, any idea how to include them in a specification that is not problematic.
thanks in advance for your replies.
Regards,
Mahmoud Ahmed
Comment