Main Content

佳能

规范相关性

描述

[[一种,,,,b] = canoncorr(X,,,,ycomputes the sample canonical coefficients for the data matricesX一种ndy

[[一种,,,,b,,,,r] = canoncorr(X,,,,y也返回r,样品规范相关的矢量。

例子

[[一种,,,,b,,,,r,,,,,,,,v] = canoncorr(X,,,,y也返回一种ndv,规范分数的矩阵X一种ndy, 分别。

[[一种,,,,b,,,,r,,,,,,,,v,,,,统计] = canoncorr(X,,,,y也返回统计,包含与测试剩余相关性均为零的假设序列有关的信息的结构。

例子

全部收缩

对样本数据集执行规范相关分析。

数据集卡比格包含1970年至1982年的406辆汽车的测量。

Load the sample data.

加载卡比格;d一种ta = [Displacement Horsepower Weight Acceleration MPG];

Define X as the matrix of displacement, horsepower, and weight observations, andy作为the matrix of acceleration and MPG observations. Omit rows with insufficient data.

nans = sum(isnan(data),2)> 0;x = data(〜nans,1:3);y =数据(〜nans,4:5);

计算样品规范相关性。

[a,b,r,u,v] = canoncorr(x,y);

查看输出一种确定构成规范变量的位移,马力和重量的线性组合X

一种
a =3×20.0025 0.0048 0.0202 0.0409 -0.0000 -0.0027

一种((3,1)是d一世splayed as–0.000because it is very small. Display一种((3,1)分别地。

一种((3,1)
ANS = -2.4737E -05

第一个规范变量XU1=0。0025*Disp + 0.0202*HP — 0.000025*Wgt

第二个规范变量XU2 = 0.0048*DISP + 0.0409*HP - 0.0027*WGT

查看B的输出以确定构成规范变量的加速度和MPG的线性组合y

b
b=2×2-0.1666 -0.3637 -0.0916 0.1078

第一个规范变量yv1=-0。1666*Accel — 0.0916*MPG

第二个规范变量yV2 = —0.3637*ACCEL + 0.1078*MPG

Plot the scores of the canonical variables ofX一种ndy彼此对抗。

T = TileDlayout(2,2);标题(t,'X VS Y的规范分数Y')xlabel(t,“ x的规范变量”)ylabel(t,'y的规范变量')t.TileSpacing ='袖珍的';nexttile绘图(u(::,1),v(:,1),,'。')xlabel('u1')ylabel('v1')nexttile plot(U(:,2),V(:,1),'。')xlabel('u2')ylabel('v1')nexttile绘图(u(::,1),v(:,2),,'。')xlabel('u1')ylabel('v2')nexttile plot(U(:,2),V(:,2),'。')xlabel('u2')ylabel('v2'

图包含4个轴对象。轴对象1包含类型行的对象。轴对象2包含类型行的对象。轴对象3包含类型行的对象。轴对象4包含类型行的对象。

成对的规范变量 { 一世 ,,,, v 一世 } 从最强到最弱的相关性订购,所有其他对独立。

返回变量的相关系数U1一种ndv1

R(1)
一种ns = 0.8782

输入参数

全部收缩

输入矩阵,指定为n-by-d1矩阵。这rows ofXcorrespond to observations, and the columns correspond to variables.

数据类型:单身的|双倍的

输入矩阵,指定为n-by-d2矩阵在哪里X是一个n-by-d1矩阵。这rows ofycorrespond to observations, and the columns correspond to variables.

数据类型:单身的|双倍的

输出参数

全部收缩

样品规范系数的变量X,返回d1-by-d矩阵,,,,在哪里d= min(等级(X),秩(y))

jTH列一种包含组成的变量的线性组合jth canonical variable forX

如果X不到全部等级佳能发出警告并返回零行一种对应于相关列的X

样品规范系数的变量y,返回d2-by-d矩阵,,,,在哪里d= min(等级(X),秩(y))

jTH列b包含组成的变量的线性组合jth canonical variable fory

如果y不到全部等级佳能发出警告并返回零行b对应于相关列的y

样本规范相关性,以1乘返回d向量,哪里d= min(等级(X),秩(y))

jTH的元素rjTh一种ndv

Canonical scores for the variables inX,返回nn-by-d矩阵,,,,在哪里X是一个n-by-d1矩阵一种ndd= min(等级(X),秩(y))

Canonical scores for the variables iny,返回nn-by-d矩阵,,,,在哪里y是一个n-by-d2矩阵一种ndd= min(等级(X),秩(y))

假设测试信息,作为结构返回。此信息与d零假设 H 0 (( k 那是(K+1)st throughdth correlations are all zero fork= 1,…,,d-1,,,,一种ndd= min(等级(X),秩(y))

这fields of统计1-by-d元素的向量对应于k

场地 描述
威尔克斯

威尔克斯的lambda(似然比)统计

df1

Degrees of freedom for the chi-squared statistic, and the numerator degrees of freedom for theF统计

df2

分母的自由度F统计

F

Rao的大概F统计for H 0 (( k

pF

右尾显着性水平F

chisq

Bartlett的近似卡方统计数据 H 0 (( k with Lawley's modification

pChisq

右尾显着性水平chisq

统计has two other fields (DFE一种ndp),,,,which are equal todf1一种ndpChisq,,,,respectively, and exist for historical reasons.

数据类型:结构

更多关于

全部收缩

规范相关分析

这canonical scores of the data matricesX一种ndy定义为

一世 = X 一种 一世 v 一世 = y b 一世

在哪里一种一世一种ndb一世最大化皮尔逊相关系数ρ(一世,,,,v一世subject to being uncorrelated to all previous canonical scores and scaled so that一世一种ndv一世have zero mean and unit variance.

这canonical coefficients ofX一种ndy是矩阵一种一种ndbwith columns一种一世一种ndb一世, 分别。

规范变量X一种ndy是列的线性组合X一种ndy由规范系数给出一种一种ndb分别。

这canonical correlations are the valuesρ(一世,,,,v一世测量每对规范变量的相关性X一种ndy

一种lgorithms

佳能computes一种,,,,b,,,,一种ndr使用QR一种ndSVD佳能computes一种ndv作为u =(x- emean(x))*a一种ndv =(y - 均值(y))*b

References

[1] Krzanowski w·J。多元分析的原则:用户的观点。纽约:牛津大学出版社,1988年。

[2] Seber,G。A. F.Multivariate Observations。新泽西州霍博肯:John Wiley&Sons,Inc.,1984年。

版本历史记录

Introduced before R2006a

也可以看看

|