本次代写是R语言金融回归模型的一个作业

  1. Autoregressive (AR) Model

You can test to see if the return data in your sample follow a random walk using the AR (1) model:

Rt= σ+ β1 Rt-1 + ℇt   

where the dependent variable Rt is the return for the time t, and the independent variable Rt-1 is the return lagged one period for time t-1 .

You can create a one-period lag of return either manually in excel or you simply do that in SPSS, for instance, by using the LAG function under the Transform>Compute variables menu.

You should report and discuss your results.

(1)  Create BP_1 Variable for t-1 {Hints: Transform….create time series…}

(2)  Compute stock return of BP (BP_Ret) {Transform….Compute Variable ….((BP-BP_1)/BP_1)*100

(3)  Create a Lag Variable for BP_Ret_1 for t-1 {Hints: Transform…Create time series…}

(4)  Compute Logarithmic stock return of BP (BP_LogRet) {Transform…Compute Variable…(Ln(BP)-LN(BP_1)*100

(5)  Do a formal test of independence to test H: No Autocorrelation { Hints: Analyse…Forecasting …Autocorrelation…Variables (BP_Return), Display (Autocorrelation and Partial Autocorrelation). Can you reject H: No Autocorrelation (e.g Reject H0  if p-value is statistically significant)? How do you interpret the results?

(6)  Repeat question 5 with BP share prices (instead of BP_Return).Do you observe any difference ?

(7)  Estimate Autoregressive 1 (AR1) Model with and without constant term). Do the results tell you anything about the random walk model?

(8)  In order to test Weak Form EMH , estimate the following AR(1) Model with the BP_Return (with constant term). Can you reject H: β=0 (e.g. Reject H0  if p-value is statistically significant)?

Do the result tell you anything about the EMH/ random walk model?

Ri= σ+ β1 Rt-1 + ℇt…….(1)

(9)  Draw scatter plot and line charts to find evidence of Weak Form EMH/Random Walk Model.

  1. Day of the Week Effect

In this part, you will test and see if the data show any seasonal effects over days of the week.

RT1 D1,t + β2 D2,t + β3 D3,t + β4 D4,t + β5 D5,t + ℇt  

Note that there is no constant in the above regression; if you want to include a constant you can have only 4 dummy variables. Again, you should report and comment on your findings.

(1)  Convert DATES into DAYS: Transform….Date & Time Wizard….Extract a part of a date or time variable…Date or time (DATE) and unit to extract (DAY OF WEEK)…Finish.

(2)  Convert DAYS into NUMBERS (e.g., Mon=1, Fri=5): Transform…Automatic Recode…..choose New Variable name (DAYS2)….Recode starting from lowest to highest ….Use the same recoding scheme for all variables…}

(3)  Create DUMMY Variables from DAYS2 (D1 FOR Monday,D2 for Tuesday,D3 for Wednesday,D4 for Thursday and D5 for Friday): Transform….Recode into different variable…Use Old & New Value option…….

(4)  In order to investigate the seasonal effect on financial markets (calendar anomalies),estimate the following OLS regression (or Dummy Variable regression) model to test `Day-of-the-Week-Effect` (WITHOUT CONSTANT):

RT1 D1,t + β2 D2,t + β3 D3,t + β4 D4,t + β5 D5,t + ℇt  

Where,

D1        = 1 if the return is on a Monday and 0 otherwise

D2         = 1 if the return is on a Tuesday and 0 otherwise

D3         = 1 if the return is on a Wednesday and 0 otherwise

D4         = 1 if the return is on a Thursday and 0 otherwise

D5          = 1 if the return is on a Friday and 0 otherwise

(5)  Estimate the Following OLS regression (or Dummy Variable regression) model to test if `Monday return` is statistically significant than other days of the week. State Null and alternative hypotheses.

RT1 D1,t + β2 D2,t + β3 D3,t + β4 D4,t + β5 D5,t + ℇt