Introduction

1.1 Problem statement

In the hospitality and lodging industry, setting the nightly room rate, known as the Average Daily Rate (adr), is a critical decision that affects a business’s profitability. The tourism market is complex and volatile, and rates are influenced simultaneously by many factors: seasonality (arrival_date_month), booking lead time (lead_time), guest group size and composition (adults, children), market segment (market_segment), the property itself (hotel), and additional service requirements (meal, required_car_parking_spaces, total_of_special_requests). Without a clear understanding of how these variables relate to room rates, hotel managers risk setting rates too high (low occupancy) or too low (lost revenue). This study therefore builds a regression model to describe and predict ADR while examining the association between each individual factor and the room rate.

1.2 How we plan to address the problem

Our team uses the “Hotels” dataset obtained from GitHub. We cleaned the data (duplicates, missing values, invalid or implausible rates), created new variables and joined summary tables, and built visualizations to examine three groups of factors that may be associated with adr:

  • Timing: lead_time, arrival_date_month, arrival_date_day_of_month, stays_in_weekend_nights, stays_in_week_nights
  • Customer characteristics: adults, children, customer_type, market_segment
  • Property and services: hotel, reserved_room_type, meal, required_car_parking_spaces, total_of_special_requests

1.3 Analytic technique

Our main technique is exploratory data analysis (EDA): slicing the data by hotel, season, lead time, market segment and guest type, creating new variables, joining summary tables, and presenting the findings as plots and styled tables. As an extension, we also build multiple linear regression models (section 5) to check whether the patterns survive when several factors are considered together, and we test the model on held-out bookings. All results are interpreted as associations, not as exact causal effects or as proof of an optimal pricing strategy.

1.4 How the analysis helps the consumer

First, for revenue managers, the study gives an evidence base for moving from intuition-based pricing toward data-informed dynamic pricing. Second, the findings help operations teams design service packages and pricing tailored to specific market segments.

Packages Required

2.1 Packages used

library(tidyverse)   
library(knitr)
library(kableExtra)
library(scales)
library(broom)     


theme_set(theme_minimal(base_size = 12))
hotel_cols <- c("City Hotel" = "#2C7FB8", "Resort Hotel" = "#D95F0E")


nice_table <- function(df, caption, digits = 2, highlight = NULL) {
  tab <- kable(df, caption = caption, digits = digits,
               format.args = list(big.mark = ",")) %>%
    kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
                  full_width = FALSE)
  if (!is.null(highlight)) {
    tab <- row_spec(tab, highlight, bold = TRUE, background = "#FFF3CD")
  }
  tab
}

2.2 Messages and warnings

Messages and warnings from loading packages are suppressed through the global chunk option message = FALSE, warning = FALSE.

2.3 Purpose of each package

  • tidyverse: a collection of packages for data import, manipulation (dplyr, tidyr), visualization (ggplot2) and date handling (lubridate).
  • knitr: compiles R Markdown into HTML, PDF or Word and renders tables with kable().
  • kableExtra: styles tables for HTML/PDF reports.
  • broom: turns regression results into tidy tables (tidy(), glance()).
  • scales: formats axis labels and percentages in plots and tables.

Data Preparation

3.1 Source

We use the hotel booking demand dataset by Antonio, Almeida and Nunes (2019), publicly available through the TidyTuesday repository on GitHub (release date 2020-02-11): https://github.com/rfordatascience/tidytuesday/tree/main/data/2020/2020-02-11

3.2 Source data explained

  • Source: open hotel booking demand dataset from Antonio, Almeida and Nunes (2019).
  • Content: booking records from two hotels in Portugal, a Resort Hotel and a City Hotel, with arrival dates from July 2015 to August 2017.
  • Number of variables: 32.
  • Missing values: children contains NA; country, agent and company contain the text “NULL”.

3.3 Importing and cleaning

Our cleaning plan, with every step that removes records logged in a table (section 3.3.7):

  1. Import and inspect the data.
  2. Check for exact duplicate records (before removing columns) and justify the decision.
  3. Remove variables not needed for a pricing analysis (with reasons).
  4. Handle missing values.
  5. Inspect and handle invalid, zero and extreme ADR values (rather than applying an automatic rule).
  6. Present the final data set.

3.3.1 Import

hotel_raw <- read.csv("hotels.csv", stringsAsFactors = FALSE)

# Basic error check: the file loaded and has the columns we rely on
stopifnot(nrow(hotel_raw) > 0, all(c("adr", "hotel", "lead_time") %in% names(hotel_raw)))
n_raw <- nrow(hotel_raw)

3.3.2 Structure and summary

str(hotel_raw)
## 'data.frame':    119390 obs. of  32 variables:
##  $ hotel                         : chr  "Resort Hotel" "Resort Hotel" "Resort Hotel" "Resort Hotel" ...
##  $ is_canceled                   : int  0 0 0 0 0 0 0 0 1 1 ...
##  $ lead_time                     : int  342 737 7 13 14 14 0 9 85 75 ...
##  $ arrival_date_year             : int  2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 ...
##  $ arrival_date_month            : chr  "July" "July" "July" "July" ...
##  $ arrival_date_week_number      : int  27 27 27 27 27 27 27 27 27 27 ...
##  $ arrival_date_day_of_month     : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ stays_in_weekend_nights       : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ stays_in_week_nights          : int  0 0 1 1 2 2 2 2 3 3 ...
##  $ adults                        : int  2 2 1 1 2 2 2 2 2 2 ...
##  $ children                      : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ babies                        : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ meal                          : chr  "BB" "BB" "BB" "BB" ...
##  $ country                       : chr  "PRT" "PRT" "GBR" "GBR" ...
##  $ market_segment                : chr  "Direct" "Direct" "Direct" "Corporate" ...
##  $ distribution_channel          : chr  "Direct" "Direct" "Direct" "Corporate" ...
##  $ is_repeated_guest             : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ previous_cancellations        : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ previous_bookings_not_canceled: int  0 0 0 0 0 0 0 0 0 0 ...
##  $ reserved_room_type            : chr  "C" "C" "A" "A" ...
##  $ assigned_room_type            : chr  "C" "C" "C" "A" ...
##  $ booking_changes               : int  3 4 0 0 0 0 0 0 0 0 ...
##  $ deposit_type                  : chr  "No Deposit" "No Deposit" "No Deposit" "No Deposit" ...
##  $ agent                         : chr  "NULL" "NULL" "NULL" "304" ...
##  $ company                       : chr  "NULL" "NULL" "NULL" "NULL" ...
##  $ days_in_waiting_list          : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ customer_type                 : chr  "Transient" "Transient" "Transient" "Transient" ...
##  $ adr                           : num  0 0 75 75 98 ...
##  $ required_car_parking_spaces   : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ total_of_special_requests     : int  0 0 0 0 1 1 0 1 1 0 ...
##  $ reservation_status            : chr  "Check-Out" "Check-Out" "Check-Out" "Check-Out" ...
##  $ reservation_status_date       : chr  "7/1/2015" "7/1/2015" "7/2/2015" "7/2/2015" ...
summary(hotel_raw)
##        hotel         is_canceled       lead_time   arrival_date_year
##  Length   :119390   Min.   :0.0000   Min.   :  0   Min.   :2015     
##  N.unique :     2   1st Qu.:0.0000   1st Qu.: 18   1st Qu.:2016     
##  N.blank  :     0   Median :0.0000   Median : 69   Median :2016     
##  Min.nchar:    10   Mean   :0.3704   Mean   :104   Mean   :2016     
##  Max.nchar:    12   3rd Qu.:1.0000   3rd Qu.:160   3rd Qu.:2017     
##                     Max.   :1.0000   Max.   :737   Max.   :2017     
##                                                                     
##  arrival_date_month arrival_date_week_number arrival_date_day_of_month
##  Length   :119390   Min.   : 1.00            Min.   : 1.0             
##  N.unique :    12   1st Qu.:16.00            1st Qu.: 8.0             
##  N.blank  :     0   Median :28.00            Median :16.0             
##  Min.nchar:     3   Mean   :27.17            Mean   :15.8             
##  Max.nchar:     9   3rd Qu.:38.00            3rd Qu.:23.0             
##                     Max.   :53.00            Max.   :31.0             
##                                                                       
##  stays_in_weekend_nights stays_in_week_nights     adults      
##  Min.   : 0.0000         Min.   : 0.0         Min.   : 0.000  
##  1st Qu.: 0.0000         1st Qu.: 1.0         1st Qu.: 2.000  
##  Median : 1.0000         Median : 2.0         Median : 2.000  
##  Mean   : 0.9276         Mean   : 2.5         Mean   : 1.856  
##  3rd Qu.: 2.0000         3rd Qu.: 3.0         3rd Qu.: 2.000  
##  Max.   :19.0000         Max.   :50.0         Max.   :55.000  
##                                                               
##     children           babies                 meal             country      
##  Min.   : 0.0000   Min.   : 0.000000   Length   :119390   Length   :119390  
##  1st Qu.: 0.0000   1st Qu.: 0.000000   N.unique :     5   N.unique :   178  
##  Median : 0.0000   Median : 0.000000   N.blank  :     0   N.blank  :     0  
##  Mean   : 0.1039   Mean   : 0.007949   Min.nchar:     2   Min.nchar:     2  
##  3rd Qu.: 0.0000   3rd Qu.: 0.000000   Max.nchar:     9   Max.nchar:     4  
##  Max.   :10.0000   Max.   :10.000000                                        
##  NAs    :4                                                                  
##    market_segment   distribution_channel is_repeated_guest
##  Length   :119390   Length   :119390     Min.   :0.00000  
##  N.unique :     8   N.unique :     5     1st Qu.:0.00000  
##  N.blank  :     0   N.blank  :     0     Median :0.00000  
##  Min.nchar:     6   Min.nchar:     3     Mean   :0.03191  
##  Max.nchar:    13   Max.nchar:     9     3rd Qu.:0.00000  
##                                          Max.   :1.00000  
##                                                           
##  previous_cancellations previous_bookings_not_canceled reserved_room_type
##  Min.   : 0.00000       Min.   : 0.0000                Length   :119390  
##  1st Qu.: 0.00000       1st Qu.: 0.0000                N.unique :    10  
##  Median : 0.00000       Median : 0.0000                N.blank  :     0  
##  Mean   : 0.08712       Mean   : 0.1371                Min.nchar:     1  
##  3rd Qu.: 0.00000       3rd Qu.: 0.0000                Max.nchar:     1  
##  Max.   :26.00000       Max.   :72.0000                                  
##                                                                          
##  assigned_room_type booking_changes      deposit_type          agent       
##  Length   :119390   Min.   : 0.0000   Length   :119390   Length   :119390  
##  N.unique :    12   1st Qu.: 0.0000   N.unique :     3   N.unique :   334  
##  N.blank  :     0   Median : 0.0000   N.blank  :     0   N.blank  :     0  
##  Min.nchar:     1   Mean   : 0.2211   Min.nchar:    10   Min.nchar:     1  
##  Max.nchar:     1   3rd Qu.: 0.0000   Max.nchar:    10   Max.nchar:     4  
##                     Max.   :21.0000                                        
##                                                                            
##       company       days_in_waiting_list   customer_type         adr         
##  Length   :119390   Min.   :  0.000      Length   :119390   Min.   :  -6.38  
##  N.unique :   353   1st Qu.:  0.000      N.unique :     4   1st Qu.:  69.29  
##  N.blank  :     0   Median :  0.000      N.blank  :     0   Median :  94.58  
##  Min.nchar:     1   Mean   :  2.321      Min.nchar:     5   Mean   : 101.83  
##  Max.nchar:     4   3rd Qu.:  0.000      Max.nchar:    15   3rd Qu.: 126.00  
##                     Max.   :391.000                         Max.   :5400.00  
##                                                                              
##  required_car_parking_spaces total_of_special_requests reservation_status
##  Min.   :0.00000             Min.   :0.0000            Length   :119390  
##  1st Qu.:0.00000             1st Qu.:0.0000            N.unique :     3  
##  Median :0.00000             Median :0.0000            N.blank  :     0  
##  Mean   :0.06252             Mean   :0.5714            Min.nchar:     7  
##  3rd Qu.:0.00000             3rd Qu.:1.0000            Max.nchar:     9  
##  Max.   :8.00000             Max.   :5.0000                              
##                                                                          
##  reservation_status_date
##  Length   :119390       
##  N.unique :   926       
##  N.blank  :     0       
##  Min.nchar:     8       
##  Max.nchar:    10       
##                         
## 

3.3.3 Exact duplicate records (checked on the original data)

Before any columns are removed, we check the original 32-column data for rows that are identical in every variable. This check has to happen first: once columns such as country, agent and company are dropped, many different bookings would look identical and the count would be misleading.

dup_flag   <- duplicated(hotel_raw)          
n_dup      <- sum(dup_flag)
n_dup_rows <- sum(duplicated(hotel_raw) | duplicated(hotel_raw, fromLast = TRUE))

tibble(
  Measure = c("Rows in original data", "Repeated copies (extra rows)",
              "Rows involved in any duplicate group", "Share of data that are repeated copies"),
  Value   = c(format(nrow(hotel_raw), big.mark = ","), format(n_dup, big.mark = ","),
              format(n_dup_rows, big.mark = ","), scales::percent(n_dup / nrow(hotel_raw), accuracy = 0.1))
) %>%
  kable(caption = "Exact duplicates in the original data") %>%
  kable_styling(full_width = FALSE)
Exact duplicates in the original data
Measure Value
Rows in original data 119,390
Repeated copies (extra rows) 31,994
Rows involved in any duplicate group 40,165
Share of data that are repeated copies 26.8%

Decision: we will delete exact duplicate rows in the main analysis. Identical rows do automatically mean a recording error.

hotel_raw <- unique(hotel_raw)

n_after_rm_duplicate <- nrow(hotel_raw)

3.3.4 Variables removed, and why

Variables are removed only when they are not relevant to the price a guest pays at booking, or are too sparse or overlapping to model sensibly.

Variable(s) Reason for removal
is_canceled, reservation_status, reservation_status_date Booking outcome variables, relevant to cancellation prediction rather than room pricing
arrival_date_week_number Overlaps with month and season, which we analyse instead
previous_cancellations, previous_bookings_not_canceled, is_repeated_guest Guest history; we focus on current timing and segment
country, agent, company Too many distinct values (178 / 334 / 353), which would make the model overly complex; agent and company also contain “NULL” text
distribution_channel Meaning overlaps with market_segment
days_in_waiting_list Reflects demand/occupancy rather than the rate a guest pays
assigned_room_type, booking_changes, deposit_type Determined after booking or outcome-related; we keep reserved_room_type, which is known at booking
hotel <- hotel_raw %>%
  select(-is_canceled, -reservation_status, -reservation_status_date,
         -arrival_date_week_number,
         -previous_cancellations, -previous_bookings_not_canceled, -is_repeated_guest,
         -country, -agent, -company, -distribution_channel,
         -days_in_waiting_list,
         -assigned_room_type, -booking_changes, -deposit_type)

3.3.5 Missing values

“Undefined” values are also considered missing values, so we convert them to “NA” in order to accurately count the number of missing values.

hotel$meal[hotel$meal == "Undefined"] <- NA

hotel$market_segment[hotel$market_segment == "Undefined"] <- NA
colSums(is.na(hotel))
##                       hotel                   lead_time 
##                           0                           0 
##           arrival_date_year          arrival_date_month 
##                           0                           0 
##   arrival_date_day_of_month     stays_in_weekend_nights 
##                           0                           0 
##        stays_in_week_nights                      adults 
##                           0                           0 
##                    children                      babies 
##                           4                           0 
##                        meal              market_segment 
##                         492                           2 
##          reserved_room_type               customer_type 
##                           0                           0 
##                         adr required_car_parking_spaces 
##                           0                           0 
##   total_of_special_requests 
##                           0

The variable children has 4 missing values, meal has 492, and market_segment has 2. The total number of missing values is 496; as this represents a very small proportion of the dataset and the missing values appear to be distributed randomly, we have decided to remove them.

hotel <- na.omit(hotel)
n_after_na <- nrow(hotel)

3.3.6 Inspecting ADR

We first examine negative, zero and unusually high ADR values to decide whether they are errors or legitimate prices.

Negative ADR

hotel %>%
  filter(adr < 0) %>%
  select(hotel, arrival_date_year, arrival_date_month, market_segment,
         reserved_room_type, adr) %>%
  kable(caption = "Records with negative ADR") %>%
  kable_styling(full_width = FALSE)
Records with negative ADR
hotel arrival_date_year arrival_date_month market_segment reserved_room_type adr
Resort Hotel 2017 March Groups A -6.38

A negative nightly rate is not a valid price (it is most plausibly a refund or an accounting correction). These records are removed.

Zero ADR

# Which market segments have ADR = 0?
hotel %>%
  filter(adr == 0) %>%
  count(market_segment, sort = TRUE) %>%
  mutate(share = percent(n / sum(n), accuracy = 0.1)) %>%
  kable(caption = "Records with ADR = 0, by market segment") %>%
  kable_styling(full_width = FALSE)
Records with ADR = 0, by market segment
market_segment n share
Complementary 634 36.3%
Online TA 352 20.1%
Offline TA/TO 256 14.6%
Direct 227 13.0%
Groups 200 11.4%
Corporate 74 4.2%
Aviation 5 0.3%

An ADR of 0 means the guest paid nothing per night. If these records are concentrated in the Complementary segment (free stays), they are not market-priced bookings and would pull down the estimated effect of every predictor in a pricing model. Zero-ADR records are therefore excluded from the pricing analysis, and the number removed is reported below.

Unusually high ADR

# Inspect the ten highest rates to judge whether they are plausible
hotel %>%
  filter(adr > 0) %>%
  arrange(desc(adr)) %>%
  select(hotel, arrival_date_year, arrival_date_month, market_segment,
         reserved_room_type, adults, stays_in_week_nights, adr) %>%
  head(10) %>%
  kable(caption = "Ten highest ADR values") %>%
  kable_styling(full_width = FALSE)
Ten highest ADR values
hotel arrival_date_year arrival_date_month market_segment reserved_room_type adults stays_in_week_nights adr
City Hotel 2016 March Offline TA/TO A 2 1 5400.00
City Hotel 2017 May Offline TA/TO A 1 1 510.00
Resort Hotel 2015 July Corporate A 2 1 508.00
City Hotel 2016 December Direct E 2 1 451.50
Resort Hotel 2017 August Online TA A 2 10 450.00
Resort Hotel 2017 August Direct H 2 4 437.00
Resort Hotel 2017 August Online TA H 3 3 402.00
Resort Hotel 2017 July Direct H 3 5 397.38
Resort Hotel 2017 August Direct F 2 8 392.00
Resort Hotel 2017 August Online TA G 2 3 392.00
# Upper tail of the ADR distribution (positive rates only)
hotel %>%
  filter(adr > 0) %>%
  summarise(across(adr, list(p50 = ~quantile(., .50), p95 = ~quantile(., .95),
                             p99 = ~quantile(., .99), p999 = ~quantile(., .999),
                             max = max))) %>%
  kable(digits = 1, caption = "ADR upper-tail quantiles") %>%
  kable_styling(full_width = FALSE)
ADR upper-tail quantiles
adr_p50 adr_p95 adr_p99 adr_p999 adr_max
99 205 261.6 333.5 5400

The highest values are examined against the rest of the distribution. A value that is many times larger than the next-highest rate and far above the 99.9th percentile is treated as a probable data-entry error. Moderately high rates (for example, peak-summer bookings at the Resort Hotel or larger room types) are legitimate prices and are retained. The cap is applied to exclude unusually high prices that fall well beyond the 99.9th percentile:

adr_cap <- 1000

For transparency, we compute the 1.5 x IQR upper bound on the valid positive rates and check who it flags, but we do not delete these records.

# 1.5 x IQR upper bound, computed for information only (nothing is deleted here)
valid_adr <- hotel %>% filter(adr > 0, adr < adr_cap)
q <- quantile(valid_adr$adr, c(.25, .75), names = FALSE)
iqr_upper <- q[2] + 1.5 * diff(q)
iqr_upper
## [1] 225.45
# Who does the IQR rule flag? Peak months / one hotel => legitimate high-season prices
valid_adr %>%
  mutate(iqr_flag = adr > iqr_upper) %>%
  filter(iqr_flag) %>%
  count(arrival_date_month, sort = TRUE) %>%
  kable(caption = "IQR-flagged records by arrival month") %>%
  kable_styling(full_width = FALSE)
IQR-flagged records by arrival month
arrival_date_month n
August 1408
July 570
June 152
May 120
April 74
September 74
December 46
October 29
March 24
February 13
November 6
January 3

The flagged records are concentrated in peak months, they reflect genuine high-season pricing rather than errors, so removing them would delete real information about the very seasonal effect we want to study. We therefore retain them

3.3.7 Applying the decisions and counting the records affected

We also check bookings with no guests at all (adults, children and babies all 0), which cannot be valid stays.

# Apply each cleaning decision in turn and record how many rows each one removes
n0 <- n_after_rm_duplicate                                   
n1 <- n_after_na
hotel2 <- hotel |> filter(adr >= 0);          n2 <- nrow(hotel2)   # negative ADR
hotel3 <- hotel2 |> filter(adr > 0);          n3 <- nrow(hotel3)   # zero ADR
hotel4 <- hotel3 |> filter(adr < adr_cap);    n4 <- nrow(hotel4)   # implausible ADR
hotels_clean <- hotel4 |> filter(adults + children + babies > 0); n5 <- nrow(hotels_clean)  # no guests


cleaning_log <- tibble(
  Step = c("Raw data",  "Remove duplicate row", "Remove missing value", "Remove negative ADR",
           "Remove zero ADR", paste0("Remove ADR >= ", adr_cap, " (implausible)"),
           "Remove bookings with no guests"),
  `Records removed` = c(NA, n_raw - n0, n0 - n1, n1 - n2, n2 - n3, n3 - n4, n4 - n5),
  `Records remaining` = c(n_raw, n0, n1, n2, n3, n4, n5)
)

cleaning_log %>%
  kable(format.args = list(big.mark = ","),
        caption = "Effect of each cleaning step on the number of records") %>%
  kable_styling(full_width = FALSE)
Effect of each cleaning step on the number of records
Step Records removed Records remaining
Raw data NA 119,390
Remove duplicate row 31,994 87,396
Remove missing value 496 86,900
Remove negative ADR 1 86,899
Remove zero ADR 1,748 85,151
Remove ADR >= 1000 (implausible) 1 85,150
Remove bookings with no guests 31 85,119

3.4 The final data set

# Preview of the cleaned data
hotels_clean %>%
  head(10) %>%
  kbl() %>%
  kable_paper() %>%
  scroll_box(width = "800px", height = "400px")
hotel lead_time arrival_date_year arrival_date_month arrival_date_day_of_month stays_in_weekend_nights stays_in_week_nights adults children babies meal market_segment reserved_room_type customer_type adr required_car_parking_spaces total_of_special_requests
Resort Hotel 7 2015 July 1 0 1 1 0 0 BB Direct A Transient 75.0 0 0
Resort Hotel 13 2015 July 1 0 1 1 0 0 BB Corporate A Transient 75.0 0 0
Resort Hotel 14 2015 July 1 0 2 2 0 0 BB Online TA A Transient 98.0 0 1
Resort Hotel 0 2015 July 1 0 2 2 0 0 BB Direct C Transient 107.0 0 0
Resort Hotel 9 2015 July 1 0 2 2 0 0 FB Direct C Transient 103.0 0 1
Resort Hotel 85 2015 July 1 0 3 2 0 0 BB Online TA A Transient 82.0 0 1
Resort Hotel 75 2015 July 1 0 3 2 0 0 HB Offline TA/TO D Transient 105.5 0 0
Resort Hotel 23 2015 July 1 0 4 2 0 0 BB Online TA E Transient 123.0 0 0
Resort Hotel 35 2015 July 1 0 4 2 0 0 HB Online TA D Transient 145.0 0 0
Resort Hotel 68 2015 July 1 0 4 2 0 0 BB Online TA D Transient 97.0 0 3

3.5 Summary of the cleaned data

str(hotels_clean)
## 'data.frame':    85119 obs. of  17 variables:
##  $ hotel                      : chr  "Resort Hotel" "Resort Hotel" "Resort Hotel" "Resort Hotel" ...
##  $ lead_time                  : int  7 13 14 0 9 85 75 23 35 68 ...
##  $ arrival_date_year          : int  2015 2015 2015 2015 2015 2015 2015 2015 2015 2015 ...
##  $ arrival_date_month         : chr  "July" "July" "July" "July" ...
##  $ arrival_date_day_of_month  : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ stays_in_weekend_nights    : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ stays_in_week_nights       : int  1 1 2 2 2 3 3 4 4 4 ...
##  $ adults                     : int  1 1 2 2 2 2 2 2 2 2 ...
##  $ children                   : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ babies                     : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ meal                       : chr  "BB" "BB" "BB" "BB" ...
##  $ market_segment             : chr  "Direct" "Corporate" "Online TA" "Direct" ...
##  $ reserved_room_type         : chr  "A" "A" "A" "C" ...
##  $ customer_type              : chr  "Transient" "Transient" "Transient" "Transient" ...
##  $ adr                        : num  75 75 98 107 103 ...
##  $ required_car_parking_spaces: int  0 0 0 0 0 0 0 0 0 0 ...
##  $ total_of_special_requests  : int  0 0 1 0 1 1 0 0 0 3 ...
##  - attr(*, "na.action")= 'omit' Named int [1:496] 2776 2778 2779 2780 2781 2782 2909 2912 2913 2918 ...
##   ..- attr(*, "names")= chr [1:496] "3107" "3111" "3115" "3119" ...
summary(hotels_clean)
##        hotel         lead_time      arrival_date_year arrival_date_month
##  Length   :85119   Min.   :  0.00   Min.   :2015      Length   :85119   
##  N.unique :    2   1st Qu.: 12.00   1st Qu.:2016      N.unique :   12   
##  N.blank  :    0   Median : 50.00   Median :2016      N.blank  :    0   
##  Min.nchar:   10   Mean   : 80.67   Mean   :2016      Min.nchar:    3   
##  Max.nchar:   12   3rd Qu.:126.00   3rd Qu.:2017      Max.nchar:    9   
##                    Max.   :709.00   Max.   :2017                        
##  arrival_date_day_of_month stays_in_weekend_nights stays_in_week_nights
##  Min.   : 1.00             Min.   : 0.000          Min.   : 0.000      
##  1st Qu.: 8.00             1st Qu.: 0.000          1st Qu.: 1.000      
##  Median :16.00             Median : 1.000          Median : 2.000      
##  Mean   :15.82             Mean   : 1.014          Mean   : 2.646      
##  3rd Qu.:24.00             3rd Qu.: 2.000          3rd Qu.: 4.000      
##  Max.   :31.00             Max.   :19.000          Max.   :50.000      
##      adults         children           babies                meal      
##  Min.   :0.000   Min.   : 0.0000   Min.   : 0.00000   Length   :85119  
##  1st Qu.:2.000   1st Qu.: 0.0000   1st Qu.: 0.00000   N.unique :    4  
##  Median :2.000   Median : 0.0000   Median : 0.00000   N.blank  :    0  
##  Mean   :1.882   Mean   : 0.1402   Mean   : 0.01064   Min.nchar:    2  
##  3rd Qu.:2.000   3rd Qu.: 0.0000   3rd Qu.: 0.00000   Max.nchar:    2  
##  Max.   :4.000   Max.   :10.0000   Max.   :10.00000                    
##    market_segment  reserved_room_type   customer_type        adr        
##  Length   :85119   Length   :85119    Length   :85119   Min.   :  0.26  
##  N.unique :    7   N.unique :    9    N.unique :    4   1st Qu.: 74.75  
##  N.blank  :    0   N.blank  :    0    N.blank  :    0   Median : 99.00  
##  Min.nchar:    6   Min.nchar:    1    Min.nchar:    5   Mean   :108.48  
##  Max.nchar:   13   Max.nchar:    1    Max.nchar:   15   3rd Qu.:135.00  
##                                                         Max.   :510.00  
##  required_car_parking_spaces total_of_special_requests
##  Min.   :0.00000             Min.   :0.0000           
##  1st Qu.:0.00000             1st Qu.:0.0000           
##  Median :0.00000             Median :1.0000           
##  Mean   :0.08472             Mean   :0.7017           
##  3rd Qu.:0.00000             3rd Qu.:1.0000           
##  Max.   :8.00000             Max.   :5.0000
# Headline ADR statistics after cleaning
hotels_clean %>%
  summarise(n = n(), mean_adr = mean(adr), median_adr = median(adr),
            min_adr = min(adr), max_adr = max(adr)) %>%
  kable(digits = 2, format.args = list(big.mark = ",")) %>%
  kable_styling(full_width = FALSE)
n mean_adr median_adr min_adr max_adr
85,119 108.48 99 0.26 510

Key descriptive points:

  • Bookings are mostly adults, with few children and babies.
  • Bed & Breakfast (BB) is by far the most popular meal plan.
  • Online travel agencies (Online TA) are the largest market segment.
  • Room type A is the most frequently reserved, and Transient is the most common customer type.

Exploratory Data Analysis

4.1 Approach: new variables and sliced data

A plot of raw columns would only repeat what the data already say. To uncover information that is not self-evident, we (1) create new variables that combine raw columns, (2) slice the data by hotel, arrival season, market segment, lead time and guest type, and (3) join separate summary tables (for example, booking share and implied revenue by segment) to answer questions the raw table cannot answer directly.

# New variables built from the cleaned data
hotels_eda <- hotels_clean %>%
  mutate(
    total_nights = stays_in_weekend_nights + stays_in_week_nights,
    total_guests = adults + children + babies,
    stay_revenue = adr * total_nights,                      # implied room revenue of the booking (ADR x nights)
    weekend_share = if_else(total_nights > 0,
                            stays_in_weekend_nights / total_nights, NA_real_),
    party_type = case_when(
      children + babies > 0 ~ "Family with children",
      adults == 1           ~ "Solo traveller",
      adults == 2           ~ "Two adults",
      TRUE                  ~ "Group of 3+ adults"),
    party_type = factor(party_type,
                        levels = c("Solo traveller", "Two adults",
                                   "Group of 3+ adults", "Family with children")),
    stay_length = cut(total_nights, breaks = c(-Inf, 1, 3, 7, Inf),
                      labels = c("0-1 nights", "2-3 nights", "4-7 nights", "8+ nights")),
    special_requests = factor(pmin(total_of_special_requests, 3),
                              levels = 0:3, labels = c("0", "1", "2", "3+")),
    arrival_date_month = factor(arrival_date_month, levels = month.name),
    lead_time_category = case_when(
      lead_time <= 7  ~ "Last-minute (0-7 days)",
      lead_time <= 30 ~ "Short-term (8-30 days)",
      TRUE            ~ "Long-term (31+ days)"),
    lead_time_category = factor(lead_time_category,
                                levels = c("Last-minute (0-7 days)",
                                           "Short-term (8-30 days)",
                                           "Long-term (31+ days)"))
  )

# Trim plots at the 99th percentile of ADR so a few high rates do not squash the scale
adr_p99 <- quantile(hotels_eda$adr, 0.99)
New variables created for the EDA
New variable Definition
total_nights Weekend + week nights booked
total_guests Adults + children + babies
stay_revenue ADR x total nights (implied room revenue of the booking)
weekend_share Share of nights that fall on a weekend
party_type Solo traveller / two adults / group of 3+ adults / family with children
stay_length Total nights grouped into 0-1, 2-3, 4-7 and 8+
special_requests Number of special requests, capped at 3+
lead_time_category Last-minute (0-7 days), Short-term (8-30 days), Long-term (31+ days)

4.2 Do the two hotels charge different rates?

# Summary table by hotel
hotel_summary <- hotels_eda %>%
  group_by(hotel) %>%
  summarise(bookings = n(), mean_adr = mean(adr), median_adr = median(adr),
            mean_lead = mean(lead_time), mean_nights = mean(total_nights),
            .groups = "drop")

hotel_summary %>%
  rename(Hotel = hotel, Bookings = bookings, `Mean ADR` = mean_adr,
         `Median ADR` = median_adr, `Mean lead time (days)` = mean_lead,
         `Mean nights` = mean_nights) %>%
  nice_table("ADR and booking profile by hotel", highlight = which.max(hotel_summary$mean_adr))
ADR and booking profile by hotel
Hotel Bookings Mean ADR Median ADR Mean lead time (days) Mean nights
City Hotel 52,316 113.20 106.25 78.64 3.17
Resort Hotel 32,803 100.95 80.00 83.90 4.44
# One point: the two hotels sit at different price levels
ggplot(hotels_eda, aes(x = hotel, y = adr, fill = hotel)) +
  geom_boxplot(outlier.alpha = 0.1, show.legend = FALSE) +
  scale_fill_manual(values = hotel_cols) +
  coord_cartesian(ylim = c(0, adr_p99)) +
  labs(title = "ADR distribution by hotel",
       subtitle = "Y-axis trimmed at the 99th percentile for readability",
       x = NULL, y = "ADR (average daily rate)")

Insight.

  • A two-tiered pricing structure is evident at the Resort Hotel (characterized by significant seasonal/dynamic pricing): the gap between the Mean ADR (100.95) and the Median ADR (80.00) is 20.95 units—three times the difference observed at the City Hotel (6.95). When considered alongside the very wide interquartile range (IQR) on the chart, this indicates that the Resort Hotel employs a highly dynamic, season-based pricing strategy: offering very low rates to fill rooms during the off-peak season, while raising prices to levels comparable to-or even exceeding-those of the City Hotel during the peak tourist season.

  • Stable and elevated price levels at City Hotels: The interquartile range (IQR) box for City Hotels is notably narrower and positioned at a higher level, reflecting a consistent, year-round demand for urban or business-related stays. This sustains a solid price floor (~85) and reduces the need for the deep discounting often seen in the resort segment.

  • The trade-off between price per night and length of stay: Although the price per night is lower, guests at resort hotels stay for longer periods (a mean of 4.44 nights, compared to 3.17 nights at city hotels). This helps to partially offset the total revenue per booking for the resort segment.

4.3 Does seasonality look the same at both hotels?

# Average ADR and booking volume per hotel and arrival month (months in calendar order)
monthly <- hotels_eda %>%
  group_by(hotel, arrival_date_month) %>%
  summarise(avg_adr = mean(adr), bookings = n(), .groups = "drop") %>%
  group_by(hotel) 

ggplot(monthly, aes(x = arrival_date_month, y = avg_adr, colour = hotel, group = hotel)) +
  geom_line(linewidth = 1) +
  geom_point(size = 2) +
  scale_colour_manual(values = hotel_cols) +
  labs(title = "Average ADR by arrival month",
       x = "Arrival month", y = "Average ADR", colour = "Hotel") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

# Peak and trough month for each hotel
season_range <- monthly %>%
  group_by(hotel) %>%
  summarise(peak_month = as.character(arrival_date_month[which.max(avg_adr)]),
            peak_adr   = max(avg_adr),
            low_month  = as.character(arrival_date_month[which.min(avg_adr)]),
            low_adr    = min(avg_adr),
            swing_pct  = 100 * (max(avg_adr) / min(avg_adr) - 1),
            .groups = "drop")

season_range %>%
  rename(Hotel = hotel, `Peak month` = peak_month, `Peak ADR` = peak_adr,
         `Lowest month` = low_month, `Lowest ADR` = low_adr,
         `Peak vs lowest (%)` = swing_pct) %>%
  nice_table("Seasonal range of average ADR by hotel", digits = 1)
Seasonal range of average ADR by hotel
Hotel Peak month Peak ADR Lowest month Lowest ADR Peak vs lowest (%)
City Hotel May 129.8 January 87.1 49.1
Resort Hotel August 189.1 November 50.0 278.4

Insight.

  • Resort Hotel exhibits a very sharp spike: prices surged from May (~82) to a peak of 189.1 in August, before plummeting vertically to a low of 50.0 in November. City Hotel follows a plateau pattern: prices rose from March to a peak of 129.8 in May, then remained stable within the ~120–130 range for six months (from April to September) before gradually cooling off as winter approached.

  • Resort hotels are heavily dependent on the traditional summer vacation period for families and beach-goers, leading to excessive demand in July and August—which drives prices to extremely high levels—and significant overcapacity during the winter, forcing deep price cuts (often by 50–65%) just to keep operations running.

  • City hotels are supported by a steady stream of business travelers, conference attendees, and urban tourists from spring through autumn, which helps keep rates stable and prevents sharp declines.

4.5 Which market segments matter, in price and in revenue?

We join three separate summaries (booking counts, ADR statistics, implied revenue) into one table.

# Join separate summary tables by market segment
seg_counts <- hotels_eda %>% count(market_segment, name = "bookings")
seg_price  <- hotels_eda %>%
  group_by(market_segment) %>%
  summarise(mean_adr = mean(adr), median_adr = median(adr),
            revenue = sum(stay_revenue), .groups = "drop")

segment_tbl <- seg_counts %>%
  left_join(seg_price, by = "market_segment") %>%
  mutate(booking_share = 100 * bookings / sum(bookings),
         revenue_share = 100 * revenue / sum(revenue),
         revenue_index = revenue_share / booking_share) %>%   # > 1 = earns more than its share of bookings
  arrange(desc(mean_adr))

segment_tbl %>%
  select(market_segment, bookings, booking_share, mean_adr, median_adr,
         revenue_share, revenue_index) %>%
  rename(`Market segment` = market_segment, Bookings = bookings,
         `Booking share (%)` = booking_share, `Mean ADR` = mean_adr,
         `Median ADR` = median_adr, `Revenue share (%)` = revenue_share,
         `Revenue index` = revenue_index) %>%
  nice_table("Market segments: price level and share of implied revenue",
             highlight = which.max(segment_tbl$revenue_share))
Market segments: price level and share of implied revenue
Market segment Bookings Booking share (%) Mean ADR Median ADR Revenue share (%) Revenue index
Online TA 51,228 60.18 119.00 111.15 65.13 1.08
Direct 11,499 13.51 118.30 108.00 13.97 1.03
Aviation 222 0.26 102.43 95.00 0.24 0.93
Offline TA/TO 13,464 15.82 82.72 80.00 15.48 0.98
Groups 4,513 5.30 78.12 70.00 3.44 0.65
Corporate 4,131 4.85 69.34 65.00 1.73 0.36
Complementary 62 0.07 34.53 20.00 0.01 0.20
# One point: price level differs strongly across segments (ordered by median ADR)
ggplot(hotels_eda, aes(x = fct_reorder(market_segment, adr, .fun = median), y = adr)) +
  geom_boxplot(outlier.alpha = 0.1, fill = "grey85") +
  coord_flip(ylim = c(0, adr_p99)) +
  labs(title = "ADR by market segment",
       subtitle = "Segments ordered by median ADR",
       x = NULL, y = "ADR")

Insight.

  • The dominance of Online Travel Agencies (OTAs) and their advantage in revenue performance (Revenue index > 1): OTAs not only account for approximately 60.2% of total bookings but also generate a share of revenue that exceeds their share of bookings (+4.95 percentage points, Revenue index = 1.08). This indicates that guests booking through online channels tend to pay a higher Average Daily Rate (ADR) and stay for longer periods compared to the overall average. However, relying on OTAs for nearly two-thirds of total revenue also entails risks, such as commission costs and pressure to remain price-competitive.

  • The power of the Direct channel: Although it accounts for 13.51% of bookings, the Direct channel achieves an average price nearly equivalent to that of Online Travel Agencies (OTAs) (mean of 118.30 vs. 119.00) and holds a revenue index of 1.03 (contributing 13.97% of total revenue). This is a high-value channel with significant potential for profit margin optimization if direct conversions are further increased.

  • market_segment is a categorical variable with a very strong capacity to differentiate price levels (the difference in the median value between “Online TA” and “Corporate/Complementary” segments reaches as much as 45–90 units).

4.6 Who pays more: solo travellers, couples, groups or families?

# Average ADR by type of party and hotel
party_tbl <- hotels_eda %>%
  group_by(hotel, party_type) %>%
  summarise(bookings = n(), mean_adr = mean(adr), .groups = "drop")

# One point: ADR differs by guest composition
ggplot(party_tbl, aes(x = party_type, y = mean_adr, fill = hotel)) +
  geom_col(position = position_dodge(width = 0.9)) +
  geom_text(aes(label = round(mean_adr)), position = position_dodge(width = 0.9),
            vjust = -0.3, size = 3) +
  scale_fill_manual(values = hotel_cols) +
  labs(title = "Average ADR by type of party", x = NULL, y = "Average ADR", fill = "Hotel")

party_all <- hotels_eda %>%
  group_by(party_type) %>%
  summarise(bookings = n(), mean_adr = mean(adr), .groups = "drop")

Insight.

  • Impact of party size on pricing: Shifting from 1–2 guests to a group of 3 or more adults, or families with children, leads to a sharp increase in the Average Daily Rate (ADR)- rising by approximately 50–60+ units for resort hotels and 46–57 units for city hotels compared to bookings for two adults. This trend reflects the selection of larger rooms or room categories, additional charges for extra guests or children, and a greater concentration of stays during peak periods (particularly among families and larger groups).

  • For groups of 3 or more adults and families with children, the figures for resort hotels are higher (158 vs 154; 163 vs 152), indicating that families and groups are willing to pay more when staying at resorts, particularly during peak vacation periods.

  • A significant disparity exists for solo travelers at resort hotels (~58) compared to city hotels (~97). Solo travelers at resorts pay substantially lower rates than those at city hotels, and also significantly less than families staying at the same resorts (~58 vs ~163). This suggests that solo travelers at resorts may be visiting during the off-peak season, booking smaller standard rooms or taking advantage of special offers, or otherwise representing a booking profile that differs considerably from that of family groups.

4.7 How service requirements and room types affect the price?

# Average ADR by number of special requests
req_tbl <- hotels_eda %>%
  group_by(special_requests) %>%
  summarise(bookings = n(), mean_adr = mean(adr), .groups = "drop")

# One point: ADR across the number of special requests
ggplot(req_tbl, aes(x = special_requests, y = mean_adr)) +
  geom_col(fill = "grey60") +
  geom_text(aes(label = round(mean_adr, 1)), vjust = -0.3) +
  labs(title = "Average ADR by number of special requests",
       x = "Special requests per booking", y = "Average ADR")

# Meal plan table
meal_tbl <- hotels_eda %>%
  group_by(meal) %>%
  summarise(bookings = n(), mean_adr = mean(adr), median_adr = median(adr), .groups = "drop") %>%
  arrange(desc(mean_adr))

meal_tbl %>%
  rename(`Meal plan` = meal, Bookings = bookings, `Mean ADR` = mean_adr, `Median ADR` = median_adr) %>%
  nice_table("ADR by meal plan (BB = bed & breakfast, HB = half board, FB = full board, SC = no meal package)",
             highlight = 1)
ADR by meal plan (BB = bed & breakfast, HB = half board, FB = full board, SC = no meal package)
Meal plan Bookings Mean ADR Median ADR
FB 344 149.96 139.05
HB 8,936 135.49 121.00
BB 66,579 105.76 98.00
SC 9,260 100.46 97.00
room_tbl <- hotels_eda %>%
  group_by(reserved_room_type) %>%
  summarise(bookings = n(),
            mean_adr = mean(adr),
            median_adr = median(adr),
            .groups = "drop") %>%
  mutate(booking_share = 100 * bookings / sum(bookings)) %>%
  arrange(desc(median_adr))

room_tbl %>%
  select(reserved_room_type, bookings, booking_share, mean_adr, median_adr) %>%
  rename(`Reserved room type` = reserved_room_type,
         Bookings = bookings,
         `Booking share (%)` = booking_share,
         `Mean ADR` = mean_adr,
         `Median ADR` = median_adr) %>%
  nice_table("ADR and booking share by reserved room type",
             highlight = which.max(room_tbl$median_adr))
ADR and booking share by reserved room type
Reserved room type Bookings Booking share (%) Mean ADR Median ADR
H 590 0.69 190.68 185.00
G 1,959 2.30 184.12 180.00
F 2,740 3.22 172.30 177.30
C 872 1.02 163.47 164.78
L 6 0.01 124.67 143.00
D 17,151 20.15 123.36 123.30
E 5,907 6.94 128.19 117.00
A 54,931 64.53 94.34 90.00
B 963 1.13 93.58 88.77

Insight.

  • There is a steady, linear increase in relation to “special requests”: each additional special request raises the average ADR by a fairly consistent margin of approximately 9 units (102.0 → 111.4 → 120.5 → 129.2). Although many special requests—such as a high-floor room, a double bed, or a baby crib—do not incur direct charges, they serve as a proxy for a higher-spending customer segment. These guests tend to book higher-tier room categories or use direct/personalized booking channels (such as Online Travel Agencies or direct bookings), as opposed to being part of low-rate group bookings.

  • BB (Bed & Breakfast) is the most common standard package, accounting for 78.2% of total bookings (66,579 reservations) with a median ADR of 98.00—only slightly higher than the SC (room-only) category (median 97.00, mean 100.46).

  • In contrast, when guests opt for HB (Half Board) or FB (Full Board) packages, the price increases significantly—by 23.00 and 41.05 units, respectively, in terms of the median (reaching 121.00 and 139.05). This price differential reflects the cost of dining services bundled directly into the room rate and is typically associated with all-inclusive-style stays at resort hotels.

  • High volume correlates with lower prices, while high prices correspond to lower volume: Categories A and D combined account for 84.68% of total bookings (72,082 bookings), serving as the backbone for both volume and room liquidity; meanwhile, higher-tier categories (H, G, F, and C) command higher rates per night but represent a significantly smaller scale.

Model

5.1 Modelling data

Reference levels (the categories every coefficient is compared with): City Hotel, and the most frequent segment, customer type, room type and meal plan.

# Modelling data: choose the predictors and use the most common category as the reference level
model_data <- hotels_eda %>%
  select(adr, hotel, lead_time, market_segment, customer_type,
         reserved_room_type, adults, children, meal,
         total_of_special_requests, required_car_parking_spaces) %>%
  mutate(across(c(market_segment, customer_type, reserved_room_type, meal), fct_infreq),
         across(where(is.factor), droplevels))

5.2 Building the model step by step

We add one group of factors at a time (hotel, then timing, then customer, then room and services) to see how much each group adds.

# Nested linear models: each one adds a group of predictors to the previous one
m_hotel    <- lm(adr ~ hotel, data = model_data)
m_timing   <- update(m_hotel,    . ~ . + lead_time)
m_customer <- update(m_timing,   . ~ . + market_segment + customer_type + adults + children)
m_full     <- update(m_customer, . ~ . + reserved_room_type + meal +
                       total_of_special_requests + required_car_parking_spaces)

models <- list("1. Hotel only"                 = m_hotel,
               "2. + Timing"                   = m_timing,
               "3. + Customer"                 = m_customer,
               "4. + Room and services (full)" = m_full)


model_compare <- bind_rows(lapply(names(models), function(nm) {
  g <- glance(models[[nm]])
  tibble(Model = nm, Predictors = g$df, `Adj. R-squared` = g$adj.r.squared,
         `Residual SE` = g$sigma)
}))

nice_table(model_compare, "Model comparison: adding one group of predictors at a time",
           digits = 3, highlight = nrow(model_compare))
Model comparison: adding one group of predictors at a time
Model Predictors Adj. R-squared Residual SE
  1. Hotel only
1 0.014 49.744
    • Timing
2 0.014 49.742
    • Customer
13 0.296 42.036
    • Room and services (full)
26 0.427 37.937

Throughout the process of building a stepwise linear regression model, the model’s quality improved markedly as additional groups of predictor variables were incorporated: the Adjusted R-squared value rose from 0.014 (in the model containing only the hotel variable) to 0.427 (in the full model with 26 variables), while the Residual Standard Error (Residual SE) decreased from 49.744 to 37.937. Specifically, the lead_time variable (introduced in step 2) resulted in only a marginal change; the group of customer characteristic variables (added in step 3) yielded the most significant leap in explanatory power (increasing the Adjusted R-squared to 0.296); and the group of variables related to room types and services (added in step 4) further enhanced the model’s accuracy substantially.

5.3 What is associated with ADR?

# Coefficients with 95% confidence intervals
coef_tbl <- tidy(m_full, conf.int = TRUE) %>%
  filter(term != "(Intercept)")

# One point: the 15 terms with the strongest statistical signal
coef_tbl %>%
  slice_max(abs(statistic), n = 15) %>%
  mutate(term = fct_reorder(term, estimate)) %>%
  ggplot(aes(x = estimate, y = term)) +
  geom_vline(xintercept = 0, linetype = "dashed", colour = "grey50") +
  geom_pointrange(aes(xmin = conf.low, xmax = conf.high)) +
  labs(title = "Strongest associations with ADR in the full model",
       subtitle = "Estimate and 95% confidence interval, compared with the reference category",
       x = "Difference in ADR (currency units per night)", y = NULL)

# Full coefficient table
m1 <- lm(adr ~ hotel + lead_time + market_segment + customer_type +
           reserved_room_type + adults + children + meal +
           total_of_special_requests + required_car_parking_spaces,
         data = model_data)

  as.data.frame(summary(m1)$coefficients) %>%
  nice_table("Preliminary regression of ADR (coefficients are associations)", digits = 3) %>%
  scroll_box(height = "400px")
Preliminary regression of ADR (coefficients are associations)
Estimate Std. Error t value Pr(>&#124;t&#124;)
(Intercept) 77.910 0.624 124.760 0.000
hotelResort Hotel -25.764 0.307 -83.802 0.000
lead_time -0.010 0.002 -6.401 0.000
market_segmentOffline TA/TO -28.982 0.413 -70.113 0.000
market_segmentDirect -1.131 0.412 -2.748 0.006
market_segmentGroups -28.147 0.710 -39.644 0.000
market_segmentCorporate -21.578 0.675 -31.982 0.000
market_segmentAviation -1.848 2.577 -0.717 0.473
market_segmentComplementary -78.851 4.824 -16.346 0.000
customer_typeTransient-Party 0.545 0.457 1.192 0.233
customer_typeContract -3.278 0.719 -4.560 0.000
customer_typeGroup -6.148 1.695 -3.628 0.000
reserved_room_typeD 18.507 0.357 51.870 0.000
reserved_room_typeE 30.979 0.546 56.772 0.000
reserved_room_typeF 47.431 0.848 55.907 0.000
reserved_room_typeG 63.187 1.024 61.703 0.000
reserved_room_typeB -19.829 1.269 -15.621 0.000
reserved_room_typeC 45.227 1.408 32.125 0.000
reserved_room_typeH 67.972 1.661 40.918 0.000
reserved_room_typeL 36.873 15.495 2.380 0.017
adults 16.975 0.296 57.278 0.000
children 16.932 0.380 44.576 0.000
mealSC -9.666 0.463 -20.879 0.000
mealHB 36.403 0.447 81.513 0.000
mealFB 65.352 2.066 31.635 0.000
total_of_special_requests 2.182 0.167 13.029 0.000
required_car_parking_spaces 3.735 0.480 7.787 0.000

A few noteworthy points:

  • Reserved_room_type: Compared to the most common room category (category A), higher-tier categories lead to a sharp increase in price: category H (+67,972), G (+63,187), F (+47,431), C (+45,227), E (+30,979), and D (+18,507), all with p < 0.001.

  • Meal: Compared to the most common plan (BB), the full-board (FB) plan (+65.352, p < 0.001) and the half-board (HB) plan (+36.403, t = 81.513, p < 0.001) are both strong factors that drive up the price.

  • Adults and Children: Each adult (+16.975) and each child (+16.932) increases the ADR by an almost equal amount (p < 0.001).

  • Market_segments: Compared to the most popular channel (Online Travel Agencies – OTAs), wholesale/contracted channels offer significantly lower rates: Offline Travel Agencies/Tour Operators (Offline TA/TO: -28.982, t = -70.113), Groups (-28.147), and Corporate (-21.578). Meanwhile, direct bookings (-1.131) are only marginally lower than those made through Online TA.

  • Hotel: When controlling for other factors, a Resort Hotel is associated with a value 25.764 units/night lower than that of a City Hotel (t = -83.802, p < 0.001 — the variable with the strongest statistical significance in the entire model).

  • Variables with statistical significance but small practical impact: required_car_parking_spaces (+3.735), total_special_requests (+2.182), and lead_time (-0.010) all have p < 0.001; however, the monetary difference per unit is so small that they do not rank among the top 15.

Insight:

  • Service configuration is the most powerful lever for driving rate increases: Upgrading room categories (particularly to groups C, F, G, and H) and bundling meal plans (Half Board or Full Board) generate a significantly higher boost to the Average Daily Rate (ADR) than any other factor. This area offers the greatest potential for effective upselling and the creation of bundled packages.

  • Sales channel strategy determines the scale of discounting: Online Travel Agencies (OTAs) and direct bookings maintain the highest price points, whereas offline travel agencies/tour operators (TA/TO), group bookings, and corporate segments see significant price reductions—ranging from 21.6 to 29.0 units per night. Hotels must carefully manage the proportion of room inventory allocated to wholesale channels to avoid depressing the overall Average Daily Rate (ADR).

  • Consistent per-person surcharges with minimal impact from booking lead time: The pricing model clearly reflects the scale of the stay—adding an adult or a child increases the cost by approximately 17 units per night—whereas the timing of the booking (lead_time) has virtually no effect on the actual price once other factors are controlled fo

Summary

6.1 Problem statement

Hotel managers must set nightly rates (ADR) in a market where timing, guest type, market segment, services and the property itself all move prices. We asked: how do booking characteristics and customer segments relate to the hotel’s average daily rate?

6.2 How we addressed it

We used the public hotel booking demand dataset (two Portuguese hotels, July 2015 to August 2017, 119,390 raw records). WWe checked exact duplicates before dropping columns, removed variables that are not relevant to pricing, inspected negative, zero and extreme ADR values before deciding what to remove (85,119 records remain), created new variables (arrival season, party type, stay length, implied revenue), and used slicing, joined summary tables, plots and styled tables for the EDA. We also built nested linear regression models (with hotel included), tested the full model on held-out bookings, and checked residuals, multicollinearity and the effect of our data decisions.

6.3 Interesting insights

  • There is a clear distinction between resort hotels and city hotels: resort hotels operate with a highly flexible, seasonal pricing strategy characterized by a wide range of fluctuations (with a 20.95-unit gap between the mean and the median—peaking at 189.1 in August and bottoming out at 50.0 in November) and longer average lengths of stay (4.44 nights, compared to 3.17 nights for city hotels). In contrast, city hotels maintain stable, consistently high price levels throughout the year, supported by a steady base of business and urban-leisure travelers.

  • Ancillary products serve as the most powerful lever for increasing rates: Room upgrades (especially to premium categories such as C, F, G, or H) and the inclusion of meal plans (Half Board or Full Board) drive significantly higher Average Daily Rates (ADR) compared to standard Bed & Breakfast (BB) or self-catering (SC) options-offering the greatest potential for upselling and service bundling strategies.

  • The trade-off between high volume and high rates: Standard room categories—such as A and D—account for 84.68% of total bookings (serving as the primary drivers of volume and room liquidity), while the “BB” package accounts for 78.2%; meanwhile, premium room categories command higher rates per night but represent a smaller share of the total inventory.

  • The leading role of Online Travel Agencies (OTAs) and the potential of the direct booking channel: OTAs account for approximately 60.2% of bookings, with a revenue index of 1.08—outperforming their share of total bookings due to favorable room rates and longer lengths of stay—though this comes with the trade-offs of commission costs and competitive pressure. Meanwhile, the direct channel (representing ~13.51% of bookings) achieves price levels comparable to those of OTAs (118.30 versus 119.00) and offers the best potential for maximizing profit margins, provided that conversion rates can be increased.

  • Deep discounting in the wholesale, group, and corporate segments: The “Offline TA/TO” (travel agent/tour operator), “Groups,” “Corporate,” and “Complementary” categories feature significantly lower rates compared to “Online TA” (with reductions of approximately 21.6 to 29.0 units per night across key commercial segments). This highlights the need for strict management of room inventory allocation across each channel.

  • The size of the guest party and the number of special requests are indicative of higher spending: groups of three or more adults, or families with children, drive a significant increase in the Average Daily Rate (ADR)—particularly at resorts during peak season—whereas individual guests at resorts tend to pay much lower rates compared to families or solo travelers staying at city hotels. Furthermore, the number of special requests correlates positively with the ADR (showing an average of ~9 requests per booking in descriptive statistics, and a coefficient of +2.182 in the multivariate regression), serving as a reliable indicator for identifying higher-spending guest segments.

  • Distinguishing between statistical significance and practical impact: The lead time variable is statistically significant due to the large sample size; however, its coefficient in the full model is only -0.010. This indicates that the timing of a booking—whether made early or late—has minimal effect on the actual room rate once factors such as property type, sales channel, party size, and included services are controlled for.

6.4 Implications for the consumer

For revenue managers, the results support data-informed pricing: set rates separately for each property, build seasonal and segment-specific rate cards instead of one rate, and treat early booking by itself as a weak pricing signal. For operations and marketing teams, high-revenue segments and party types (see sections 4.5 and 4.6) show where to focus packages and promotions.

6.5 Limitations and how to build on them

  • Association, not causation. The data are observational, so patterns do not prove that a factor causes a higher rate.
  • Scope. Two hotels in Portugal over about two years; the results may not generalise to other markets or periods.
  • Cancelled bookings are included. We removed the cancellation variables, so ADR reflects quoted rates, not necessarily realised revenue. “Implied revenue” is ADR x nights, not accounting revenue.
  • Data decisions. Exact duplicates, zero, negative and one extreme ADR records were removed.
  • Improvements. Future work could add interaction terms (hotel x season, segment x season), more flexible predictive models and clustering of customer behaviour (covered in Data Mining), and external data such as holidays, events and competitor rates.