title: How to calculate mean adjusted abnormal return
body: <p>I would like to calculate mean adjusted returns for several companies. 
  I have monthly data. I would like to calculate the rolling mean for the last 12 month. After that I need to subtract the rolling mean from the monthly return. </p>
  
  <p>At first I used <code>quantmod</code> and <code>lapply</code> for calculating the returns:</p>
  
  <pre><code>library(quantmod)
  
  stocks=new.env()
  
  startDate=as.Date("2008-07-31")
  
  endDate=as.Date("2019-06-30")
  
  tickers=c("ADS.DE","DAI.DE","BMW.DE")
  
  getSymbols(tickers,src="yahoo",env=stocks,from=startDate,to=endDate)
  
  stocksL=as.list(stocks)
  
  returns.daily=lapply(stocksL, function(x) diff(log(Cl(x))))
  
  returns.montly=lapply(returns.daily, apply.monthly, sum, na.rm=TRUE)
  </code></pre>
  
  <p>In the next step I have to calculate the rolling mean for the last 12 month for each month. My estimation period is from 2009-07-31 to 2019-06-30.
  After that I have to subtract the rolling mean from the return for each month.</p>