Hello R users,
I would like to use estudy2 for analyzing the effect of event on one firm. But there is error in my code
Could anyone tell me the code for this question.
I would really encourage you to review the following guide, FAQ: Tips for writing R-related questions.
For example, the guide emphasizes asking coding questions with formatted code-chunks and a reprex
.
You may have noticed folks here requesting minimal reprex
es, that's because asking questions this way saves answerers a lot of time.
Reproducible Examples:
- help make your question clear and replicable
- increases the probability folks will reach out and try to help,
- reduces the number of back-and-forths required to understand the question,
- and makes your question and suggested solutions more useful to folks in the future researching similar problems.
library(estudy2)
tickers <- c('PFE')
prices <- get_prices_from_tickers(tickers,start = as.Date('2020-04-20'),end=as.Date('2020-12-03'),quote='Close',retclass='zoo')
price_indx <- get_prices_from_tickers('XBI',start=as.Date('2020-04-20'),end=as.Date('2020-12-03'),quote='Close',retclass='zoo')
rates <- get_rates_from_prices(prices,quote='Close',multi_day=TRUE,compounding='discrete')
rates_indx <- get_rates_from_prices(price_indx,quote='Close',multi_day=TRUE,compounding='discrete')
securities_returns <- apply_market_model(rates=rates,regressor=rates_indx,same_regressor_for_all=TRUE,market_model='sim',estimation_method='ols',estimation_start=as.Date('2020-04-20'),estimation_end=as.Date('2020-11-03'))
list_of_returns=securities_returns
class(list_of_returns)
t_test(list_of_returns,event_start=as.Date('2020-11-04'),event_end=as.Date('2020-12-03'))
I don not know why the last code cannot run
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.