Learn R Programming

PortfolioAnalytics (version 2.0.0)

diversification_constraint: constructor for diversification_constraint

Description

The diversification constraint specifies a target diversification value. This function is called by add.constraint when type="diversification" is specified, see add.constraint. Diversification is computed as 1 - sum(weights^2).

Usage

diversification_constraint(
  type = "diversification",
  div_target = NULL,
  enabled = TRUE,
  message = FALSE,
  ...
)

Arguments

type

character type of the constraint

div_target

diversification target value

enabled

TRUE/FALSE

message

TRUE/FALSE. The default is message=FALSE. Display messages if TRUE.

...

any other passthru parameters to specify diversification constraint an object of class 'diversification_constraint'

Author

Ross Bennett

See Also

add.constraint

Examples

Run this code
data(edhec)
ret <- edhec[, 1:4]

pspec <- portfolio.spec(assets=colnames(ret))

pspec <- add.constraint(portfolio=pspec, type="diversification", div_target=0.7)

Run the code above in your browser using DataLab