def create_perf_attrib_stats(perf_attrib, risk_exposures):
summary = OrderedDict()<EOL>total_returns = perf_attrib['<STR_LIT>']<EOL>specific_returns = perf_attrib['<STR_LIT>']<EOL>common_returns = perf_attrib['<STR_LIT>']<EOL>summary['<STR_LIT>'] =ep.annual_return(specific_returns)<EOL>summary['<STR_LIT>'] =ep.annual_return(common_returns)<EOL>summary['<STR_LIT>'] =ep.annual_return(total_returns)<EOL>summary['<STR_LIT>'] =ep.sharpe_ratio(specific_returns)<EOL>summary['<STR_LIT>'] =ep.cum_returns_final(specific_returns)<EOL>summary['<STR_LIT>'] =ep.cum_returns_final(common_returns)<EOL>summary['<STR_LIT>'] =ep.cum_returns_final(total_returns)<EOL>summary = pd.Series(summary, name='<STR_LIT>')<EOL>annualized_returns_by_factor = [ep.annual_return(perf_attrib[c])<EOL>for c in risk_exposures.columns]<EOL>cumulative_returns_by_factor = [ep.cum_returns_final(perf_attrib[c])<EOL>for c in risk_exposures.columns]<EOL>risk_exposure_summary = pd.DataFrame(<EOL>data=OrderedDict([<EOL>(<EOL>'<STR_LIT>',<EOL>risk_exposures.mean(axis='<STR_LIT>')<EOL>),<EOL>('<STR_LIT>', annualized_returns_by_factor),<EOL>('<STR_LIT>', cumulative_returns_by_factor),<EOL>]),<EOL>index=risk_exposures.columns,<EOL>)<EOL>return summary, risk_exposure_summary<EOL>
Takes perf attribution data over a period of time and computes annualized
multifactor alpha, multifactor sharpe, risk exposures.