Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

box_constraint

constructor for box_constraint.


Description

Box constraints specify the upper and lower bounds on the weights of the assets. This function is called by add.constraint when type="box" is specified. See add.constraint.

Usage

box_constraint(type = "box", assets, min, max, min_mult, max_mult,
  enabled = TRUE, message = FALSE, ...)

Arguments

type

character type of the constraint

assets

number of assets, or optionally a named vector of assets specifying initial weights

min

numeric or named vector specifying minimum weight box constraints

max

numeric or named vector specifying minimum weight box constraints

min_mult

numeric or named vector specifying minimum multiplier box constraint from initial weight in assets

max_mult

numeric or named vector specifying maximum multiplier box constraint from initial weight in assets

enabled

TRUE/FALSE

message

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

...

any other passthru parameters to specify box constraints

Value

an object of class 'box_constraint'

Author(s)

Ross Bennett

See Also

Examples

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

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

# defaults to min=0 and max=1
pspec <- add.constraint(pspec, type="box")

# specify box constraints as a scalar
pspec <- add.constraint(pspec, type="box", min=0.05, max=0.45)

# specify box constraints per asset
pspec <- add.constraint(pspec, 
                        type="box", 
                        min=c(0.05, 0.10, 0.08, 0.06), 
                        max=c(0.45, 0.55, 0.35, 0.65))

PortfolioAnalytics

Portfolio Analysis, Including Numerical Methods for Optimization of Portfolios

v1.1.0
GPL-2 | GPL-3
Authors
Brian G. Peterson [cre, aut, cph], Peter Carl [aut, cph], Kris Boudt [ctb, cph], Ross Bennett [ctb, cph], Hezky Varon [ctb], Guy Yollin [ctb], R. Douglas Martin [ctb]
Initial release
2018-05-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.