Ri <- bedz$asset  
Rm <- bedz$market
Rf <- bedz$riskfree
data <- data.frame(Ri, Rm, Rf)
ERi <- mean(Ri)
sigma_i <- sd(Ri)
Sharpe <- (mean(Ri) - Rf) / sd(Ri)
downside_returns <- Ri[Ri < Rf]
downside_sd <- sd(downside_returns)
Sortino <- (mean(Ri) - Rf) / downside_sd
Sortino

downside_sd <- sd(Ri[Ri < 0])
Sortino <- mean(Ri) / downside_sd
Beta <- cov(Ri, Rm) / var(Rm)
Treynor <- (mean(Ri) - Rf) / Beta
JensenAlpha <- mean(Ri) - (Rf + Beta * (mean(Rm) - Rf))