#'Method for Security Attribution
#'
setGeneric(name = "SecurityperformanceAttribution",
def = function(object){
standardGeneric("SecurityperformanceAttribution")
})
setMethod(f="SecurityperformanceAttribution",
signature = "SecurityAttribution",
definition = function(object){
#Calculate Active Return
AssetClass<-object@AssetClass
AssetCategory<-object@AssetCategory
Asset<-object@Asset
PortfolioReturn<-object@PortfolioReturns
Benchmark<-object@BenchmarkReturns
ActiveReturn<-PortfolioReturn-Benchmark #Active Returns
PortfolioWeight<-object@PortfolioWeights
BenchmarkWeight<-object@BenchmarkWeights
ExcessWeight<-PortfolioWeight-BenchmarkWeight #Active Weights
#Attribute
Allocationeffect <- (object@PortfolioWeights - object@BenchmarkWeights) * (object@BenchmarkReturns
- sum(object@BenchmarkWeights * object@BenchmarkReturns))
SelectionEffect <- (object@PortfolioReturns - object@BenchmarkReturns) * object@BenchmarkWeights
InteractionEffect <- (object@PortfolioWeights - object@BenchmarkWeights) *(object@PortfolioReturns
- object@BenchmarkReturns)
# Form data frame for overal performance reports
Performance <- data.frame(
AssetClass = AssetClass,
AssetCategory = AssetCategory,
Asset= Asset,
PortfolioReturn = PortfolioReturn,
Benchmark = Benchmark,
ActiveReturn = ActiveReturn,
PortfolioWeight = PortfolioWeight,
BenchmarkWeight = BenchmarkWeight,
ExcessWeight = ExcessWeight,
AllocationEffect = Allocationeffect,
SellectionEffect = SelectionEffect,
InteractionEffect = InteractionEffect)
Performance
}
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.