# Spot variance drift consequently to style drift

I am looking for some information on how to spot variance drift for a portfolio in accordance to its benchmarks,

Let's say that we have returns of the portfolio $\textbf{P}=(P_1,...,P_t,...,P_n)$ and its benchmark $\textbf{B}=(B_1,...,B_t,...,,B_n)$ Despite the correlation ($\rho$) of the overall period is satisfying (over $0.90$, from $t=1$ to $t=n$), we would like to find out time periods when it is not the case (locally less than $0.50)$,

The subset found could range from two weeks to several months (usually the full range the period benchmark is one year)

Since the comparison is between two variables P and B I would start using a visual method i.e. make a graph i.e. plot the spread between the variables. Look at the graph and identify in what periods the graph is steep. Where the graph is steep those are the time periods where correlation is low because then the varibles are deviating more then for time periods where the graph is not steep.

You can plot rolling correlations with varying windows: say 2 weeks, 1 month, 2 months, and so on. For example, say in excel, you calculate the correlation over 2 weeks (10 observations), then just drag the formula to the end of the series. That is one series. Next do the same for 1 month, and so on.

Most softwares should have built in functions for this.

For example, for python, see the discussion here: https://stackoverflow.com/questions/27069003/calculate-rolling-correlation-with-pandas

For SAS , look up Proc Expand.