Skip to content

Commit

Permalink
fix: freq undefined when scale set for some tables
Browse files Browse the repository at this point in the history
This commit removes references to 'freq' which is not assigned when
the argument 'scale' != NA for the following tables:

	* table.Distributions
	* table.DownsideRiskRatio
	* table.Variability

Fixes #128.
  • Loading branch information
domodwyer committed Jul 5, 2021
1 parent b41c9fe commit abc79b6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/table.Distributions.R
Expand Up @@ -58,7 +58,7 @@ function (R, scale = NA, digits = 4)
for(column in 1:columns) {
z = c(StdDev.annualized(y[,column,drop=FALSE])/sqrt(scale), skewness(y[,column,drop=FALSE], method = "moment"), kurtosis(y[,column,drop=FALSE], method = "moment"), kurtosis(y[,column,drop=FALSE], method = "excess"), skewness(y[,column,drop=FALSE], method = "sample"), kurtosis(y[,column,drop=FALSE], method = "sample_excess"))

znames = c(paste(freq$scale," Std Dev"), "Skewness", "Kurtosis", "Excess kurtosis", "Sample skewness", "Sample excess kurtosis")
znames = c(paste(scale," Std Dev"), "Skewness", "Kurtosis", "Excess kurtosis", "Sample skewness", "Sample excess kurtosis")


if(column == 1) {
Expand Down
2 changes: 1 addition & 1 deletion R/table.DownsideRiskRatio.R
Expand Up @@ -61,7 +61,7 @@ function (R, MAR = 0, scale = NA, digits = 4)
for(column in 1:columns) {
z = c(DownsideDeviation(y[,column,drop=FALSE], MAR = MAR), DownsideDeviation(y[,column,drop=FALSE], MAR = MAR)*sqrt(scale), DownsidePotential(y[,column,drop=FALSE], MAR = MAR), UpsideRisk(y[,column,drop=FALSE], MAR = MAR, stat = "potential")/DownsidePotential(y[,column,drop=FALSE], MAR = MAR), SortinoRatio(y[,column,drop=FALSE], MAR = MAR), UpsideRisk(y[,column,drop=FALSE], MAR = MAR, stat = "potential"), UpsidePotentialRatio(y[,column,drop=FALSE], MAR = MAR), OmegaSharpeRatio(y[,column,drop=FALSE], MAR = MAR))

znames = c(paste0(freq$scale," downside risk"), "Annualised downside risk", "Downside potential", "Omega", "Sortino ratio", "Upside potential", "Upside potential ratio", "Omega-sharpe ratio")
znames = c(paste0(scale," downside risk"), "Annualised downside risk", "Downside potential", "Omega", "Sortino ratio", "Upside potential", "Upside potential ratio", "Omega-sharpe ratio")
if(column == 1) {
resultingtable = data.frame(Value = z, row.names = znames)
}
Expand Down
2 changes: 1 addition & 1 deletion R/table.Variability.R
Expand Up @@ -61,7 +61,7 @@ function (R, scale = NA, geometric = TRUE, digits = 4)
for(column in 1:columns) {
z = c(MeanAbsoluteDeviation(y[,column,drop=FALSE]), StdDev.annualized(y[,column,drop=FALSE], scale = scale)/sqrt(scale), StdDev.annualized(y[,column,drop=FALSE], scale = scale))

znames = c("Mean Absolute deviation", paste0(freq$scale," Std Dev"), "Annualized Std Dev")
znames = c("Mean Absolute deviation", paste0(scale," Std Dev"), "Annualized Std Dev")


if(column == 1) {
Expand Down

0 comments on commit abc79b6

Please sign in to comment.