Learn R Programming

PerformanceAnalytics (version 0.9.5)

table.CAPM: Asset-Pricing Model Summary: Statistics and Stylized Facts

Description

Takes a set of returns and relates them to a market benchmark. Provides a set of measures related to the excess return single index model, or CAPM.

Usage

table.CAPM(Ra, Rb, scale = 12, rf = 0, digits = 4)

Arguments

Ra
a vector of returns to test, e.g., the asset to be examined
Rb
a matrix, data.frame, or timeSeries of benchmark(s) to test the asset against.
scale
number of periods in a year (daily scale = 252, monthly scale = 12, quarterly scale = 4)
rf
risk free rate, in same period as your returns
digits
number of digits to round results to

Value

  • A data frame with columns named for the columns in Rb and rows containing statistics.

Details

This table will show statistics pertaining to an asset against a set of benchmarks, but cannot (yet) be used to show statistics for a set of assets against a benchmark.

See Also

CAPM.alpha CAPM.beta TrackingError ActivePremium InformationRatio TreynorRatio

Examples

Run this code
# First we load the data
data(edhec)
edhec.length = dim(edhec)[1]
start = rownames(edhec[1,])
start
end = rownames(edhec[edhec.length,])
edhec.zoo = zoo(edhec, order.by = rownames(edhec))
rf.zoo = download.RiskFree(start = start, end = end)
sp500.zoo = download.SP500PriceReturns(start = "1996-12-31", end = end)

# Now we have to align it as "monthly" data
time(edhec.zoo) = as.yearmon(time(edhec.zoo))
time(sp500.zoo) = as.yearmon(time(sp500.zoo))
time(rf.zoo) = as.yearmon(time(rf.zoo))
data.zoo = merge(edhec.zoo[,9,drop=FALSE],sp500.zoo)
time(data.zoo) = as.Date(time(data.zoo),format="%b %Y")
time(rf.zoo) = as.Date(time(rf.zoo),format="%b %Y")

table.CAPM(data.zoo[,1,drop=FALSE], data.zoo[,2,drop=FALSE], rf = rf.zoo)

Run the code above in your browser using DataLab