This function returns a value of the quality adjusted unit value index (QU index) for a given set of adjustment factors.
QU(data, start, end, v)
This function returns a value of the quality adjusted unit value index (QU index) for a given set of adjustment factors (adjusted factors must be available for all matched prodIDs).
The user's data frame with information about sold products. It must contain columns: time
(as Date in format: year-month-day,e.g. '2020-12-01'), prices
(as positive numeric), quantities
(as positive numeric) and prodID
(as numeric, factor or character).
The base period (as character) limited to the year and month, e.g. "2020-03".
The research period (as character) limited to the year and month, e.g. "2020-04".
The data frame with adjustment factors for at least all matched prodIDs. It must contain two columns: prodID
(as numeric or character) with unique product IDs and values
(as positive numeric) with corresponding adjustment factors.
Chessa, A.G. (2016). A New Methodology for Processing Scanner Data in the Dutch CPI. Eurona 1/2016, 49-69.
## Creating a data frame with artificial adjustment factors
## (random numbers from uniform distribution U[1,2])
prodID<-unique(milk$prodID)
values<-stats::runif(length(prodID),1,2)
v<-data.frame(prodID,values)
## Calculating the QU index for the created data frame 'v'
QU(milk, start="2018-12", end="2019-12", v)
Run the code above in your browser using DataLab