-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathbox_constraint.Rd
66 lines (53 loc) · 1.69 KB
/
box_constraint.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
\name{box_constraint}
\alias{box_constraint}
\title{constructor for box_constraint.}
\usage{
box_constraint(type = "box", assets, min, max, min_mult,
max_mult, enabled = TRUE, message = FALSE, ...)
}
\arguments{
\item{type}{character type of the constraint}
\item{assets}{number of assets, or optionally a named
vector of assets specifying initial weights}
\item{min}{numeric or named vector specifying minimum
weight box constraints}
\item{max}{numeric or named vector specifying minimum
weight box constraints}
\item{min_mult}{numeric or named vector specifying
minimum multiplier box constraint from initial weight in
\code{assets}}
\item{max_mult}{numeric or named vector specifying
maximum multiplier box constraint from initial weight in
\code{assets}}
\item{enabled}{TRUE/FALSE}
\item{message}{TRUE/FALSE. The default is message=FALSE.
Display messages if TRUE.}
\item{\dots}{any other passthru parameters to specify box
constraints}
}
\value{
an object of class '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
\code{\link{add.constraint}}.
}
\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))
}
\author{
Ross Bennett
}
\seealso{
\code{\link{add.constraint}}
}