# Invest: Investing in a Toy Market In RelValAnalysis: Relative Value Analysis

## Description

Given the portfolio weights and a toy market, the function `Invest` simulates the growth of \$1 of the corresponding portfolio and that of the benchmark.

## Usage

 `1` ```Invest(market, weight, plot = TRUE) ```

## Arguments

 `market` a `toymkt` object. `weight` the portfolio weights. The portfolio weights must be non-negative and sum to one (full investment with no short sales). It can be a `zoo` object or matrix/dataframe whose number of rows is at least as large as that of `market\$R`. If the number of rows of `weight` is larger than required, only the initial rows will be used. `weight` can also be a numeric vector whose length is equal to the number of columns of `market\$R` (the number of assets). In the latter case the portfolio is assumed to be constant-weighted through out. `plot` `TRUE` or `FALSE`. If `TRUE`, the growth of \$1 of the portfolio will be plotted together with the growth of \$1 of the market portfolio. The default value is `TRUE`.

## Details

The relative value in the second plot is the ratio of the growth of \$1 of the portfolio to that of the benchmark. It is called relative because the value is normalized by the value of the benchmark portfolio.

## Value

A list containing the following components.

 `growth` a `zoo` object representing the growth of \$1 of the portfolio and the benchmark. `R` a `zoo` object of simple returns of the two portfolios. `r` a `zoo` object of log returns of the two portfolios.

`toymkt`

## Examples

 ```1 2 3 4 5``` ```# Performance of the equal-weighted portfolio data(applestarbucks) market <- toymkt(applestarbucks) weight <- c(0.5, 0.5) # equal-weighted portfolio result <- Invest(market, weight, plot = TRUE) ```

### Example output

```Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

as.Date, as.Date.numeric

Warning message:
In toymkt(applestarbucks) :
Since initial.weight is not given, the benchmark is assumed to be equal-weighted initially.
Warning message:
In Invest(market, weight, plot = TRUE) :
Since only one weight vector is supplied, the portfolio is assumed to be constant-weighted.
```

RelValAnalysis documentation built on May 2, 2019, 3:09 a.m.