[Introcompfinr-commits] r9 - in pkg/IntroCompFinR: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 18 22:02:26 CET 2015
Author: bethanyyollin
Date: 2015-02-18 22:02:25 +0100 (Wed, 18 Feb 2015)
New Revision: 9
Modified:
pkg/IntroCompFinR/NAMESPACE
pkg/IntroCompFinR/R/efficient.frontier.R
pkg/IntroCompFinR/R/efficient.portfolio.R
pkg/IntroCompFinR/R/getPortfolio.R
pkg/IntroCompFinR/R/globalMin.portfolio.R
pkg/IntroCompFinR/R/plot.Markowitz.R
pkg/IntroCompFinR/R/plot.portfolio.R
pkg/IntroCompFinR/R/print.Markowitz.R
pkg/IntroCompFinR/R/print.portfolio.R
pkg/IntroCompFinR/R/summary.Markowitz.R
pkg/IntroCompFinR/R/summary.portfolio.R
pkg/IntroCompFinR/R/tangency.portfolio.R
pkg/IntroCompFinR/man/efficient.frontier.Rd
pkg/IntroCompFinR/man/efficient.portfolio.Rd
pkg/IntroCompFinR/man/getPortfolio.Rd
pkg/IntroCompFinR/man/globalMin.portfolio.Rd
pkg/IntroCompFinR/man/plot.Markowitz.Rd
pkg/IntroCompFinR/man/plot.portfolio.Rd
pkg/IntroCompFinR/man/print.Markowitz.Rd
pkg/IntroCompFinR/man/print.portfolio.Rd
pkg/IntroCompFinR/man/summary.portfolio.Rd
pkg/IntroCompFinR/man/tangency.portfolio.Rd
Log:
Constructed NAMESPACE with Roxygen. Standardized comments in examples and source code. Eliminated extraneous arguments listed in some of the documentation.
Modified: pkg/IntroCompFinR/NAMESPACE
===================================================================
--- pkg/IntroCompFinR/NAMESPACE 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/NAMESPACE 2015-02-18 21:02:25 UTC (rev 9)
@@ -1,2 +1,13 @@
+# Generated by roxygen2 (4.1.0): do not edit by hand
-export(efficient.frontier,efficient.portfolio,getPortfolio,globalMin.portfolio,plot.Markowitz,plot.portfolio,print.Markowitz,print.portfolio,summary.Markowitz,summary.portfolio,tangency.portfolio)
+export(efficient.frontier)
+export(efficient.portfolio)
+export(getPortfolio)
+export(globalMin.portfolio)
+export(plot.Markowitz)
+export(plot.portfolio)
+export(print.Markowitz)
+export(print.portfolio)
+export(summary.Markowitz)
+export(summary.portfolio)
+export(tangency.portfolio)
Modified: pkg/IntroCompFinR/R/efficient.frontier.R
===================================================================
--- pkg/IntroCompFinR/R/efficient.frontier.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/efficient.frontier.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -12,7 +12,7 @@
#' one portfolio and an efficient portfolio with target expected return equal to the maximum
#' expected return of the assets under consideration as the other portfolio. Call these portfolios
#' \eqn{m} and \eqn{x}, respectively. For any number alpha, another efficient
-#' portfolio can be computed as \eqn{z=\alpha m+(1-\alpha)x}.
+#' portfolio can be computed as \eqn{z=\alpha m+(1-\alpha)x}
#'
#' @param er N x 1 vector of expected returns
#' @param cov.mat N x N return covariance matrix
@@ -20,10 +20,6 @@
#' @param alpha.min minimum value of alpha, default is -.5
#' @param alpha.max maximum value of alpha, defualt is 1.5
#' @param shorts logical, allow shorts is \code{TRUE}
-#' @param object object of class Markowitz
-#' @param plot.assets logical, if \code{TRUE} then plot asset \code{sd} and \code{er}
-#' @param risk.free numeric, risk free rate
-#' @param ... controlled variables for \code{plot()} or \code{print()}
#'
#' @return
#' \item{call}{captures function call}
@@ -61,23 +57,12 @@
#' text(tan.port$sd, tan.port$er, labels="TANGENCY", pos=2)
#' sr.tan = (tan.port$er - r.free)/tan.port$sd
#' abline(a=r.free, b=sr.tan, col="green", lwd=2)
+#'
+#' @export efficient.frontier
efficient.frontier <-
function(er, cov.mat, nport=20, alpha.min=-0.5, alpha.max=1.5, shorts=TRUE)
{
- # Compute efficient frontier with no short-sales constraints
- #
- # inputs:
- # er N x 1 vector of expected returns
- # cov.mat N x N return covariance matrix
- # nport scalar, number of efficient portfolios to compute
- # shorts logical, allow shorts is TRUE
- #
- # output is a Markowitz object with the following elements
- # call captures function call
- # er nport x 1 vector of expected returns on efficient porfolios
- # sd nport x 1 vector of std deviations on efficient portfolios
- # weights nport x N matrix of weights on efficient portfolios
call <- match.call()
#
@@ -114,9 +99,9 @@
er.max <- max(er)
port.max <- efficient.portfolio(er,cov.mat,er.max)
w.max <- port.max$weights
- a <- seq(from=alpha.min,to=alpha.max,length=nport) # convex combinations
- we.mat <- a %o% w.gmin + (1-a) %o% w.max # rows are efficient portfolios
- er.e <- we.mat %*% er # expected returns of efficient portfolios
+ a <- seq(from=alpha.min,to=alpha.max,length=nport) # convex combinations
+ we.mat <- a %o% w.gmin + (1-a) %o% w.max # rows are efficient portfolios
+ er.e <- we.mat %*% er # expected returns of efficient portfolios
er.e <- as.vector(er.e)
} else if(shorts==FALSE){
we.mat <- matrix(0, nrow=nport, ncol=N)
@@ -131,7 +116,7 @@
names(er.e) <- port.names
cov.e <- we.mat %*% cov.mat %*% t(we.mat) # cov mat of efficient portfolios
- sd.e <- sqrt(diag(cov.e)) # std devs of efficient portfolios
+ sd.e <- sqrt(diag(cov.e)) # std devs of efficient portfolios
sd.e <- as.vector(sd.e)
names(sd.e) <- port.names
dimnames(we.mat) <- list(port.names,asset.names)
Modified: pkg/IntroCompFinR/R/efficient.portfolio.R
===================================================================
--- pkg/IntroCompFinR/R/efficient.portfolio.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/efficient.portfolio.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -14,9 +14,6 @@
#' @param cov.mat N x N return covariance matrix
#' @param target.return scalar, target expected return
#' @param shorts logical, allow shorts is \code{TRUE}
-#' @param object object of class portfolio
-#' @param risk.free numeric, risk free rate
-#' @param ... controlled variables for \code{plot()}, \code{print()} and \code{summary()}
#'
#' @return
#' \item{call}{captures function call}
@@ -25,6 +22,7 @@
#' \item{weights}{N x 1 vector of portfolio weights}
#'
#' @examples
+#' # construct the data
#' asset.names = c("MSFT", "NORD", "SBUX")
#' er = c(0.0427, 0.0015, 0.0285)
#' names(er) = asset.names
@@ -48,31 +46,19 @@
#' e.port.msft.ns
#' summary(e.port.msft.ns, risk.free=r.free)
#' plot(e.port.msft.ns, col="blue")
+#'
+#' @export efficient.portfolio
efficient.portfolio <-
function(er, cov.mat, target.return, shorts=TRUE)
{
- # compute minimum variance portfolio subject to target return
- #
- # inputs:
- # er N x 1 vector of expected returns
- # cov.mat N x N covariance matrix of returns
- # target.return scalar, target expected return
- # shorts logical, allow shorts is TRUE
- #
- # output is portfolio object with the following elements
- # call original function call
- # er portfolio expected return
- # sd portfolio standard deviation
- # weights N x 1 vector of portfolio weights
- #
call <- match.call()
#
# check for valid inputs
#
asset.names <- names(er)
- er <- as.vector(er) # assign names if none exist
+ er <- as.vector(er) # assign names if none exist
N <- length(er)
cov.mat <- as.matrix(cov.mat)
if(N != nrow(cov.mat))
Modified: pkg/IntroCompFinR/R/getPortfolio.R
===================================================================
--- pkg/IntroCompFinR/R/getPortfolio.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/getPortfolio.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -11,10 +11,7 @@
#'
#' @param er N x 1 vector of expected returns
#' @param cov.mat N x N return covariance matrix
-#' @param weigths N x 1 vector of portfolio weights
-#' @param object object of class portfolio
-#' @param risk.free numeric, risk free rate
-#' @param ... controlled variables for \code{plot()}, \code{print()} and \code{summary()}
+#' @param weights N x 1 vector of portfolio weights
#'
#' @return
#' \item{call}{captures function call}
@@ -23,7 +20,7 @@
#' \item{weights}{N x 1 vector of portfolio weights}
#'
#' @examples
-#' # Examples from Introduction to Financial Econometrics
+#' # construct the data
#' asset.names = c("MSFT", "NORD", "SBUX")
#' er = c(0.0427, 0.0015, 0.0285)
#' names(er) = asset.names
@@ -45,23 +42,12 @@
#' equalWeight.portfolio
#' summary(equalWeight.portfolio)
#' plot(equalWeight.portfolio, col="blue")
+#'
+#' @export getPortfolio
getPortfolio <-
function(er, cov.mat, weights)
{
- # contruct portfolio object
- #
- # inputs:
- # er N x 1 vector of expected returns
- # cov.mat N x N covariance matrix of returns
- # weights N x 1 vector of portfolio weights
- #
- # output is portfolio object with the following elements
- # call original function call
- # er portfolio expected return
- # sd portfolio standard deviation
- # weights N x 1 vector of portfolio weights
- #
call <- match.call()
#
@@ -70,7 +56,7 @@
asset.names <- names(er)
weights <- as.vector(weights)
names(weights) = names(er)
- er <- as.vector(er) # assign names if none exist
+ er <- as.vector(er) # assign names if none exist
if(length(er) != length(weights))
stop("dimensions of er and weights do not match")
cov.mat <- as.matrix(cov.mat)
@@ -90,4 +76,4 @@
"weights" = weights)
class(ans) <- "portfolio"
return(ans)
-}
+}
\ No newline at end of file
Modified: pkg/IntroCompFinR/R/globalMin.portfolio.R
===================================================================
--- pkg/IntroCompFinR/R/globalMin.portfolio.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/globalMin.portfolio.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -12,9 +12,6 @@
#' @param er N x 1 vector of expected returns
#' @param cov.mat N x N return covariance matrix
#' @param shorts logical, allow shorts is \code{TRUE}
-#' @param object object of class portfolio
-#' @param risk.free numeric, risk free rate
-#' @param ... controlled variables for \code{plot()}, \code{print()} and \code{summary()}
#'
#' @return
#' \item{call}{captures function call}
@@ -23,6 +20,7 @@
#' \item{weights}{N x 1 vector of portfolio weights}
#'
#' @examples
+#' # construct the data
#' asset.names = c("MSFT", "NORD", "SBUX")
#' er = c(0.0427, 0.0015, 0.0285)
#' names(er) = asset.names
@@ -46,29 +44,19 @@
#' print(gmin.port.ns)
#' summary(gmin.port.ns, risk.free=r.free)
#' plot(gmin.port.ns, col="blue")
+#'
+#' @export globalMin.portfolio
globalMin.portfolio <-
function(er, cov.mat, shorts=TRUE)
{
- # Compute global minimum variance portfolio
- #
- # inputs:
- # er N x 1 vector of expected returns
- # cov.mat N x N return covariance matrix
- # shorts logical, allow shorts is TRUE
- #
- # output is portfolio object with the following elements
- # call original function call
- # er portfolio expected return
- # sd portfolio standard deviation
- # weights N x 1 vector of portfolio weights
call <- match.call()
#
# check for valid inputs
#
asset.names <- names(er)
- er <- as.vector(er) # assign names if none exist
+ er <- as.vector(er) # assign names if none exist
cov.mat <- as.matrix(cov.mat)
N <- length(er)
if(N != nrow(cov.mat))
Modified: pkg/IntroCompFinR/R/plot.Markowitz.R
===================================================================
--- pkg/IntroCompFinR/R/plot.Markowitz.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/plot.Markowitz.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -7,7 +7,7 @@
#'
#' @param object object of class Markowitz
#' @param plot.assets if \code{TRUE} then plot asset \code{sd} and \code{er}
-#' @param ... controlled variables for \code{plot()}
+#' @param ... additional arguments passed to \code{plot()}
#'
#' @examples
#' # construct the data
@@ -39,10 +39,11 @@
#' text(tan.port$sd, tan.port$er, labels="TANGENCY", pos=2)
#' sr.tan = (tan.port$er - r.free)/tan.port$sd
#' abline(a=r.free, b=sr.tan, col="green", lwd=2)
+#'
+#' @export plot.Markowitz
plot.Markowitz <-
function(object, plot.assets=FALSE, ...)
-# plot.assets logical. If true then plot asset sd and er
{
if (!plot.assets) {
y.lim=c(0,max(object$er))
Modified: pkg/IntroCompFinR/R/plot.portfolio.R
===================================================================
--- pkg/IntroCompFinR/R/plot.portfolio.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/plot.portfolio.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -6,9 +6,10 @@
#' The \code{plot()} method shows a bar chart of the portfolio weights.
#'
#' @param object object of class portfolio
-#' @param ... controlled variables for \code{barplot()}
+#' @param ... additional arguments passed to \code{barplot()}
#'
#' @examples
+#' # construct the data
#' asset.names = c("MSFT", "NORD", "SBUX")
#' er = c(0.0427, 0.0015, 0.0285)
#' names(er) = asset.names
@@ -23,6 +24,8 @@
#' ew = rep(1,3)/3
#' equalWeight.portfolio = getPortfolio(er=er,cov.mat=covmat,weights=ew)
#' plot(equalWeight.portfolio, col="blue")
+#'
+#' @export plot.portfolio
plot.portfolio <-
function(object, ...)
@@ -31,4 +34,4 @@
barplot(object$weights, names=asset.names,
xlab="Assets", ylab="Weight", main="Portfolio Weights", ...)
invisible()
-}
+}
\ No newline at end of file
Modified: pkg/IntroCompFinR/R/print.Markowitz.R
===================================================================
--- pkg/IntroCompFinR/R/print.Markowitz.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/print.Markowitz.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -6,7 +6,7 @@
#' Print efficient frontier
#'
#' @param object object of class Markowitz
-#' @param ... controlled variables for \code{print()}
+#' @param ... additional arguments passed to \code{print()}
#'
#' @examples
#' # construct the data
@@ -30,6 +30,8 @@
#' alpha.max=1.5, nport=20)
#' attributes(ef)
#' print(ef)
+#'
+#' @export print.Markowitz
print.Markowitz <-
function(object, ...)
Modified: pkg/IntroCompFinR/R/print.portfolio.R
===================================================================
--- pkg/IntroCompFinR/R/print.portfolio.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/print.portfolio.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -6,9 +6,10 @@
#' Print method of class portfolio.
#'
#' @param object object of class portfolio
-#' @param ... controlled variables for \code{print()}
+#' @param ... additional arguments passed to \code{print()}
#'
#' @examples
+#' # construct the data
#' asset.names = c("MSFT", "NORD", "SBUX")
#' er = c(0.0427, 0.0015, 0.0285)
#' names(er) = asset.names
@@ -23,6 +24,8 @@
#' ew = rep(1,3)/3
#' equalWeight.portfolio = getPortfolio(er=er,cov.mat=covmat,weights=ew)
#' print(equalWeight.portfolio)
+#'
+#' @export print.portfolio
print.portfolio <-
function(object, ...)
Modified: pkg/IntroCompFinR/R/summary.Markowitz.R
===================================================================
--- pkg/IntroCompFinR/R/summary.Markowitz.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/summary.Markowitz.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -31,6 +31,8 @@
#' alpha.max=1.5, nport=20)
#' attributes(ef)
#' summary(ef)
+#'
+#' @export summary.Markowitz
summary.Markowitz <-
function(object, risk.free=NULL)
@@ -53,11 +55,11 @@
#
# compute tangency portfolio
tan.port <- tangency.portfolio(er,cov.mat,risk.free)
- x.t <- sd.e/tan.port$sd # weights in tangency port
- rf <- 1 - x.t # weights in t-bills
+ x.t <- sd.e/tan.port$sd # weights in tangency port
+ rf <- 1 - x.t # weights in t-bills
er.e <- risk.free + x.t*(tan.port$er - risk.free)
names(er.e) <- port.names
- we.mat <- x.t %o% tan.port$weights # rows are efficient portfolios
+ we.mat <- x.t %o% tan.port$weights # rows are efficient portfolios
dimnames(we.mat) <- list(port.names, asset.names)
we.mat <- cbind(rf,we.mat)
}
Modified: pkg/IntroCompFinR/R/summary.portfolio.R
===================================================================
--- pkg/IntroCompFinR/R/summary.portfolio.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/summary.portfolio.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -7,9 +7,10 @@
#'
#' @param object object of class portfolio
#' @param risk.free numeric, risk free rate
-#' @param ... controlled variables for \code{summary()}
+#' @param ... additional arguments passed to \code{summary()}
#'
#' @examples
+#' # construct the data
#' asset.names = c("MSFT", "NORD", "SBUX")
#' er = c(0.0427, 0.0015, 0.0285)
#' names(er) = asset.names
@@ -24,12 +25,11 @@
#' ew = rep(1,3)/3
#' equalWeight.portfolio = getPortfolio(er=er,cov.mat=covmat,weights=ew)
#' summary(equalWeight.portfolio)
+#'
+#' @export summary.portfolio
summary.portfolio <-
function(object, risk.free=NULL, ...)
-# risk.free risk-free rate. If not null then
-# compute and print Sharpe ratio
-#
{
cat("Call:\n")
print(object$call)
Modified: pkg/IntroCompFinR/R/tangency.portfolio.R
===================================================================
--- pkg/IntroCompFinR/R/tangency.portfolio.R 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/R/tangency.portfolio.R 2015-02-18 21:02:25 UTC (rev 9)
@@ -14,8 +14,6 @@
#' @param cov.mat N x N return covariance matrix
#' @param risk.free numeric, risk free rate
#' @param shorts logical, allow shorts is \code{TRUE}
-#' @param object object of class Markowitz
-#' @param ... controlled variables for \code{plot()}, \code{print()} and \code{summary()}
#'
#' @return
#' \item{call}{captures function call}
@@ -24,6 +22,7 @@
#' \item{weights}{N x 1 vector of portfolio weights}
#'
#' @examples
+#' # construct the data
#' asset.names = c("MSFT", "NORD", "SBUX")
#' er = c(0.0427, 0.0015, 0.0285)
#' names(er) = asset.names
@@ -45,23 +44,12 @@
#' tan.port.ns
#' summary(tan.port.ns, risk.free=r.free)
#' plot(tan.port.ns, col="blue")
+#'
+#' @export tangency.portfolio
tangency.portfolio <-
function(er,cov.mat,risk.free, shorts=TRUE)
{
- # compute tangency portfolio
- #
- # inputs:
- # er N x 1 vector of expected returns
- # cov.mat N x N return covariance matrix
- # risk.free scalar, risk-free rate
- # shorts logical, allow shorts is TRUE
- #
- # output is portfolio object with the following elements
- # call captures function call
- # er portfolio expected return
- # sd portfolio standard deviation
- # weights N x 1 vector of portfolio weights
call <- match.call()
#
@@ -92,7 +80,7 @@
if(shorts==TRUE){
cov.mat.inv <- solve(cov.mat)
w.t <- cov.mat.inv %*% (er - risk.free) # tangency portfolio
- w.t <- as.vector(w.t/sum(w.t)) # normalize weights
+ w.t <- as.vector(w.t/sum(w.t)) # normalize weights
} else if(shorts==FALSE){
Dmat <- 2*cov.mat
dvec <- rep.int(0, N)
@@ -114,4 +102,4 @@
"weights" = w.t)
class(tan.port) <- "portfolio"
return(tan.port)
-}
+}
\ No newline at end of file
Modified: pkg/IntroCompFinR/man/efficient.frontier.Rd
===================================================================
--- pkg/IntroCompFinR/man/efficient.frontier.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/efficient.frontier.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -19,14 +19,6 @@
\item{alpha.max}{maximum value of alpha, defualt is 1.5}
\item{shorts}{logical, allow shorts is \code{TRUE}}
-
-\item{object}{object of class Markowitz}
-
-\item{plot.assets}{logical, if \code{TRUE} then plot asset \code{sd} and \code{er}}
-
-\item{risk.free}{numeric, risk free rate}
-
-\item{...}{controlled variables for \code{plot()} or \code{print()}}
}
\value{
\item{call}{captures function call}
@@ -44,7 +36,7 @@
one portfolio and an efficient portfolio with target expected return equal to the maximum
expected return of the assets under consideration as the other portfolio. Call these portfolios
\eqn{m} and \eqn{x}, respectively. For any number alpha, another efficient
-portfolio can be computed as \eqn{z=\alpha m+(1-\alpha)x}.
+portfolio can be computed as \eqn{z=\alpha m+(1-\alpha)x}
}
\examples{
# construct the data
Modified: pkg/IntroCompFinR/man/efficient.portfolio.Rd
===================================================================
--- pkg/IntroCompFinR/man/efficient.portfolio.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/efficient.portfolio.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -14,12 +14,6 @@
\item{target.return}{scalar, target expected return}
\item{shorts}{logical, allow shorts is \code{TRUE}}
-
-\item{object}{object of class portfolio}
-
-\item{risk.free}{numeric, risk free rate}
-
-\item{...}{controlled variables for \code{plot()}, \code{print()} and \code{summary()}}
}
\value{
\item{call}{captures function call}
@@ -36,6 +30,7 @@
\eqn{t(x)\mu=\mu_0}
}
\examples{
+# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
Modified: pkg/IntroCompFinR/man/getPortfolio.Rd
===================================================================
--- pkg/IntroCompFinR/man/getPortfolio.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/getPortfolio.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -11,13 +11,7 @@
\item{cov.mat}{N x N return covariance matrix}
-\item{weigths}{N x 1 vector of portfolio weights}
-
-\item{object}{object of class portfolio}
-
-\item{risk.free}{numeric, risk free rate}
-
-\item{...}{controlled variables for \code{plot()}, \code{print()} and \code{summary()}}
+\item{weights}{N x 1 vector of portfolio weights}
}
\value{
\item{call}{captures function call}
@@ -33,7 +27,7 @@
consideration as well as a vector of portfolio weights are needed.
}
\examples{
-# Examples from Introduction to Financial Econometrics
+# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
Modified: pkg/IntroCompFinR/man/globalMin.portfolio.Rd
===================================================================
--- pkg/IntroCompFinR/man/globalMin.portfolio.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/globalMin.portfolio.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -12,12 +12,6 @@
\item{cov.mat}{N x N return covariance matrix}
\item{shorts}{logical, allow shorts is \code{TRUE}}
-
-\item{object}{object of class portfolio}
-
-\item{risk.free}{numeric, risk free rate}
-
-\item{...}{controlled variables for \code{plot()}, \code{print()} and \code{summary()}}
}
\value{
\item{call}{captures function call}
@@ -33,6 +27,7 @@
problem: min \eqn{t(m)\Sigma m} s.t. \eqn{t(m)1=1}.
}
\examples{
+# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
Modified: pkg/IntroCompFinR/man/plot.Markowitz.Rd
===================================================================
--- pkg/IntroCompFinR/man/plot.Markowitz.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/plot.Markowitz.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -11,7 +11,7 @@
\item{plot.assets}{if \code{TRUE} then plot asset \code{sd} and \code{er}}
-\item{...}{controlled variables for \code{plot()}}
+\item{...}{additional arguments passed to \code{plot()}}
}
\description{
Plot efficient frontier.
Modified: pkg/IntroCompFinR/man/plot.portfolio.Rd
===================================================================
--- pkg/IntroCompFinR/man/plot.portfolio.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/plot.portfolio.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -9,12 +9,13 @@
\arguments{
\item{object}{object of class portfolio}
-\item{...}{controlled variables for \code{barplot()}}
+\item{...}{additional arguments passed to \code{barplot()}}
}
\description{
The \code{plot()} method shows a bar chart of the portfolio weights.
}
\examples{
+# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
Modified: pkg/IntroCompFinR/man/print.Markowitz.Rd
===================================================================
--- pkg/IntroCompFinR/man/print.Markowitz.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/print.Markowitz.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -9,7 +9,7 @@
\arguments{
\item{object}{object of class Markowitz}
-\item{...}{controlled variables for \code{print()}}
+\item{...}{additional arguments passed to \code{print()}}
}
\description{
Print efficient frontier
Modified: pkg/IntroCompFinR/man/print.portfolio.Rd
===================================================================
--- pkg/IntroCompFinR/man/print.portfolio.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/print.portfolio.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -9,12 +9,13 @@
\arguments{
\item{object}{object of class portfolio}
-\item{...}{controlled variables for \code{print()}}
+\item{...}{additional arguments passed to \code{print()}}
}
\description{
Print method of class portfolio.
}
\examples{
+# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
Modified: pkg/IntroCompFinR/man/summary.portfolio.Rd
===================================================================
--- pkg/IntroCompFinR/man/summary.portfolio.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/summary.portfolio.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -11,12 +11,13 @@
\item{risk.free}{numeric, risk free rate}
-\item{...}{controlled variables for \code{summary()}}
+\item{...}{additional arguments passed to \code{summary()}}
}
\description{
Summary method of class portfolio.
}
\examples{
+# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
Modified: pkg/IntroCompFinR/man/tangency.portfolio.Rd
===================================================================
--- pkg/IntroCompFinR/man/tangency.portfolio.Rd 2015-02-17 17:49:35 UTC (rev 8)
+++ pkg/IntroCompFinR/man/tangency.portfolio.Rd 2015-02-18 21:02:25 UTC (rev 9)
@@ -14,10 +14,6 @@
\item{risk.free}{numeric, risk free rate}
\item{shorts}{logical, allow shorts is \code{TRUE}}
-
-\item{object}{object of class Markowitz}
-
-\item{...}{controlled variables for \code{plot()}, \code{print()} and \code{summary()}}
}
\value{
\item{call}{captures function call}
@@ -34,6 +30,7 @@
where \eqn{r_f} denotes the risk-free rate.
}
\examples{
+# construct the data
asset.names = c("MSFT", "NORD", "SBUX")
er = c(0.0427, 0.0015, 0.0285)
names(er) = asset.names
More information about the Introcompfinr-commits
mailing list