Can't get the correct value for annual mean return and annual volitation. Please help

So, according to the training exercise, I have to use Japanese Nikkei 225 stock index for the period 2005/01/04-2021/12/31 to get the data. From the data that I retrieved, I have to find mean annualized return and annualized volatility I'm getting unrealistic values like "5.11 or 510.53%" and "2324.542%."

I assume this is caused by ret=100*diff(log(Price)), but I'm not sure. Will greatly appreciate it if you could help me with this one, I have been struggling for days...

# R code to be used for Learning Exercise 1
##############################################################################
##############################################################################
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 "GSPC"(!NOW 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 (updated 4119) 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. 
#<==(Kurtosis-3)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.