Calculating Partial Correlation Matrix with Excel VBA

Partial Correlation
It is simply defined as the measure of the relationship between two or more variables while controlling for the effects of one or more additional variables.

For example, study of partial correlation between price and demand would involve studying the relationship between price and demand excluding the effect of price of related goods, disposable income, taste and preference etc.

Derivation
1. Compute correlation matrix
=CORREL(OFFSET(firstvariable_range,,ROWS($1:1)-1),OFFSET(firstvariable_range,,COLUMNS($A:A)-1))

For example, you have a 4 X 4 matrix and data for variables are entered in cells A2:D8 so paste this formula in cell G3  =CORREL(OFFSET($A$2:$A$8,,ROWS($1:1)-1),OFFSET($A$2:$A$8,,COLUMNS($A:A)-1))
In this case, firstvariable_range is A2:A8.

For detailed explanation, visit this link Correlation Matrix using Excel Formula

Download the workbook used in this example and play around with the formula to test your understanding.

2. Compute Partial correlation matrix

How to Execute
1. Open Excel. Press Alt F11 to open VB editor
2. Go to Insert >> Module
3. In module, paste the above code to VB editor 
4. Close VB editor window
5. Select the range of a table M15:P18
6. Enter =PartialCor(G3:J6) and Hit Ctrl Shift Enter
7. After pressing Ctrl Shift Enter you will find {=PartialCor(G3.:J6)}
    across all the cells in matrix



Excel Tutorials : 100 Excel Tutorials

Get Free Email Updates :
*Please confirm your email address by clicking on the link sent to your Email*

Related Posts:

0 Response to "Calculating Partial Correlation Matrix with Excel VBA"

Post a Comment

Next → ← Prev