Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Multifractal Detrended Analysis Method And Its Application In Financial Markets

Authors: Guangxi Cao, Ling-Yun He, Jie Cao

1st Edition

9811079153, 978-9811079153

More Books

Students also viewed these Finance questions