returns: Constructor of an object of S3 class 'returns'.

View source: R/apply_market_model.R

returnsR Documentation

Constructor of an object of S3 class returns.

Description

Constructs an object of S3 class returns.

Usage

returns(
  rates,
  regressor,
  market_model = c("mean_adj", "mrkt_adj", "sim"),
  estimation_method = c("ols"),
  estimation_start,
  estimation_end
)

Arguments

rates

an object of class either zoo or data.frame giving observed rates of returns of security.

regressor

an object of the same class as rates representing rates of returns of the market model, if needed.

market_model

a character indicating the market model among mean_adj, mrkt_adj, and sim.

estimation_method

a character specifying an estimation method for sim model.

estimation_start

an object of Date class giving the first date of the estimation period.

estimation_end

an object of Date class giving the last date of the estimation period.

Details

The constructor is a generic function, dispatched for classes zoo data.frame. Parameters rates and regressor should be objects of the same class (zoo or data.frame). There are three market model implemented. mean_adj stands for mean-adjusted-returns model, which is the average of returns during the estimation period. mrkt_adj represents market-adjusted-returns model: the securities' rates of returns are simply market index rates of returns (in terms of parameters - regressor). Finally, sim stands for single-index market model For this model only Ordinary Least Squares estimation_method is currently implemented. All models are described in Brown and Warner (1985).

Value

An object of S3 class returns, which contains following fields:

  • observed: an object of zoo class containing observed rates of returns.

  • predicted: an object of zoo class containing predicted by a market model rates of returns.

  • lower95CI: a lower bound of the 95% Confidence Interval for predicted rates of returns.

  • upper95CI: an upper bound of the 95% Confidence Interval for predicted rates of returns.

  • abnormal: an object of zoo class containing abnormal returns.

  • regressor: an object of zoo class containing rates of regressor (typically market index).

  • market_model: a code name of the market model.

  • full_name_market_model: a full name of the market model.

  • estimation_method: a code name of the estimation method (applied only for SIM).

  • full_name_estimation_method: a full name of the estimation method (applied only for SIM).

  • coefficients: coefficients α and β for SIM market model (applied only for SIM).

  • estimation_start: a start date of the estimation period.

  • estimation_end: an end date of the estimation period.

  • estimation_length: a length of the estimation period.

References

Brown S.J., Warner J.B. Using Daily Stock Returns, The Case of Event Studies. Journal of Financial Economics, 14:3-31, 1985.

See Also

apply_market_model

Examples

library("zoo")
## 1. Mean-adjusted-returns model
## Not run: 
library("magrittr")
single_return <- get_prices_from_tickers("AMZN",
                                         start = as.Date("2019-04-01"),
                                         end = as.Date("2020-04-01"),
                                         quote = "Close",
                                         retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous") %>%
    returns(market_model = "mean_adj",
            estimation_start = as.Date("2019-04-01"),
            estimation_end = as.Date("2020-03-13"))

## End(Not run)
## The result of the code above is equivalent to:
data(rates)
single_return <- returns(rates[, "AMZN"],
                         market_model = "mean_adj",
                         estimation_start = as.Date("2019-04-01"),
                         estimation_end = as.Date("2020-03-13"))

## 2. Market-adjusted-returns model
## Not run: 
library("magrittr")
rates_indx <- get_prices_from_tickers("^GSPC",
                                      start = as.Date("2019-04-01"),
                                      end = as.Date("2020-04-01"),
                                      quote = "Close",
                                      retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous")

single_return <- get_prices_from_tickers("AMZN",
                                         start = as.Date("2019-04-01"),
                                         end = as.Date("2020-04-01"),
                                         quote = "Close",
                                         retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous") %>%
    returns(regressor = rates_indx,
            market_model = "mrkt_adj",
            estimation_start = as.Date("2019-04-01"),
            estimation_end = as.Date("2020-03-13"))

## End(Not run)
## The result of the code above is equivalent to:
data(rates, rates_indx)
single_return <- returns(rates = rates[, "AMZN", drop = FALSE],
                         regressor = rates_indx,
                         market_model = "mrkt_adj",
                         estimation_method = "ols",
                         estimation_start = as.Date("2019-04-01"),
                         estimation_end = as.Date("2020-03-13"))

## 3. Single-index market model
## Not run: 
library("magrittr")
rates_indx <- get_prices_from_tickers("^GSPC",
                                      start = as.Date("2019-04-01"),
                                      end = as.Date("2020-04-01"),
                                      quote = "Close",
                                      retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous")

single_return <- get_prices_from_tickers("AMZN",
                                         start = as.Date("2019-04-01"),
                                         end = as.Date("2020-04-01"),
                                         quote = "Close",
                                         retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous") %>%
    returns(regressor = rates_indx,
            market_model = "sim",
            estimation_method = "ols",
            estimation_start = as.Date("2019-04-01"),
            estimation_end = as.Date("2020-03-13"))

## End(Not run)
## The result of the code above is equivalent to:
data(rates, rates_indx)
single_return <- returns(rates = rates[, "AMZN", drop = FALSE],
                         regressor = rates_indx,
                         market_model = "sim",
                         estimation_method = "ols",
                         estimation_start = as.Date("2019-04-01"),
                         estimation_end = as.Date("2020-03-13"))


irudnyts/estudy2 documentation built on April 21, 2022, 10:50 p.m.