In Class Exercise

Exercise 1

Find out the number of days you have spent at NCKU as a registered student or staff person.

## [1] 1239

Exercise

Exercise 1

Use the dataset containing the average number of visitors (monthly) in New Zealand by country of residence to explore the seasonal patterns between the eight countries. Is there a hemisphere effect?

## 'data.frame':    170 obs. of  13 variables:
##  $ Month    : Factor w/ 170 levels "1998M09","1998M10",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ Australia: int  17244 18090 16750 25909 27228 19461 19200 19595 12564 10987 ...
##  $ ChinaPRof: int  748 941 1054 1270 1375 1660 1456 1488 1449 1413 ...
##  $ Japan    : int  6093 5039 6112 6670 6008 7478 7341 5030 4275 3758 ...
##  $ Korea    : int  979 1083 1144 1836 2716 2245 1611 1416 1192 1255 ...
##  $ Germany  : int  1320 2459 5195 5499 6430 7320 6094 3157 1450 765 ...
##  $ UK       : int  5794 7876 13362 20238 22557 27477 20187 13448 8587 7271 ...
##  $ Canada   : int  973 1418 2236 2935 3623 4394 3573 1795 1160 903 ...
##  $ USA      : int  3837 6093 8468 7865 10007 12533 10519 6737 4932 4845 ...
##  $ Total    : int  57930 68203 84370 113853 122130 124305 104106 83414 59800 52426 ...
##  $ month    : num  9 10 11 12 1 2 3 4 5 6 ...
##  $ year     : num  1998 1998 1998 1998 1999 ...
##  $ Season   : chr  "Q3" "Q4" "Q4" "Q4" ...
##       Month Australia ChinaPRof Japan Korea Germany   UK Canada  USA  Total
## 165 2012M05     20427      7737  2485  2148    6580 8074   2110 7030  99726
## 166 2012M06     21778      6670  2332  1961    5080 6323   1228 6759  89954
## 167 2012M07     29769      7962  3045  2906    4255 6400   1426 6459 103420
## 168 2012M08     26851      8523  5069  3288    3949 7026   1311 5293 100307
## 169 2012M09     30013      7522  3200  2217    4431 6390   1213 5252  94542
## 170 2012M10     27599      8535  2863  2270    6446 9431   1940 6911 102982
##     month year Season
## 165     5 2012     Q2
## 166     6 2012     Q2
## 167     7 2012     Q3
## 168     8 2012     Q3
## 169     9 2012     Q3
## 170    10 2012     Q4

Conclusion: Average number of visitors had seasonal effect. New Zealand had higher average number of visitors in summer (Q1).

Exercise 3

Use the following sample of records for profit made, arrival date, and departure date of group travel booked at a travel agency in Taiwan to estimate the mean profit per day of service.

## 'data.frame':    96 obs. of  3 variables:
##  $ Expense : int  15393 27616 8876 57378 32613 46998 10744 3269 16195 55842 ...
##  $ Arrival : Factor w/ 83 levels "2014/10/10","2014/10/13",..: 79 83 78 74 75 31 31 26 29 77 ...
##  $ Depature: Factor w/ 79 levels "2014/10/1","2014/10/13",..: 73 77 73 76 75 32 69 26 28 73 ...
##   Expense    Arrival   Depature
## 1   15393  2015/2/16  2015/2/17
## 2   27616   2015/3/6  2015/3/11
## 3    8876  2015/2/14  2015/2/17
## 4   57378  2015/1/30   2015/2/9
## 5   32613  2015/1/31   2015/2/6
## 6   46998 2014/12/27 2014/12/31
##   revenue.mean
## 1     5522.453

Exercise 4

The following rather awful plot is shown on a web page hosted by the Taiwanese Ministry of Education
...

Revise it so that it is a proper time series plot. For your convenience, the data points have been extracted and saved here . What had happened in the early 1990’s and how do we know if the trend reversal is real? You may want to augment the data set with further data points from 2012 to 2018 available in the foreign students in the U.S. data file.

## 'data.frame':    23 obs. of  1 variable:
##  $ V1: int  3637 2553 4564 6780 12029 12250 17560 22590 30960 33530 ...
##      V1
## 1  3637
## 2  2553
## 3  4564
## 4  6780
## 5 12029
## 6 12250

Forecast

Exercise 5

How different groups spend their day is an article published in The New York Times using the data collected from The American Time Use Survey. Discuss what we need to have in order to replicate this piece of graphical journalism in Taiwan.
...

We need to collect subjects’ (1)gender, (2)employment status, (3)ethnicity, (4)age, (5)education level, (6)how many child they have and (8) activity, (9) activity initiating time and (10) activity end time. Then turn the data to time series data, calculate percentage of each activity in each time period.