Professional Documents
Culture Documents
canoncorr
Canonical correlation
Syntax
[ A , B ]=c a n o n c o r r ( X , Y ) [ A , B , r ]=c a n o n c o r r ( X , Y ) [ A , B , r , U , V ]=c a n o n c o r r ( X , Y ) [ A , B , r , U , V , s t a t s ]=c a n o n c o r r ( X , Y )
Description
[ A , B ]=c a n o n c o r r ( X , Y ) computesthesamplecanonicalcoefficientsforthen by d 1 andn by d 2 datamatricesX andY .X andY musthavethesamenumberofobservations(rows)butcanhavedifferentnumbersofvariables(columns).A andB are d 1 by d andd 2 by d matrices,whered = m i n ( r a n k ( X ) , r a n k ( Y ) ) .Thej thcolumnsofA andB containthecanonical coefficients,i.e.,thelinearcombinationofvariablesmakingupthej thcanonicalvariableforX andY ,respectively.Columnsof A andB arescaledtomakethecovariancematricesofthecanonicalvariablestheidentitymatrix(seeU andV below).IfX orY islessthanfullrank,c a n o n c o r r givesawarningandreturnszerosintherowsofA orB correspondingtodependentcolumns ofX orY . [ A , B , r ]=c a n o n c o r r ( X , Y ) alsoreturnsa1by d vectorcontainingthesamplecanonicalcorrelations.Thej thelementofr isthecorrelationbetweenthejthcolumnsofU andV (seebelow). [ A , B , r , U , V ]=c a n o n c o r r ( X , Y ) alsoreturnsthecanonicalvariables,scores.U andV aren by d matricescomputedas U=( X r e p m a t ( m e a n ( X ) , N , 1 ) ) * A V=( Y r e p m a t ( m e a n ( Y ) , N , 1 ) ) * B [ A , B , r , U , V , s t a t s ]=c a n o n c o r r ( X , Y ) alsoreturnsastructures t a t s containinginformationrelatingtothesequenceofd
nullhypotheses
W i l k s d f 1
d f 2 F p F c h i s q p C h i s q
Examples
l o a dc a r b i g ; X=[ D i s p l a c e m e n tH o r s e p o w e rW e i g h tA c c e l e r a t i o nM P G ] ; n a n s=s u m ( i s n a n ( X ) , 2 )>0 ; [ ABrUV ]=c a n o n c o r r ( X ( ~ n a n s , 1 : 3 ) , X ( ~ n a n s , 4 : 5 ) ) ; p l o t ( U ( : , 1 ) , V ( : , 1 ) , ' . ' ) x l a b e l ( ' 0 . 0 0 2 5 * D i s p + 0 . 0 2 0 * H P 0 . 0 0 0 0 2 5 * W g t ' ) y l a b e l ( ' 0 . 1 7 * A c c e l 0 . 0 9 2 * M P G ' )
www.mathworks.in/help/stats/canoncorr.html?searchHighlight=canonical+correlation
1/2
12/19/13
References
[1]Krzanowski,W.J.PrinciplesofMultivariateAnalysis:AUser'sPerspective.NewYork:OxfordUniversityPress,1988. [2]Seber,G.A.F.MultivariateObservations .Hoboken,NJ:JohnWiley&Sons,Inc.,1984.
SeeAlso
m a n o v a 1 |p c a
www.mathworks.in/help/stats/canoncorr.html?searchHighlight=canonical+correlation
2/2