Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with MAR if it is a vector of returns #191

Open
XanderDes opened this issue Dec 12, 2024 · 0 comments
Open

Error with MAR if it is a vector of returns #191

XanderDes opened this issue Dec 12, 2024 · 0 comments

Comments

@XanderDes
Copy link

Description

When using SortinoRatio(Stats_Data$EQ, MAR = Stats_Data$RF), I got the following error:

Error in DownsideDeviation(R, MAR) :
dims [product 71] do not match the length of object [197]
In addition: Warning message:
In MAR - r :
longer object length is not a multiple of shorter object length

Stats_Data is a grouped tibble and EQ and RF are columns with equity and risk-free returns, resp. They are numerical, of equal length and without any NAs.
The same error occurs with randomly generated data (see below).

Expected behavior

I would have expected an output as the one returned for MAR = 0:

SortinoRatio(Stats_Data$EQ, MAR = 0)
                              [,1]
Sortino Ratio (MAR = 0%) 0.6913074

Minimal, reproducible example

On randomly generated data:

Rand_EQ <- rnorm(100)  # Random returns
Rand_RF <- rnorm(100, mean = 0.01)  # Random benchmark returns

DownsideDeviation(Rand_EQ, MAR = 0)  # Results in 0.5808906
DownsideDeviation(Rand_EQ, MAR = Rand_RF)  # Results in error

Session Info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant