Type: | Package |
Title: | Revenue Management Modeling |
Version: | 0.1.0 |
Date: | 2022-04-29 |
Maintainer: | Chul Kim <statkim7578@yonsei.ac.kr> |
Description: | The RMM fits Revenue Management Models using the RDE(Robust Demand Estimation) method introduced in the paper by <doi:10.2139/ssrn.3598259>, one of the customer choice-based Revenue Management Model. Furthermore, it is possible to select a multinomial model as well as a conditional logit model as a model of RDE. |
License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2.0)] |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 3.1.0) |
Imports: | tibble, magrittr, rlang, dplyr, numDeriv, Rcpp |
RoxygenNote: | 7.1.2 |
LinkingTo: | Rcpp |
NeedsCompilation: | yes |
Packaged: | 2022-05-06 12:03:59 UTC; chulkim |
Author: | Chul Kim [aut, cre], Sanghoon Cho [aut], Jongho Im [aut] |
Repository: | CRAN |
Date/Publication: | 2022-05-09 11:30:05 UTC |
Estimating total arrivals and the number of no purchase.
Description
Estimating total arrivals and the number of no purchase. Internal function that users should not call directly.
Usage
Arrival(
CCB,
Attr,
Choice_Set_List,
Alts_Same_Choice_Set,
Is_Purchase,
Base_Prod,
Num_Prod,
Num_Attr
)
Arguments
CCB |
numeric vector, estimated model parameters(gamma and eta). |
Attr |
list, a set of data frame in which alternative specific variables. |
Choice_Set_List |
list, product code included for each choice set. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Base_Prod |
numeric, the baseline product number |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
Value
The estimated value of total arrivals and the number of no purchase.
Collects a choice set exposed to individuals.
Description
Collects a choice set exposed to individuals. Internal function that users should not call directly.
Usage
Choice_Set(df, num_id, uniq_id, idvar)
Arguments
df |
a long format tibble. |
num_id |
Number of unique Booking_IDs appearing in transaction data |
uniq_id |
Unique Booking_ID in transaction data. |
idvar |
Variable name representing customer id (Booking_ID). |
Value
Returns a list containing the values required for calculation within the rmm_reshape
function.
Estimating model parameters.
Description
Estimating model parameters except gamma(no-purchase utility). Internal function that users should not call directly.
Usage
ESTF(Alts_Same_Choice_Set, Choice_Set_List, Num_Prod, Num_Attr, Is_Purchase)
Arguments
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Choice_Set_List |
list, product code included for each choice set. |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Value
The estimated value of parameters except gamma(no-purchase utility).
Estimating model parameters.
Description
Estimating model parameters except gamma(no-purchase utility) when a particular baseline_product is specified. Internal function that users should not call directly.
Usage
ESTF_bp(
Base_Prod = 1,
Choice_Set_List,
Alts_Same_Choice_Set,
Num_Prod,
Num_Attr,
Is_Purchase
)
Arguments
Base_Prod |
numeric, the baseline product number |
Choice_Set_List |
list, product code included for each choice set. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Value
The estimated value of parameters except gamma(no-purchase utility) when a particular baseline_product is specified.
Estimating model parameter gamma(no-purchase utility).
Description
Estimating model parameter gamma(no-purchase utility) given estimated model parameters. Internal function that users should not call directly.
Usage
ESTF_gamma(
eta_wo_k,
Attr,
Choice_Set_List,
Alts_Same_Choice_Set,
Is_Purchase,
Base_Prod,
Num_Prod,
Num_Attr,
cond
)
Arguments
Attr |
list, a set of data frame in which alternative specific variables. |
Choice_Set_List |
list, product code included for each choice set. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Base_Prod |
numeric, the baseline product number |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
cond |
numeric, the value associated with prop, which is the argument of the |
Value
The estimated value of parameters except gamma(no-purchase utility).
Data from a Major Hotel Chain
Description
'Hotel_Long
', a 'Long format', is a preprocessing data of the publicly available 'Hotel 1' data introduced in Bodea et al. (2009).
Usage
Hotel_Long
Format
'Hotel_Long
': A data frame with 8,318 rows and 11 variables:
- Booking_ID
ID associated with a booking. Begins at one for each hotel property.
- Purchase
Indicator variable equal to one if the product identified by product ID is purchased, zero otherwise.
- Room_Type
Code describing the room type associated with the product ID.
- Price
The average nightly rate the customer pays in USD (e.g., $199.99). Note that the average nightly rate will not match the rate of any available product rates if an upsell occurs at time of check-in, if the customer requests a specific discount rate at time of check-in, etc.
- Party_Size
Number of adults and children associated with the booking.
- Membership_Status
Status in rewards program (0—not a member, 1—basic, 2—elevated, 3—premium).
- VIP_Membership_Status
Membership status of a VIP rewards program member (0—not a VIP, 1—basic VIP, 2—premium VIP member).
- Booking_Date
Date the booking was created (e.g., 20070303 = March 3, 2007).
- Check_In_Date
Check-in date (e.g., 20070307 = March 7, 2007).
- Check_Out_Date
Check-out date (e.g., 20070310 = March 10, 2007).
- Length_of_Stay
Length of stay/number of nights (e.g., three).
Details
'Hotel 1' data contains information on the available alternatives, i.e.,
choice sets and the associated prices at the time of each customer’s booking decision.
We preprocessed 'Hotel 1' data and provide it in two types of
data format, 'Hotel_Long
' and 'Hotel_Wide
'.
The following are the preprocessing of 'Hotel 1' data.
1. Customers' booking transactions that had only one room type available in their choice set were removed as our methods require at least two different products in each choice set.
2. Duplicate records was removed.
3. Choice sets with less than 30 observations, representing rare case were removed.
Source
Data from a Major Hotel Chain
Description
'Hotel_Wide
', a 'Wide format', is a preprocessing data of the publicly available 'Hotel 1' data introduced in Bodea et al. (2009).
Usage
Hotel_Wide
Format
'Hotel_Wide
': A data frame with 1,100 rows and 22 variables:
- Booking_ID
ID associated with a booking. Begins at one for each hotel property.
- Party_Size
Number of adults and children associated with the booking.
- Membership_Status
Status in rewards program (0—not a member, 1—basic, 2—elevated, 3—premium).
- VIP_Membership_Status
Membership status of a VIP rewards program member (0—not a VIP, 1—basic VIP, 2—premium VIP member).
- Booking_Date
Date the booking was created (e.g., 20070303 = March 3, 2007).
- Check_In_Date
Check-in date (e.g., 20070307 = March 7, 2007).
- Check_Out_Date
Check-out date (e.g., 20070310 = March 10, 2007).
- Length_of_Stay
Length of stay/number of nights (e.g., three).
- Room_Type
Code describing the room type associated with the product ID.
- Purchased_Prod_Code
Unique number of products associated with room type.
- Exposed_Choice_Set
Choice set exposed to individual
- Exposed_Choice_Set_Code
Unique number of choice sets associated with Exposed_Choice_Set
- Price_1 ~ Price_10
The average nightly rate the customer pays in USD (e.g., $199.99). Note that the average nightly rate will not match the rate of any available product rates if an upsell occurs at time of check-in, if the customer requests a specific discount rate at time of check-in, etc.
Details
'Hotel 1' data contains information on the available alternatives, i.e.,
choice sets and the associated prices at the time of each customer’s booking decision.
We preprocessed 'Hotel 1' data and provide it in two types of
data format, 'Hotel_Long
' and 'Hotel_Wide
'.
The following are the preprocessing of 'Hotel 1' data.
1. Customers' booking transactions that had only one room type available in their choice set were removed as our methods require at least two different products in each choice set.
2. Duplicate records was removed.
3. Choice sets with less than 30 observations, representing rare case were removed.
Source
Calculating standard error of estimate.
Description
Calculating statndard error of model parameters and gamma(no-purchase utility). Internal function that users should not call directly.
Usage
Sandwich(
eta_wo_k,
gamma,
Attr,
Choice_Set_List,
Alts_Same_Choice_Set,
Is_Purchase,
Base_Prod,
Num_Prod,
Num_Attr,
H,
cond
)
Arguments
eta_wo_k |
numeric, estimated model parameters normalized for baseline product. |
gamma |
numeric, estimated gamma(no-purchase utility). |
Attr |
list, a set of data frame in which alternative specific variables. |
Choice_Set_List |
list, product code included for each choice set. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Base_Prod |
numeric, the baseline product number |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
H |
matrix, a hessian matrix of the log-likelihood function. |
cond |
numeric, the value associated with prop, which is the argument of the |
Value
a value of standard error of estimate.
Calculating a value of score function with respect to parameter gamma.
Description
Calculating a value of score function with respect to parameter gamma. Internal function that users should not call directly.
Usage
U(
eta_wo_k,
gamma,
Attr,
Choice_Set_List,
Alts_Same_Choice_Set,
Is_Purchase,
Base_Prod,
Num_Prod,
Num_Attr,
cond
)
Arguments
eta_wo_k |
numeric, estimated model parameters normalized for baseline product. |
gamma |
numeric, estimated gamma(no-purchase utility). |
Attr |
list, a set of data frame in which alternative specific variables. |
Choice_Set_List |
list, product code included for each choice set. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Base_Prod |
numeric, the baseline product number |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
cond |
numeric, the value associated with prop, which is the argument of the |
Value
a value of score function with respect to parameter gamma.
Calculating a value of score function with respect to parameter gamma for each individual and each alternative.
Description
Calculating a value of score function with respect to parameter gamma for each individual and each alternative. Internal function that users should not call directly.
Usage
iU(
eta_wo_k,
gamma,
Attr,
Choice_Set_List,
Alts_Same_Choice_Set,
Is_Purchase,
Base_Prod,
Num_Prod,
Num_Attr,
cond
)
Arguments
eta_wo_k |
numeric, estimated model parameters normalized for baseline product. |
gamma |
numeric, estimated gamma(no-purchase utility). |
Attr |
list, a set of data frame in which alternative specific variables. |
Choice_Set_List |
list, product code included for each choice set. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Base_Prod |
numeric, the baseline product number |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
cond |
numeric, the value associated with prop, which is the argument of the |
Value
a value of score function with respect to parameter gamma for each individual and each alternative.
The log-likelihood value for each individual and each alternative.
Description
For function that calculating standard error of estimate. Internal function that users should not call directly.
Usage
iloglike(
eta,
Choice_Set_List,
Choice_Set_Code,
Base_Prod,
Num_Prod,
Num_Attr,
Alts_Same_Choice_Set,
Is_Purchase
)
Arguments
eta |
numeric vector, the model parameters to be estimated |
Choice_Set_List |
list, product code included for each choice set. |
Choice_Set_Code |
numeric, choice set code Number specified for calculating log-likelihood. |
Base_Prod |
numeric, the baseline product number |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Value
The log-likelihood value for each individual and each alternative.
Calculating the log-likelihood function.
Description
Calculating model's log-likelihood function. Internal function that users should not call directly.
Usage
loglike(
eta,
Choice_Set_List,
Choice_Set_Code,
Base_Prod,
Num_Prod,
Num_Attr,
Alts_Same_Choice_Set,
Is_Purchase
)
Arguments
eta |
numeric vector, the model parameters to be estimated |
Choice_Set_List |
list, product code included for each choice set. |
Choice_Set_Code |
numeric, choice set code Number specified for calculating log-likelihood. |
Base_Prod |
numeric, the baseline product number |
Num_Prod |
numeric, the number of all products in observed data. |
Num_Attr |
numeric, the number of attributes in observed data. |
Alts_Same_Choice_Set |
list, for internal calculation, a list of data exposed to the same choice set. |
Is_Purchase |
list, for internal calculation, list of customers who are exposed to the same choice set who purchased the product. If purchased 1, otherwise 0. |
Value
The value of log-likelihood.
Predict method for Revenue Management Model Fits
Description
Predicted values based on RMM object
Usage
## S3 method for class 'rmm'
predict(object, newdata, Rem_Choice_Set, Choice_Set_Code, fixed = TRUE, ...)
Arguments
object |
Object of class inheriting from " |
newdata |
A data frame in which to look for variables with which to predict. |
Rem_Choice_Set |
List of choice sets remaining in the data. |
Choice_Set_Code |
Specifies the choice set of |
fixed |
If fixed=TRUE, the alternative with the highest prediction probability is determined as decision. Otherwise (fixed=FALSE), one of the alternatives is determined in proportion to the predictive probability. |
... |
further arguments passed to or from other methods. |
Value
preict.rmm
produces a list of predictions, which contains decisions and probabilities.
Examples
data(Hotel_Long)
# Before using the rmm function, the user must first use the rmm_shape function.
rst_reshape <- rmm_reshape(data=Hotel_Long, idvar="Booking_ID",
alts="Room_Type", asv="Price", resp="Purchase", min_obs=30)
# Fitting a model
rst_rmm <- rmm(rst_reshape, prop=0.7, model="cl")
# Predictions
Rem_Choice_Set <- rst_reshape$Rem_Choice_Set
newdata1 <- data.frame(Price_1=c(232, 122, 524), Price_3=c(152, 531, 221),
Price_4=c(163, 743, 192), Price_5=c(132, 535, 325),
Price_7=c(136, 276, 673), Price_8=c(387, 153, 454),
Price_9=c(262, 163, 326), Price_10=c(421, 573, 472))
predict(rst_rmm, newdata=newdata1, Rem_Choice_Set=Rem_Choice_Set,
Choice_Set_Code=3, fixed=TRUE)
newdata2 <- data.frame(Price_1=c(521, 321, 101, 234, 743),
Price_5=c(677, 412, 98, 321, 382),
Price_8=c(232, 384, 330, 590, 280))
predict(rst_rmm, newdata=newdata2, Rem_Choice_Set=Rem_Choice_Set,
Choice_Set_Code=7, fixed=FALSE)
Fitting Revenue Management Models
Description
rmm
is used to fit Revenue Management Models. Users can specify
cl (conditional logit model) and ml (multinomial logit model) as RMM model.
Usage
rmm(rmm_data, prop = 0.7, model = "cl")
Arguments
rmm_data |
an object of class "rmm_data", a output of |
prop |
numeric, user assumed market share. |
model |
character, specify fitting method ("cl" or "ml"). "cl" (default) refers to the Conditional Logit Model, and "ml" refers to the Multinomial Logit Model. |
Value
rmm
returns an object of class inheriting from "rmm".
See Also
rmm
fits the model with the RDE method introduced in doi:10.2139/ssrn.3598259.
Examples
data(Hotel_Long)
# Before using the rmm function, the user must first use the rmm_shape function.
rst_reshape <- rmm_reshape(data=Hotel_Long, idvar="Booking_ID", alts="Room_Type",
asv="Price", resp="Purchase", min_obs=30)
# Fitting a model
rst_rmm <- rmm(rst_reshape, prop=0.7, model="cl")
print(rst_rmm)
Reshape Long-Format Data
Description
This function reshapes a 'Long-Format' data (with the repeated measurements in separate rows) to 'Wide-Format' data (with repeated measurements in separate columns of the same row).
The reshaped 'wide-format' data is an S3 class called 'rmm_data' and contains information for fitting the model with the rmm
function.
Users who want to use the rmm function must first use the rmm_reshape function. The rmm
function receives only S3 class 'rmm_data' as input.
Usage
rmm_reshape(data, idvar, resp, alts, asv, min_obs)
Arguments
data |
data frame, a 'Long-Format' transaction data. |
idvar |
character, variable name representing each individual's id in the transaction data. |
resp |
character, variable name representing result of a individual choice. |
alts |
character vector, variable names representing a alternatives. |
asv |
character vector, variable names representing a alternative specific variables. |
min_obs |
numeric, specify the minimum observation for each choice set in the transaction data. |
Value
The 'Wide-Format' data and various information required for the rmm
function.
See Also
rmm
for estimating parameters.
Examples
data(Hotel_Long)
rst_reshape <- rmm_reshape(data=Hotel_Long, idvar="Booking_ID",
resp="Purchase", alts="Room_Type", asv="Price", min_obs=30)
class(rst_reshape) # "rmm_data"
ls(rst_reshape) # "Alts_Code_Desc" "ASV" "asv_name" "data_wide"
# "Rem_Choice_Set" "Removed_Choice_Set"
rst_reshape$data_wide # reshaped data