Open kwhkim opened 1 month ago
As I look at the source code, https://github.com/braverock/PerformanceAnalytics/blob/master/R/SemiDeviation.R SemiVariance should be return(DownsideDeviation(R, MAR=mean(R), method="subset")^2) not return(DownsideDeviation(R, MAR=mean(R), method="subset"))
return(DownsideDeviation(R, MAR=mean(R), method="subset")^2)
return(DownsideDeviation(R, MAR=mean(R), method="subset"))
According to the definition https://www.investopedia.com/terms/s/semivariance.asp
x = c(0.3, 0.2, 0.1, 0, -0.1, -0.2, -0.3, -0.4) SemiVariance(x) #0.229129 y = x -mean(x) y2 = ifelse(y>0, 0, y) y3 = y2[y2<0] sum(y3^2)/length(y3) # 0.0525 sqrt(sum(y3^2)/length(y3)) # 0.229129 DownsideDeviation(x, MAR=mean(x), method='subset') # 0.229129
Description
As I look at the source code, https://github.com/braverock/PerformanceAnalytics/blob/master/R/SemiDeviation.R SemiVariance should be
return(DownsideDeviation(R, MAR=mean(R), method="subset")^2)
notreturn(DownsideDeviation(R, MAR=mean(R), method="subset"))
According to the definition https://www.investopedia.com/terms/s/semivariance.asp
Minimal, reproducible example