1. Homepage
  2. Programming
  3. SDSC2005 - Introduction to Computational Social Science - Exercise 4. Time Series Analysis for Predictive Research

SDSC2005 - Introduction to Computational Social Science - Exercise 4. Time Series Analysis for Predictive Research

Engage in a Conversation
Hong KongCity University of Hong KongSDSC2005Introduction to Computational Social ScienceTime Series Analysis for Predictive ResearchPython

SDSC2005-22B CourseNana.COM

Exercise 4. Time Series Analysis for Predictive Research CourseNana.COM

(V3, Feb 28, 2023) CourseNana.COM

  CourseNana.COM

Your EID (required):                                                  CourseNana.COM

Data1: Ex4_data1.xlsx, which contains the following sheets: CourseNana.COM

·      Intraday_data: the price of HSI per minute from Jan 16, 2023 to Feb 13, 2023 (in total of 18 trading days) CourseNana.COM

·      Interday_data: the price of HSI per day from Jan 2, 1987 to Feb 10, 2023 (in total of 9,167 trading days of 36 years) CourseNana.COM

·      Use linear interpolation to fill any empty cell. CourseNana.COM

Task: CourseNana.COM

Identify the following intraday cycles of HSI Price to answer the question that when is the best time of the day to buy (i.e., at the lowest price) and sell (the highest price) stocks on average in HK stock market: CourseNana.COM

1.     Intraday time: CourseNana.COM

a.     Detrend (removing the overall trend of) Price throughout the entire period of the Intraday Data; CourseNana.COM

b.     Use each 30 minutes of trading time as a half-hourly unit within each trading day;[1] CourseNana.COM

c.     Use 1-hot encoding to create the half-hourly variables; CourseNana.COM

d.     Use an OLS regression with Price as the DV and hourly variables as the IVs to measure the effect of “half-hour of the day” on Price; CourseNana.COM

e.     Optional: use alternative way(s) to measure the best time to buy/sell based on OLS regression.[2] CourseNana.COM

2.     Interday time: CourseNana.COM

a.     Detrend Price throughout the entire period of the Interday Data; CourseNana.COM

b.     Use each trading day as a daily unit within each trading week and each month as a monthly unit within each month, respectively; CourseNana.COM

c.     Use 1-hot encoding to create the daily and monthly variable(s), respectively; CourseNana.COM

d.     Use an OLS regression with Price as the DV and daily and monthly variables as the IVs to measure the effect of “day of the week” and “month of the year” on Price, respectively; CourseNana.COM

e.     Optional: use alternative way(s) to create best day/month to buy/sell on the OLS regression report the resulting effect if significantly greater than the 1-hot encoding approach (grading policy: extra point(s) for significantly improved results, depending on the size of the improvement; no penalty for wrong answers). CourseNana.COM

Report: CourseNana.COM

1.     Quantitative findings in Table 1. CourseNana.COM

2.     A summary paragraph to interpret what investors may learn from the results, if any, for their trading strategies. CourseNana.COM

Table 1. Results of OLS Regressions CourseNana.COM

  CourseNana.COM

Intraday Effect (Half-hour of the day) CourseNana.COM

Interday Effect   CourseNana.COM

(Day of the week) CourseNana.COM

Interday Effect (Month of the week) CourseNana.COM

Required: CourseNana.COM

Best time to buy CourseNana.COM

Which half-hour? CourseNana.COM

Which day? CourseNana.COM

Which month? CourseNana.COM

Best time to sell CourseNana.COM

Which half-hour? CourseNana.COM

Which day? CourseNana.COM

Which month? CourseNana.COM

Ratio of sell-to-buy price[3] CourseNana.COM

the s2b ratio CourseNana.COM

the s2b ratio CourseNana.COM

the s2b ratio CourseNana.COM

Model R-squared CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Optional: CourseNana.COM

Best time to buy CourseNana.COM

Which half-hour? CourseNana.COM

Which day? CourseNana.COM

Which month? CourseNana.COM

Best time to sell CourseNana.COM

Which half-hour? CourseNana.COM

Which day? CourseNana.COM

Which month? CourseNana.COM

Ratio of sell-to-buy price CourseNana.COM

the s2b ratio CourseNana.COM

the s2b ratio CourseNana.COM

the s2b ratio CourseNana.COM

Model R-squared CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Data2: Ex4_data2.xlsx, containing the following sheets (using “Adj Close” in column F as Price for all questions below): CourseNana.COM

·      0005.hk: the price and volume of HSBC (bank) CourseNana.COM

·      0027.hk: the price and volume of Galaxy Entertainment (casino) CourseNana.COM

·      0101.hk: the price and volume of Hang Lung Properties CourseNana.COM

·      HSI: the price and volume of Hang Seng Index (Hong Kong) CourseNana.COM

·      DJI: the price and volume of Dow Jones Index (U.S.) CourseNana.COM

·      SSEC: the price and volume of Shanghai Stock Exchange Composite (China) CourseNana.COM

·      Use linear interpolation to fill any empty cell. CourseNana.COM

Task: CourseNana.COM

1.     ARIMA parameters: CourseNana.COM

a.     Data: use all dates up to Dec 31, 2022 for the three stocks (HSBC, Galaxy, and Hang Lung), respectively; CourseNana.COM

b.     Use ACF (autocorrelation function) and PACF (partial autocorrelation function) to identify the autoregression (AU), integration (I), and moving average (MA) parameters for each stock price; CourseNana.COM

c.     Fit a univariate ARIMA model (i.e., only Price plus AR, I, and MA, without any IV) for each stock CourseNana.COM

d.     Report the results in Table 2. CourseNana.COM

2.     Predictive models: CourseNana.COM

a.     Data: split the data to a training set (up to Dec 31, 2022) and a test set (from Jan 1 to Feb 21, 2023) for each stock; CourseNana.COM

b.    Model: build a predictive model for each stocks, respectively, using Price as the DV and any of the following as the IVs: CourseNana.COM

i.      Time-effects: day of the week, month of the year (“seasonality”), and any other features that represent repeated cycles of time (see questions for Data 1); CourseNana.COM

ii.    Internal factors: the previous price and volume of the stock (no need for previous price if you use ARIMA/SARIMA because it will be automatically included); CourseNana.COM

iii.   Market influences: the previous price of the stock market in Hong Kong (HSI), the U.S. (DJI), and mainland China (SSEC); CourseNana.COM

iv.   Optional IVs: any other time series data measured on a daily unit to be collected by you and add to the model as the IVs (same grading policy as in Data 1 applies here); CourseNana.COM

b.    Estimation (based on the training set) and test (based on the test set) method: use any method of your choice, including an ensemble of several methods, e.g., CourseNana.COM

i.      OLS; CourseNana.COM

ii.    Exponential smoothing; CourseNana.COM

iii.   ARIMA/SARIMA; CourseNana.COM

iv.   Machine learning/deep learning; CourseNana.COM

v.     Anything else; CourseNana.COM

c.     Report your model specification and results in Table 3. CourseNana.COM

  CourseNana.COM

3.     Forecast future values: use your predictive model to forecast the price of each stock on March 13, 15, and 17. Report the results in Table 4 and Figure 1. CourseNana.COM

Report: Present your results in the following tables: CourseNana.COM

Table 2. ARIMA Parameters of Individual Stock Price CourseNana.COM

  CourseNana.COM

HSBC (005) CourseNana.COM

Galaxy (027) CourseNana.COM

Hang Lung (101) CourseNana.COM

Autoregression (AR) CourseNana.COM

·   Order (e.g., 0, 1, etc.) CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

·   Coefficient CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Integration (I) CourseNana.COM

·   Order CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Moving Average (MA) CourseNana.COM

·   Order CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

·   Coefficient CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Model fit (AIC) CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Table 3. Predictive Models of Individual Stock Price CourseNana.COM

  CourseNana.COM

  CourseNana.COM

HSBC (005) CourseNana.COM

Galaxy (027) CourseNana.COM

Hang Lung (101) CourseNana.COM

a. Training Set: CourseNana.COM

·   Model type CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

·   Equation CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

·   Accuracy (MAPE)[4] CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

·   Justification for using the model CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

b. Test Set: CourseNana.COM

Accuracy (MAPE)3 CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Table 4. Forecasted Stock Price on March 13, 15, and 17 CourseNana.COM

  CourseNana.COM

  CourseNana.COM

HSBC (005) CourseNana.COM

Galaxy (027) CourseNana.COM

Hang Lung (101) CourseNana.COM

March 13 CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

March 15 CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

March 17 CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

  CourseNana.COM

Figure 1. CourseNana.COM

1.     Use a scatterplot with Price in the y-axis, and date in the x-axis, including include an “observed period” (up to Feb 21, 2023) and a “forecast period” (March 13, 15, and 17); CourseNana.COM

2.     Show two lines (the observed and estimated prices) in the observed period and three lines (forecasted price, and the confidence interval at the 95% confidence level) in the forecast period; CourseNana.COM

3.     See slide 34 of Week 5 as two examples. CourseNana.COM

Optional Question for both Data1 and Data2 (the above grading policy applies) CourseNana.COM

Note that you are required to detrend for Data1 but not required to do so for Data2. Discuss what the detrend (for Data1) and non-trend (for Data2) will do to the respective results? If you think either Data1 or Data2 should be done differently, why and what will happen to the results? CourseNana.COM

Submission: CourseNana.COM

1.     Write your answer the above questions in this Word document and save it in Word format (doc or docx); CourseNana.COM

2.     Attach your programming codes for both Data1 and Data2 in the original format (e.g., *.py, *.ipynb, etc.); CourseNana.COM

3.     Put the Word file and the programming codes in a zip/rar file package (i.e., *.zip or *.rar) and upload it to the Assignment box. CourseNana.COM


CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
Hong Kong代写,City University of Hong Kong代写,SDSC2005代写,Introduction to Computational Social Science代写,Time Series Analysis for Predictive Research代写,Python代写,Hong Kong代编,City University of Hong Kong代编,SDSC2005代编,Introduction to Computational Social Science代编,Time Series Analysis for Predictive Research代编,Python代编,Hong Kong代考,City University of Hong Kong代考,SDSC2005代考,Introduction to Computational Social Science代考,Time Series Analysis for Predictive Research代考,Python代考,Hong Konghelp,City University of Hong Konghelp,SDSC2005help,Introduction to Computational Social Sciencehelp,Time Series Analysis for Predictive Researchhelp,Pythonhelp,Hong Kong作业代写,City University of Hong Kong作业代写,SDSC2005作业代写,Introduction to Computational Social Science作业代写,Time Series Analysis for Predictive Research作业代写,Python作业代写,Hong Kong编程代写,City University of Hong Kong编程代写,SDSC2005编程代写,Introduction to Computational Social Science编程代写,Time Series Analysis for Predictive Research编程代写,Python编程代写,Hong Kongprogramming help,City University of Hong Kongprogramming help,SDSC2005programming help,Introduction to Computational Social Scienceprogramming help,Time Series Analysis for Predictive Researchprogramming help,Pythonprogramming help,Hong Kongassignment help,City University of Hong Kongassignment help,SDSC2005assignment help,Introduction to Computational Social Scienceassignment help,Time Series Analysis for Predictive Researchassignment help,Pythonassignment help,Hong Kongsolution,City University of Hong Kongsolution,SDSC2005solution,Introduction to Computational Social Sciencesolution,Time Series Analysis for Predictive Researchsolution,Pythonsolution,