Description Usage Arguments Details Value Examples
View source: R/get.BLP.dataset.R
This function creates a simulated BLP dataset.
1 2 3 | get.BLP.dataset(nmkt, nbrn, Xlin, Xexo, Xrandom, instruments,
true.parameters = list(), price.endogeneity = list(), printlevel = 1,
seed)
|
nmkt |
number of markets |
nbrn |
number of products |
Xlin |
character vector specifying the set of linear variables |
Xexo |
character vector specifying the set of exogenous variables (subset of |
Xrandom |
character vector specifying the set of random coefficients (subset of |
instruments |
character vector specifying the set of instrumental variables |
true.parameters |
list with parameters of the DGP
|
price.endogeneity |
list with arguments of the multivariate normal distribution
|
printlevel |
0 (no output) 1 (summary of generated data) |
seed |
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.
Returns a simulated BLP dataset.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | K<-2 #number of random coefficients
Xlin_example <- c("price", "x1", "x2", "x3", "x4", "x5")
Xexo_example <- c("x1", "x2", "x3", "x4", "x5")
Xrandom_example <- paste0("x",1:K)
instruments_example <- paste0("iv",1:10)
data <- get.BLP.dataset(nmkt = 25,
nbrn = 20,
Xlin = Xlin_example,
Xexo = Xexo_example,
Xrandom = Xrandom_example,
instruments = instruments_example,
true.parameters = list(Xlin.true.except.price = rep(0.2,5),
Xlin.true.price = -0.2,
Xrandom.true = rep(2,K),
instrument.effects = rep(2,10),
instrument.Xexo.effects = rep(1,5)),
price.endogeneity = list( mean.xi = -2,
mean.eita = 0,
cov = cbind( c(1,0.7), c(0.7,1))),
printlevel = 0, seed = 234234 )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.