【数学建模】day11-典型相关分析

0. 基本思想

1. 典型相关分析

2 直观描述

3 数学描述

4. 典型相关模型的分析

Def：

1）这个解释能力是指，原始变量—>典型变量后，某个典型变量 ui 对原始变量<x1,x2,…xp>的解释能力。因为如果采用比较少的典型变量，就会有更多的信息损失，这与PCA分析中主成分贡献率类似。

2) 计算方法是：某个典型变量ui与所有xk(k=1 to p)的相关系数的平方和，再除以变量个数。这是方差比例。

1）整体检验

2）部分总体典型相关系数为零的检验

5 Summary：典型相关分析步骤

step1：计算原始变量X、Y增广阵的相关系数矩阵R，并且剖分为：，其中，R11是X的协方差矩阵，R12是X与Y的协方差矩阵。

step2：求典型相关系数以及典型变量。

step3：进行典型相关系数λi的显著性检验。有整体检验与部分检验，详情见上。

step4：典型结构与典型冗余分析。

6. MATLAB实现。

MATLAB进行典型相关分析命令：

canoncorr Canonical correlation analysis.
[A,B] = canoncorr(X,Y) computes the sample canonical coefficients for
the N-by-P1 and N-by-P2 data matrices X and Y.  X and Y must have the
same number of observations (rows) but can have different numbers of
variables (cols).  A and B are P1-by-D and P2-by-D matrices, where D =
min(rank(X),rank(Y)).  The jth columns of A and B contain the canonical
coefficients, i.e. the linear combination of variables making up the
jth canonical variable for X and Y, respectively.  Columns of A and B
are scaled to make COV(U) and COV(V) (see below) the identity matrix.
If X or Y are less than full rank, canoncorr gives a warning and
returns zeros in the rows of A or B corresponding to dependent columns
of X or Y.

[A,B,R] = canoncorr(X,Y) returns the 1-by-D vector R containing the
sample canonical correlations.  The jth element of R is the correlation
between the jth columns of U and V (see below).

[A,B,R,U,V] = canoncorr(X,Y) returns the canonical variables, also
known as scores, in the N-by-D matrices U and V.  U and V are computed
as

U = (X - repmat(mean(X),N,1))*A and
V = (Y - repmat(mean(Y),N,1))*B.

[A,B,R,U,V,STATS] = canoncorr(X,Y) returns a structure containing
information relating to the sequence of D null hypotheses H0_K, that
the (K+1)st through Dth correlations are all zero, for K = 0:(D-1).
STATS contains seven fields, each a 1-by-D vector with elements
corresponding to values of K:

Wilks:    Wilks' lambda (likelihood ratio) statistic
chisq:    Bartlett's approximate chi-squared statistic for H0_K,
with Lawley's modification
pChisq:   the right-tail significance level for CHISQ
F:        Rao's approximate F statistic for H0_K
pF:       the right-tail significance level for F
df1:      the degrees of freedom for the chi-squared statistic,
also the numerator degrees of freedom for the F statistic
df2:      the denominator degrees of freedom for the F statistic

Example:

X = [Displacement Horsepower Weight Acceleration MPG];
nans = sum(isnan(X),2) > 0;
[A B r U V] = canoncorr(X(~nans,1:3), X(~nans,4:5));

plot(U(:,1),V(:,1),'.');
xlabel('0.0025*Disp + 0.020*HP - 0.000025*Wgt');
ylabel('-0.17*Accel + -0.092*MPG')

See also pca, manova1.

 典型相关分析函数：[a,b,r,u,v,stats] = cononcorr(x,y): param: 　　x：原始变量x矩阵，每列一个自变量指标，第i列是 xi 的样本值 　　y：原始变量y矩阵，每列一个因变量指标，第j列是 yj 的样本值 return: 　　a：自变量x的典型相关变量系数矩阵，每列是一组系数。       　　列数为典型相关变量数 　　b：因变量y的典型相关变量系数矩阵，每列是一个系数 　　r： 典型相关系数。即第一对之间的相关系数、第二对之间的相关系数… 　　u：对于X的典型相关变量的值 　　v：对于Y的典型相关变量的值 　　stats：假设检验的值<详细用一下就知道了>

posted @ 2018-07-29 11:46  pigcv  阅读(12961)  评论(1编辑  收藏  举报