[Returnanalytics-commits] r2853 - in pkg/PerformanceAnalytics: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Aug 22 15:02:02 CEST 2013
Author: braverock
Date: 2013-08-22 15:02:02 +0200 (Thu, 22 Aug 2013)
New Revision: 2853
Modified:
pkg/PerformanceAnalytics/DESCRIPTION
pkg/PerformanceAnalytics/NAMESPACE
pkg/PerformanceAnalytics/R/ActivePremium.R
pkg/PerformanceAnalytics/R/table.CAPM.R
pkg/PerformanceAnalytics/man/ActivePremium.Rd
pkg/PerformanceAnalytics/man/table.CAPM.Rd
Log:
- fix alias problems that were breaking R CMD check
- bump version
Modified: pkg/PerformanceAnalytics/DESCRIPTION
===================================================================
--- pkg/PerformanceAnalytics/DESCRIPTION 2013-08-22 11:25:44 UTC (rev 2852)
+++ pkg/PerformanceAnalytics/DESCRIPTION 2013-08-22 13:02:02 UTC (rev 2853)
@@ -1,7 +1,7 @@
Package: PerformanceAnalytics
Type: Package
Title: Econometric tools for performance and risk analysis.
-Version: 1.1.0
+Version: 1.1.1
Date: $Date$
Author: Peter Carl, Brian G. Peterson
Maintainer: Brian G. Peterson <brian at braverock.com>
Modified: pkg/PerformanceAnalytics/NAMESPACE
===================================================================
--- pkg/PerformanceAnalytics/NAMESPACE 2013-08-22 11:25:44 UTC (rev 2852)
+++ pkg/PerformanceAnalytics/NAMESPACE 2013-08-22 13:02:02 UTC (rev 2853)
@@ -127,6 +127,7 @@
table.Autocorrelation,
table.CalendarReturns,
table.CAPM,
+ table.SFM,
table.CaptureRatios,
table.Correlation,
table.Distributions,
Modified: pkg/PerformanceAnalytics/R/ActivePremium.R
===================================================================
--- pkg/PerformanceAnalytics/R/ActivePremium.R 2013-08-22 11:25:44 UTC (rev 2852)
+++ pkg/PerformanceAnalytics/R/ActivePremium.R 2013-08-22 13:02:02 UTC (rev 2853)
@@ -1,13 +1,13 @@
#' Active Premium or Active Return
-#'
+#'
#' The return on an investment's annualized return minus the benchmark's
#' annualized return.
-#'
+#'
#' Active Premium = Investment's annualized return - Benchmark's annualized
#' return
-#'
+#'
#' Also commonly referred to as 'active return'.
-#'
+#'
#' @param Ra return vector of the portfolio
#' @param Rb return vector of the benchmark asset
#' @param scale number of periods in a year (daily scale = 252, monthly scale =
@@ -19,15 +19,17 @@
#' Management},Fall 1994, 49-58.
#' @keywords ts multivariate distribution models
#' @examples
-#'
+#'
#' data(managers)
#' ActivePremium(managers[, "HAM1", drop=FALSE], managers[, "SP500 TR", drop=FALSE])
-#' ActivePremium(managers[,1,drop=FALSE], managers[,8,drop=FALSE])
-#' ActivePremium(managers[,1:6], managers[,8,drop=FALSE])
+#' ActivePremium(managers[,1,drop=FALSE], managers[,8,drop=FALSE])
+#' ActivePremium(managers[,1:6], managers[,8,drop=FALSE])
#' ActivePremium(managers[,1:6], managers[,8:7,drop=FALSE])
#' @rdname ActivePremium
-#' @aliases ActivePremium, ActiveReturn
-#' @export
+#' @aliases
+#' ActivePremium
+#' ActiveReturn
+#' @export
ActiveReturn <- ActivePremium <- function (Ra, Rb, scale = NA)
{ # @author Peter Carl
@@ -35,7 +37,7 @@
Ra = checkData(Ra)
Rb = checkData(Rb)
- Ra.ncols = NCOL(Ra)
+ Ra.ncols = NCOL(Ra)
Rb.ncols = NCOL(Rb)
pairs = expand.grid(1:Ra.ncols, 1:Rb.ncols)
Modified: pkg/PerformanceAnalytics/R/table.CAPM.R
===================================================================
--- pkg/PerformanceAnalytics/R/table.CAPM.R 2013-08-22 11:25:44 UTC (rev 2852)
+++ pkg/PerformanceAnalytics/R/table.CAPM.R 2013-08-22 13:02:02 UTC (rev 2853)
@@ -1,11 +1,11 @@
#' Single Factor Asset-Pricing Model Summary: Statistics and Stylized Facts
-#'
+#'
#' Takes a set of returns and relates them to a benchmark return. Provides a
#' set of measures related to an excess return single factor model, or CAPM.
-#'
+#'
#' This table will show statistics pertaining to an asset against a set of
#' benchmarks, or statistics for a set of assets against a benchmark.
-#'
+#'
#' @param Ra a vector of returns to test, e.g., the asset to be examined
#' @param Rb a matrix, data.frame, or timeSeries of benchmark(s) to test the
#' asset against.
@@ -19,16 +19,18 @@
#' \code{\link{InformationRatio}} \cr \code{\link{TreynorRatio}}
#' @keywords ts multivariate distribution models
#' @examples
-#'
+#'
#' data(managers)
#' table.SFM(managers[,1:3,drop=FALSE], managers[,8,drop=FALSE], Rf = managers[,10,drop=FALSE])
-#'
+#'
#' result = table.SFM(managers[,1:3,drop=FALSE], managers[,8,drop=FALSE], Rf = managers[,10,drop=FALSE])
#' textplot(result, rmar = 0.8, cmar = 1.5, max.cex=.9, halign = "center", valign = "top", row.valign="center", wrap.rownames=15, wrap.colnames=10, mar = c(0,0,3,0)+0.1)
#' title(main="Single Factor Model Related Statistics")
-#'
+#'
#' @rdname table.CAPM
-#' @aliases table.CAPM, table.SFM
+#' @aliases
+#' table.CAPM
+#' table.SFM
#' @export
table.SFM <- table.CAPM <- function (Ra, Rb, scale = NA, Rf = 0, digits = 4)
{# @author Peter Carl
@@ -84,20 +86,20 @@
model.lm = lm(merged.assets[,1] ~ merged.assets[,2])
alpha = coef(model.lm)[[1]]
beta = coef(model.lm)[[2]]
- CAPMbull = CAPM.beta.bull(Ra[,column.a], Rb[,column.b],Rf) #inefficient, recalcs excess returns and intercept
- CAPMbear = CAPM.beta.bear(Ra[,column.a], Rb[,column.b],Rf) #inefficient, recalcs excess returns and intercept
+ CAPMbull = CAPM.beta.bull(Ra[,column.a], Rb[,column.b],Rf) #inefficient, recalcs excess returns and intercept
+ CAPMbear = CAPM.beta.bear(Ra[,column.a], Rb[,column.b],Rf) #inefficient, recalcs excess returns and intercept
htest = cor.test(merged.assets[,1], merged.assets[,2])
#active.premium = (Return.annualized(merged.assets[,1,drop=FALSE], scale = scale) - Return.annualized(merged.assets[,2,drop=FALSE], scale = scale))
active.premium = ActivePremium(Ra=Ra[,column.a],Rb=Rb[,column.b], scale = scale)
#tracking.error = sqrt(sum(merged.assets[,1] - merged.assets[,2])^2/(length(merged.assets[,1])-1)) * sqrt(scale)
- tracking.error = TrackingError(Ra[,column.a], Rb[,column.b],scale=scale)
+ tracking.error = TrackingError(Ra[,column.a], Rb[,column.b],scale=scale)
#treynor.ratio = Return.annualized(merged.assets[,1,drop=FALSE], scale = scale)/beta
treynor.ratio = TreynorRatio(Ra=Ra[,column.a], Rb=Rb[,column.b], Rf = Rf, scale = scale)
-
+
z = c(
alpha,
beta,
- CAPMbull,
+ CAPMbull,
CAPMbear,
summary(model.lm)$r.squared,
((1+alpha)^scale - 1),
@@ -108,7 +110,7 @@
active.premium/tracking.error,
treynor.ratio
)
-
+
znames = c(
"Alpha",
"Beta",
@@ -123,7 +125,7 @@
"Information Ratio",
"Treynor Ratio"
)
-
+
if(column.a == 1 & column.b == 1) {
result.df = data.frame(Value = z, row.names = znames)
colnames(result.df) = paste(columnnames.a[column.a], columnnames.b[column.b], sep = " to ")
Modified: pkg/PerformanceAnalytics/man/ActivePremium.Rd
===================================================================
--- pkg/PerformanceAnalytics/man/ActivePremium.Rd 2013-08-22 11:25:44 UTC (rev 2852)
+++ pkg/PerformanceAnalytics/man/ActivePremium.Rd 2013-08-22 13:02:02 UTC (rev 2853)
@@ -1,5 +1,5 @@
\name{ActiveReturn}
-\alias{ActivePremium,}
+\alias{ActivePremium}
\alias{ActiveReturn}
\title{Active Premium or Active Return}
\usage{
Modified: pkg/PerformanceAnalytics/man/table.CAPM.Rd
===================================================================
--- pkg/PerformanceAnalytics/man/table.CAPM.Rd 2013-08-22 11:25:44 UTC (rev 2852)
+++ pkg/PerformanceAnalytics/man/table.CAPM.Rd 2013-08-22 13:02:02 UTC (rev 2853)
@@ -1,5 +1,5 @@
\name{table.SFM}
-\alias{table.CAPM,}
+\alias{table.CAPM}
\alias{table.SFM}
\title{Single Factor Asset-Pricing Model Summary: Statistics and Stylized Facts}
\usage{
More information about the Returnanalytics-commits
mailing list