Home   >   User Resources   >   Online Help   >   apaCorrels.Conditional.Box
 

 

Function index Version 3.0.0

apaCorrels.Conditional.Box(TimeSeries, FromQuantile, ToQuantile, IsCorrelsOtherwiseNObs)

Excel=apaCorrels.Conditional.Box(TimeSeries, FromQuantile, ToQuantile, IsCorrelsOtherwiseNObs)

Result

Calculates conditional correlations inside and outside a box defined by a lower and an upper quantile.

Syntax

TimeSeries: r x c data matrix, each column containing a time series

FromQuantile: lower quantile of the box as a fraction between 0 and 1 (e.g. 0.25)

ToQuantile: upper quantile of the box as a fraction between 0 and 1 (e.g. 0.75), larger than FromQuantile

IsCorrelsOtherwiseNObs: TRUE to return the correlations, FALSE to return the number of observations used in their calculation (diagonal: full number of observations r)

Remarks

The upper triangle (i < j) holds the outside-the-box correlations and the lower triangle (j, i) the inside-the-box correlations of the same pair, both conditioning on the asset with the lower column index i. Observations are ranked per series (rank 1 = lowest, tied values receive their average rank). An observation is inside the box if FromQuantile x r < rank <= ToQuantile x r, and outside otherwise; FromQuantile must be smaller than ToQuantile and both must lie between 0 and 1. TimeSeries must be a complete numeric matrix (empty cells are read as 0, text returns #VALUE!). Each correlation is the Pearson correlation of the selected observations. #N/A is returned where fewer than two observations are selected or where one of the two series is constant on them; with exactly two selected observations the correlation is always +1 or -1. The diagonal is 1 (#N/A for a constant series); if IsCorrelsOtherwiseNObs is FALSE, the diagonal is the full number of observations r.