This function creates a simulated BLP dataset.
simulate_BLP_dataset(
nmkt,
nbrn,
Xlin,
Xexo,
Xrandom,
instruments,
true.parameters = list(),
price.endogeneity = list(mean.xi = -2, mean.eita = 0, cov = cbind(c(1, 0.7), c(0.7,
1))),
printlevel = 1,
seed
)
Returns a simulated BLP dataset.
number of markets
number of products
character vector specifying the set of linear variables
character vector specifying the set of exogenous variables (subset of Xlin
)
character vector specifying the set of random coefficients (subset of Xlin
)
character vector specifying the set of instrumental variables
list with parameters of the DGP
Xlin.true.except.price
"true" linear coefficients in utility function except price
Xlin.true.price
"true" linear price coefficient in utility function
Xrandom.true
"true" set of random coefficients
instrument.effects
"true" coefficients of instrumental variables to explain endogenous price
instrument.Xexo.effects
"true" coefficients of exogenous variables to explain endogenous price
list with arguments of the multivariate normal distribution
mean.xi
controls for the mean of the error term in the utility function
mean.eita
controls for the mean of the error term in the price function
cov
controls for the covariance of xi
and eita
0 (no output) 1 (summary of generated data)
seed for the random number generator
The dataset is balanced, so every market has the same amount of products.
Only unobserved heterogeneity can be considered.
Variables that enter the equation as a Random Coefficient or
exogenously must be included in the set of linear variables.
The parameter.list
argument specifies the "true" effect on the
individual utility for each component. Prices are generated endogenous
as a function of exogenous variables and instruments, where the
respective effect sizes are specified in instrument.effects
and instrument.Xexo.effects
. Error terms xi
and eita
are drawn from a multivariate normal distribution, whose
parameters can be set in price.endogeneity
. Market shares
are generated by MLHS integration rule with 10000 nodes.
K<-2 #number of random coefficients
Run the code above in your browser using DataLab