monthly_return: Compute Monthly Returns of a Vector.

View source: R/Functions.R

monthly_returnR Documentation

Compute Monthly Returns of a Vector.

Description

This function takes a numeric vector of asset returns and computes monthly returns.

Usage

monthly_return(vec)

Arguments

vec

a numeric vector of asset returns.

Value

A numeric vector of monthly returns.

Note

The input data must be an xts object with dates as rownames.

See Also

weekly_return, annual_return

Examples


# Compute monthly returns of an asset vector
require(xts)
asset_returns_xts <- xts(c(29.2, 30.0, 36.2, 30.4, 38.5, -35.6, 34.5),
                         order.by = as.Date(c("2022-05-02", "2022-06-02", "2022-07-02",
                                             "2022-08-02", "2022-09-02", "2022-10-02",
                                             "2022-11-02")))
monthly_return(asset_returns_xts)



StockDistFit documentation built on May 31, 2023, 8:59 p.m.