Hotel Data

Apurva
30/10/2017

Hotels <- read.csv(paste("AllCitiesData.csv", sep=""))
summary(Hotels)
    CityName      Population         CityRank     IsTouristDestination
 Jaipur : 765   Min.   :   8096   Min.   : 3.00   No :2168            
 Goa    : 624   1st Qu.: 595575   1st Qu.: 9.00   Yes:4299            
 Kochi  : 608   Median :1457723   Median :15.00                       
 Pune   : 600   Mean   :1515470   Mean   :16.03                       
 Udaipur: 456   3rd Qu.:2490891   3rd Qu.:23.00                       
 Agra   : 432   Max.   :4467797   Max.   :37.00                       
 (Other):2982                                                         
 IsWeekend  IsNewYearEve          Date     
 No :2424   No :5658     Dec 25 2016: 810  
 Yes:4043   Yes: 809     Dec 28 2016: 810  
                         Dec 18 2016: 809  
                         Dec 21 2016: 809  
                         Dec 24 2016: 809  
                         Dec 31 2016: 809  
                         (Other)    :1611  
                             HotelName       RoomRent       StarRating   
 Apnayt Villa                     :  16   Min.   :  299   Min.   :0.000  
 Fortune Hotel The South Park     :  16   1st Qu.: 2482   1st Qu.:3.000  
 Golden Tulip Chandigarh Panchkula:  16   Median : 4000   Median :3.000  
 Goldfinch Hotel                  :  16   Mean   : 6025   Mean   :3.424  
 Holiday Inn Chandigarh Panchkula :  16   3rd Qu.: 6499   3rd Qu.:4.000  
 Hotel City Park                  :  16   Max.   :75000   Max.   :5.000  
 (Other)                          :6371                                  
    Airport     
 Min.   : 0.20  
 1st Qu.: 6.20  
 Median :12.00  
 Mean   :15.17  
 3rd Qu.:22.50  
 Max.   :61.00  

                                                      HotelAddress 
 14-4507/9, Balmatta Road, Near Jyothi Circle, Hampankatta  :  16  
 57/1,Tamil Sangam Road, Simmakkal, Madurai, 625001, India  :  16  
 B-4/25, Shivala Ghat, Nepali Kothi, Varanasi, Uttar Pradesh:  16  
 Chowara Beach, Kovalam, Chowara, Kerala                    :  16  
 Circuit House Road,,Jodhpur,Rajasthan,India                :  16  
 Fatehabad Road, Agra, Uttar Pradesh, 282001 India          :  16  
 (Other)                                                    :6371  
  HotelPincode                                  HotelDescription
 Min.   :134109   3-star Jaipur hotel with restaurant   :  64   
 1st Qu.:282001   Abc                                   :  64   
 Median :342802   Jaipur hotel next to shopping         :  56   
 Mean   :388606   3 lmn                                 :  40   
 3rd Qu.:411057   3-star Jaisalmer hotel with restaurant:  40   
 Max.   :781022   3-star hotel in Pune                  :  40   
                  (Other)                               :6163   
 FreeWifi   FreeBreakfast HotelCapacity    HasSwimmingPool
 No : 542   No :2504      Min.   :  1.00   No :3867       
 Yes:5925   Yes:3963      1st Qu.: 15.00   Yes:2600       
                          Median : 30.00                  
                          Mean   : 49.55                  
                          3rd Qu.: 64.00                  
                          Max.   :414.00                  

How many total hotels are there in the sample?

Hotels$id <- paste(Hotels$HotelName, Hotels$CityName)
length(unique(Hotels$id))
[1] 821

How many total cities are there in the sample?

length(unique(Hotels$CityName))
[1] 25

What is the average room rent in the sample?

mean(Hotels$RoomRent)
[1] 6024.896

What is the median room rent in the sample?

median(Hotels$RoomRent)
[1] 4000

List the Tourist destination cities in the sample

TouristDestination <- subset(Hotels, Hotels$IsTouristDestination == "Yes")
length(unique(TouristDestination$CityName))
[1] 13
unique(TouristDestination$CityName)
 [1] Varanasi  Jodhpur   Jaipur    Agra      Udaipur   Kochi     Goa      
 [8] Jaisalmer Srinagar  Madurai   Rishikesh Manali    Amritsar 
25 Levels: Agra Amritsar Bhubaneswar Chandigarh Goa Guwahati ... Varanasi

List the Non-tourist destination cities in the sample

nontourist <- subset(Hotels, Hotels$IsTouristDestination == "No")
length(unique(nontourist$CityName))
[1] 12
unique(nontourist$CityName)
 [1] Thiruvanthipuram Chandigarh       Rajkot           Lucknow         
 [5] Bhubaneswar      Guwahati         Pune             Indore          
 [9] Panchkula        Surat            Mangalore        Kanpur          
25 Levels: Agra Amritsar Bhubaneswar Chandigarh Goa Guwahati ... Varanasi

Create a table showing the count of hotels in Tourist and non-Tourist destinations

mt <- aggregate(id ~ IsTouristDestination, Hotels, function(x) length(unique(x)))
colnames(mt) <- c("Tourist Destination","Count")
mt
  Tourist Destination Count
1                  No   292
2                 Yes   529

Create a table showing the average room rent in Tourist and non-Tourist destinations

mt1 <- aggregate(Hotels$RoomRent ~ Hotels$IsTouristDestination, FUN = mean)
colnames(mt1) <- c("Tourist Destination","Average Rent")
mt1
  Tourist Destination Average Rent
1                  No     4507.500
2                 Yes     6790.124

Plot the average rent in Tourist and non-Tourist destinations

library(gplots)
plotmeans(Hotels$RoomRent ~ Hotels$IsTouristDestination, mean.labels = TRUE, xlab = "Tourist Destination", ylab = "Average Room Rent")

Plot the average rent in Tourist and non-Tourist destinations

plot of chunk unnamed-chunk-11

Compare the average room rent at Tourist destinations with non-Tourist destinations using a suitable statistical test

t.test(Hotels$RoomRent ~ Hotels$IsTouristDestination)

Compare the average room rent at Tourist destinations with non-Tourist destinations using a suitable statistical test


    Welch Two Sample t-test

data:  Hotels$RoomRent by Hotels$IsTouristDestination
t = -14.33, df = 6464.8, p-value < 2.2e-16
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -2594.885 -1970.361
sample estimates:
 mean in group No mean in group Yes 
         4507.500          6790.124 

Create a table counting the number of hotels offering and not-offering swimming pool at Tourist and non-Tourist destinations. Also include the total count of hot

mytable2 <- with(Hotels, tapply(id, list(IsTouristDestination,HasSwimmingPool), FUN = function(x) length(unique(x))))
colnames(mytable2) <- c("SP-No", "SP-Yes")
rownames(mytable2) <- c("TD-No", "TD-Yes")
mt2 <- subset(mytable2, select=c(2,1))
addmargins(mt2)

Create a table counting the number of hotels offering and not-offering swimming pool at Tourist and non-Tourist destinations. Also include the total count of hot

       SP-Yes SP-No Sum
TD-No      93   199 292
TD-Yes    231   300 531
Sum       324   499 823

Compare the proportion of hotels offering swimming pool at Tourist destinations with the proportion of hotels offering swimming pool at non-Tourist destinations, using an appropriate statistical test

prop.table(mt2,1)
          SP-Yes     SP-No
TD-No  0.3184932 0.6815068
TD-Yes 0.4350282 0.5649718
prop.test(mt2)

    2-sample test for equality of proportions with continuity
    correction

data:  mt2
X-squared = 10.236, df = 1, p-value = 0.001377
alternative hypothesis: two.sided
95 percent confidence interval:
 -0.18725936 -0.04581084
sample estimates:
   prop 1    prop 2 
0.3184932 0.4350282 

Create a table summarizing the average room rent at hotels offering and not-offering swimming pool at Tourist and non-Tourist destinations.

a <- aggregate(Hotels$RoomRent ~ Hotels$IsTouristDestination + Hotels$HasSwimmingPool, FUN = mean)
colnames(a)<- c("TouristDest","SwimmingPool","Average Rent")
a
  TouristDest SwimmingPool Average Rent
1          No           No     3328.812
2         Yes           No     3966.258
3          No          Yes     6691.175
4         Yes          Yes    10563.975

Visualize the differences using a suitable type of plot

a$lab <- c("NT-NoPool","T-NoPool","NT-Pool","T-Pool")
barplot(a$`Average Rent`, names.arg = a$lab, ylab = "AVerage Room Rent")

Visualize the differences using a suitable type of plot

plot of chunk unnamed-chunk-20