# 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")
tickers <- c("AMZN", "ZM", "UBER", "NFLX", "SHOP", "FB", "UPWK")
get_prices_from_tickers(tickers,
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") %>%
apply_market_model(regressor = rates_indx,
same_regressor_for_all = TRUE,
market_model = "sim",
estimation_method = "ols",
estimation_start = as.Date("2019-04-01"),
estimation_end = as.Date("2020-03-13")) %>%
rank_test(event_start = as.Date("2020-03-16"),
event_end = as.Date("2020-03-20"))
# }
# NOT RUN {
## The result of the code above is equivalent to:
data(securities_returns)
rank_test(list_of_returns = securities_returns,
event_start = as.Date("2020-03-16"),
event_end = as.Date("2020-03-20"))
# }
Run the code above in your browser using DataLab