Skip to content

Commit

Permalink
Added printSE() function for formatted result output
Browse files Browse the repository at this point in the history
  • Loading branch information
chenx26 committed Jul 25, 2016
1 parent 0d38a5d commit 1c30c7d
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 2 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -54,6 +54,7 @@ export(VaR.hist)
export(mu.IF)
export(myperiodogram)
export(nse.nw)
export(printSE)
import(sandwich)
import(xts)
import(zoo)
Expand Down
2 changes: 1 addition & 1 deletion R/ES_SE.R
Expand Up @@ -70,7 +70,7 @@
#' decompose total portfolio ES into the risk contributions of each of the
#' portfolio components. For the above mentioned ES estimators, such a
#' decomposition is possible in a financially meaningful way.
#' @author Brian G. Peterson and Kris Boudt
#' @author Brian G. Peterson, Kris Boudt and Xin Chen
#' @seealso \code{\link{VaR}} \cr \code{\link{SharpeRatio.modified}} \cr
#' \code{\link{chart.VaRSensitivity}} \cr \code{\link{Return.clean}}
#'
Expand Down
1 change: 1 addition & 0 deletions R/EstimatorES.R
Expand Up @@ -12,6 +12,7 @@
#'
#' @return the standard error of the specified risk/performance measure using the specified method
#' @export
#' @author Xin Chen
#'
#' @examples
#' data(edhec)
Expand Down
1 change: 1 addition & 0 deletions R/GLM_EN.R
Expand Up @@ -2,6 +2,7 @@
#'
#' @param data Vector of data
#' @param max.freq Maximum frequency to be computed
#' @author Xin Chen
#'
#' @return list of frequencies and corresponding periodograms
#' @export
Expand Down
1 change: 1 addition & 0 deletions R/InfluenceFunctions.R
Expand Up @@ -6,6 +6,7 @@
#'
#' @return IF of Mean
#' @export
#' @author Xin Chen
#'
#' @examples
#' mu.IF(rnorm(10))
Expand Down
1 change: 1 addition & 0 deletions R/SE_ES.R
Expand Up @@ -8,6 +8,7 @@
#' is implemented.
#'
#' @return SE of ES
#' @author Xin Chen
#' @export
#'
#' @examples
Expand Down
26 changes: 26 additions & 0 deletions R/printSE.R
@@ -0,0 +1,26 @@
#' Formatted output of the results from xxx.SE() functions
#'
#' @param res the results from the xx.SE() functions
#' @param round.digit the number of digits to round to
#'
#' @return No return values
#' @export
#'
#' @examples
#' data(edhec)
#' res = ES.SE(edhec, p=.95, method="historical",se.method = "IFiid")
#' printSE(res, round.digit = 4)
printSE = function(res , round.digit = 3){
N = length(res)
if(N != 2) {
cat("the results do not contain standard errors!\n")
return()
}
list.names = names(res)
res.df = data.frame(as.vector(res[[1]]), as.vector(res[[2]]))
colnames(res.df) = list.names
rownames(res.df) = colnames(res[[1]])
res.df = round(res.df, digits = round.digit)
res.df[2] = paste("(",res.df[,2],")")
print(res.df)
}
2 changes: 1 addition & 1 deletion man/ES.SE.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/EstimatorSE.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/SE.ES.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/mu.IF.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/myperiodogram.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions man/printSE.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1c30c7d

Please sign in to comment.