generate {PriceIndices} | R Documentation |
Generating an artificial scanner dataset
Description
This function provides artificial scanner datasets where prices and quantities are lognormally distributed.
Usage
generate(
pmi = c(),
psigma = c(),
qmi = c(),
qsigma = c(),
prec = c(2, 0),
n = 100,
n0 = 1,
r = 1,
r0 = 1,
start,
days = FALSE
)
Arguments
pmi |
A numeric vector indicating |
psigma |
A numeric vector indicating |
qmi |
A numeric vector indicating |
qsigma |
A numeric vector indicating |
prec |
A two-dimensional numeric vector indicating precision, i.e. the number of decimal places, for presenting prices and quantities. |
n |
An integer parameter indicating the number of products which are to be generated. |
n0 |
An integer parameter indicating the first (the smallest) prodID. |
r |
An integer parameter indicating the number of outlets (retailer sale points) for which prices and quantities are to be generated. |
r0 |
n0 An integer parameter indicating the first (the smallest) retID. |
start |
The first period in the generated data frame (as character) limited to the year and month, e.g. '2019-12'. |
days |
A logical parameter indicating whether the trading day in a given month is to be randomised. The default value of |
Value
This function returns an artificial scanner dataset where prices and quantities are lognormally distributed. The characteristics for these lognormal distributions are set by pmi
, psigma
, qmi
and qsigma
parameters. This function works for a fixed number of products and outlets (see n
and r
parameters). The generated dataset is ready for further price index calculations.
References
Sulewski, P., Białek, J. (2022). Probability Distribution Modelling of Scanner Prices and Relative Prices. Statistika – Statistics and Economy Journal, Vol. 3/2022, 282-298, Czech Statistical Office, Prague.
Examples
generate(pmi=c(1.02,1.03,1.04),psigma=c(0.05,0.09,0.02),qmi=c(3,4,4),
qsigma=c(0.1,0.1,0.15),start="2020-01",days=TRUE)
generate(pmi=c(1.02,1.03,1.04),psigma=c(0.05,0.09,0.02),qmi=c(6,6,7),
qsigma=c(0.1,0.1,0.15),start="2020-01",n=1000,n0=132578,r=10)