Question

Please follow the following instructions. The instructions indicate how to download daily stock price of Apple,...

Please follow the following instructions. The instructions indicate how to download daily stock price of Apple, Inc. from 2016-01-01 to 2018-07-31 from Yahoo! Finance.

library(quantmod)

getSymbols("AAPL", src = "yahoo", from='2016-01-01', to='2018-07-31')

AAPLAdj <- AAPL$AAPL.Adj

(By here the data can be downloaded and extracted using RStudio)

a) Show whether the series AAPLAdj evolves with time. If it does, show how to remove the evolution with time and comment on the result.

b) The following code will convert AAPLAdj to monthly log return.

monthly.AAPL <- monthlyReturn(AAPLAdj, subset=NULL, type='log', leading=TRUE) Find sample autocorrelation and partial autocorrelation estimates for monthly.AAPL up to lag 15.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a. Once the data from Yahoo is imported, we need to plot it to see the evolution with time.

From the plots, we can see that AAPLAdj evolves with time. To remove this trend, we need to do de-trending.

For this, we will use moving average

let's say a= moving average, 4 steps for AAPLAdj, this is a smoothened function to capture trend. Then we will subtract this trend from the original stock data "AAPLAdj"

stock_trend = ma(AAPLAdj, order = 4, centre = T)

de-trend = AAPLAdj - stock_trend

plot.ts(de-trend)

b. to get autocorrelation till lag 15, we will use acf function in RStudio.

ACF(monthly.AAPL, lag.max=15) --- use acf forecast option

partial autocorrelation, Pacf(monthly.AAPL,lag.max=15)

Add a comment
Know the answer?
Add Answer to:
Please follow the following instructions. The instructions indicate how to download daily stock price of Apple,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT