Introduction

To evaluate funds based on returns , sharpe ratio and and impact of standard deviation ratio. (R Codes below are meant for data-scientist.)

suppressWarnings(suppressMessages(library(ggiraph)))
suppressWarnings(suppressMessages(library(ggplot2)))
suppressWarnings(suppressMessages(library(dplyr)))

options(width = 100)
setwd("C:\\onedrive\\module5")
mydata <- read.csv("data2.csv")


# subsetdata for DT use
suppressWarnings(suppressMessages(library(DT)))
subsetdata <- subset(mydata, select=c("fund", "returns", "sharpe", "sd", "risk"))
datatable(head(subsetdata,10), caption = 'Table 1: SAMPLE DATA', class = 'cell-border stripe')
# select sharpe greater 0 and risk product that is 7
a<- mydata %>% filter(risk==7 & sharpe > 0)

gg_point_3 <- ggplot(a, aes(x = sharpe, y = returns, tooltip = fund, data_id = fund, color=sd)) +  geom_point_interactive(size=1)

ggiraph(code = {print(gg_point_3)}, tooltip_offx = 20, tooltip_offy = -10 )

Everyone wants to pick a fund that gave the highest returns. However look at the standard deviation of each fund. The bigger the standard deviation, the bigger spread of returns.

From the graphs, it does not mean highest returns can be achieved easily. This is because if you look the the color code, those with highest returns comes with huge standard deviation. In simplest terms, we want to look at highest sharpe ratios with least standard deviation so returns won’t spread from one point to another.

Boxplot

To see where the returns are consolidated.

#create a boxplot

suppressWarnings(suppressMessages(library(Hmisc)))
suppressWarnings(suppressMessages(library(plotly)))

cutsharpe <- cut2(a$sharpe, g=2)
p2 <- qplot(cutsharpe, returns,   data=a, fill=cutsharpe, geom=c("boxplot"))
ggplotly(p2)

Correlations

BLUE means positive correlated while RED means negative correlated.

library(corrr)
subsetdata <- data.frame(subset(mydata, select=c("returns", "sharpe", "sd", "risk")))
rdf <- correlate(subsetdata)
rplot(rdf, print_cor = TRUE ,  legend = TRUE)

Rules of Thumb for Correlations

Although it’s highly recommended that you use some form of significance testing to evaluate the size of correlation obtained, some general rules of thumb for interpreting the size of correlations have been developed, especially when you have extremely large samples where even very small correlations are likely to be statistically significant (traditional measures of statistical significance are heavily influenced by sample size with larger sample size requiring small statistics for significance).