Question: Using the attached R code (le1.R) get the daily equity prices data for the Japanese Nikkei 225 stock index for the period 2005/01/04-2020/12/31 from finance.yahoo.com

Using the attached R code (le1.R) get the daily equity prices data for the Japanese Nikkei 225 stock index for the period 2005/01/04-2020/12/31 from finance.yahoo.com (use ticker ^N225) and answer questions 1-3.

Note that you need to make several changes in the code, such as replacing ^GSPC index with ^N225 and several other parameters in the code.

When I'm doing it I'm getting unrealistic numbers when:

a)Find the mean annualized return.

b) Find the annualized volatility (standard deviation for the whole sample).

``` R code ############################################################################## ############################################################################## rm(list = ls()) # clear memory par(mfrow=c(1,1)) # one window for graphics ##############################################################################

##Below make changes to the code and answer questions in LE1

library(quantmod) # <=== load the package "quantmod" getSymbols("^N225", from="2005-01-04",to="2021-12-31") # <=== get daily SP500 stock data from Yahoo Finance Price=N225$N225.Adjusted # <==Column 6 of the object "N225" in R ret=100*diff(log(Price)) plot(Price) plot(ret)

##<==notice that there is NA 1st observation in returns. Let's remove it ret=na.omit(ret) length(ret) #<===now we have 4278 observations for returns after dropping NA obs

library(xts) dates=index(ret)#<===extract dates from xts object ret0=coredata(ret)#<==remove time series property from returns

library(fBasics) #<== Load the package "fBasics" basicStats(ret) #<== Compute descriptive statistics of log returns. NOTE that Excess Kurtosis is reported.

```

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!