典型相关分析在STATA中的实现和案例

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

典型相关分析在STATA中的实现和案例
第14章典型相关分析
典型相关分析是一种研究两组变量之间相关关系的方法,不同于主成分分析和因子分析,它涉及两组变量的相关性。

为了代替两组变量之间的相互关系,典型相关分析采用类似于主成分分析的方法,将两组变量合成有代表性的综合指标,这些综合指标称为典型变量,典型变量之间的相关系数称为典型相关。

在实际问题中,许多问题涉及两组变量之间的相关关系,例如不同产品的价格和销量之间的相关系数,以及投资性变量和国民收入变量之间的相关关系等。

典型相关分析研究变量之间整体的线性关系,而不是分析每一组变量内部的各个变量。

它可以研究自变量和因变量之间的关系,也可以研究两组变量处于同等地位的情况。

但是,两组变量至少需要是间隔尺度的。

典型相关分析借助于主成分分析的思想,对每一组变量分别寻找线性组合,生成新的综合变量来代表原始变量的信息,同时与由另一组变量生成的新的综合变量的相关程度最大。

这样一组新的综合变量称为第一对典型相关变量,同样的方法可以找到第二对、第三对……使得各对典型相关变量互不相关。

典型相关变量之间的简单相关系数称为典型相关系数,用于衡量两组变量之间的相关性。

典型相关系数的平方可以通过对V=B'A⁻¹BC⁻¹或
W=BC⁻¹B'A⁻¹进行特征值分解来计算,对应的左侧向量即是
两组变量的典型变量的线性组合。

为了检验典型相关系数的显著性,Stata包括了四种统计量。

其中Wilks(1932)的统计量为Λ=∏(1-r²),Pallai(1955)的迹统计量为V=∑r²。

总之,典型相关分析是一种研究两组变量之间相关关系的方法,通过生成新的综合变量来代替原始变量,从而衡量两组变量之间的相关性。

Lawley-XXX(Lawley,1938;Hotelling,1951)迹统计量为:
U=\sum_{i=1}^{21-r} \frac{r_i^2}{m}$$
其中,$r_i$是样本典型相关系数的特征值,$m$是变量总数。

XXX最大特征根统计量为:$r_{max}^2$,其中
$r_{max}$是样本典型相关系数的最大特征值。

14.1 典型相关估计
使用命令“canon”。

sysuse auto,clear
canon (length weight headroom trunk) (displ mpg。

turn)
canon (length weight headroom trunk) (displ mpg。

turn),coefmatrix
coefmatrix输出原始系数矩阵,此为默认选项*/
canon(length weight headroom trunk)(displ mpg。

turn),stdcoef
stdcoef输出标准化系数矩阵,stdcoef与coefmatrix二者只能设一个*/
14.2 预测
使用命令“predict”。

sysuse auto,clear
canon (length weight headroom trunk) (displ mpg。

turn)
predict pu。

u
u计算varlist1的线性组合*/
predict pv,v
v计算varlist2的线性组合*/
predict pstdu。

stdu
stdu计算varlist1的线性组合的标准差*/
predict pstdv,stdv
stdv计算varlist2的线性组合的标准差*/
14.3 Estat
使用命令“estat”。

sysuse auto,clear
canon (length weight headroom trunk) (displ mpg。

turn)
XXX
varlist1和varlist2的相关系数矩阵*/
estat loadings
典型载荷,即各个变量与其对应的典型变量的相关系数*/
例如,对中国30个省市自治区农村居民收入和支出进行典型相关分析。

反映农村居民收入的变量为:$x_1$——农村居民家庭人均工资性收入;$x_2$——农村居民家庭人均家庭
经营收入;$x_3$——农村居民家庭人均财产性收入;$x_4$——农村居民家庭人均转移性收入。

农村居民生活费支出的变量分为x5到x12,分别代表农
村居民家庭人均食品支出、衣着支出、居住支出、家庭设备及服务支出、交通和通讯支出、文教、娱乐用品及服务支出、医疗保健支出以及其他商品及服务支出。

这些变量反映了农村居民的生活水平和消费结构。

下面是各省市的农村居民生活费支出情况。

北京市的x1
为6389.31,x2为2058.57,x3到x11为709.44,x12为
127.29.天津市的x1为4064.95,x2为1979.52,x3到x11为568.95,x12为142.81.河北省的x1为1713.55,x2为806.48,
x3到x11为2035.53,x12为77.81.山西省的x1为2035.53,
x2为810.17,x3到x11为916.76,x12为116.29.内蒙古的x1
为569.6,x2为601.71,x3到x11为530.69,x12为153.61.辽
宁省的x1为402.87,x2为324.47,x3到x11为151.94,x12
为346.73.吉林省的x1为292.52,x2为151.94,x3到x11为346.73,x12为250.07.黑龙江省的x1为699.21,x2为530.69,x3到x11为871.51,x12为292.52.
上海市的x1为867.98,x2为983.16,x3到x11为
1260.04,x12为422.82.江苏省的x1为3097.14,x2为2416.22,x3到x11为1986.38,x12为3218.01.浙江省的x1为2931.26,x2为3344.72,x3到x11为3163.7,x12为2931.26.安徽省的
x1为711.26,x2为2812,x3到x11为3762.93,x12为
2114.24.福建省的x1为3146.09,x2为2552.59,x3到x11为2962.96,x12为2699.3.江西省的x1为2690.83,x2为2196.61,x3到x11为2001.5,x12为2190.62.山东省的x1为3235.09,
x2为2016.64,x3到x11为2061.7,x12为1512.47.河南省的
x1为2156.8,x2为1845.04,x3到x11为1475.01,x12为1543.24.湖北省的x1为1602.74,x2为2032.01,x3到x11为2779.71,x12为1602.74.湖南省的x1为463.39,x2为285.31,x3到x11为568.95,x12为292.52.
广东省的x1为696.14,x2为486.75,x3到x11为569.6,x12为601.71.广西的x1为530.69,x2为871.51,x3到x11为153.61,x12为402.87.海南省的x1为151.94,x2为346.73,
x3到x11为250.07,x12为151.94.重庆市的x1为1283.39,
x2为808.63,x3到x11为1764.64,x12为1620.4.四川省的
x1为1002.68,x2为617.47,x3到x11为759.72,x12为
1243.57.贵州省的x1为867.98,x2为983.16,x3到x11为1260.04,x12为422.82.云南省的x1为2779.71,x2为463.39,x3到x11为285.31,x12为568.95.西藏的x1为696.14,x2为486.75,x3到x11为569.6,x12为601.71.陕西省的x1为
422.82,x2为3097.14,x3到x11为2416.22,x12为1986.38.
甘肃省的x1为3218.01,x2为2931.26,x3到x11为3344.72,x12为3163.7.青海省的x1为711.26,x2为2812,x3到x11
为3762.93,x12为2114.24.宁夏的x1为2196.61,x2为
2001.5,x3到x11为2190.62,x12为3235.09.新疆的x1为2016.64,x2为2061.7,x3到x11为1512.47,x12为2156.8.
Sorry。

but this text seems to be a random n of numbers and doesn't make any sense。

It's not possible to XXX the content as there is no clear topic or message.
以下是2009年中国各省份的农村居民家庭收入情况:
北京:数据缺失,无法统计。

天津:农村居民家庭人均收入为222.86元,其中工资性
收入为34.68元,家庭经营收入为390.15元,财产性收入为1553.01元,转移性收入为682.36元。

河北:农村居民家庭人均收入为163.93元,其中工资性收入为251.07元,家庭经营收入为1551.77元,财产性收入为250.29元,转移性收入为53元。

山西:农村居民家庭人均收入为40.82元,其中工资性收入为57.06元,家庭经营收入为202.02元,财产性收入为1165.81元,转移性收入为209.75元。

内蒙古:农村居民家庭人均收入为182.41元,其中工资性收入为71.13元,家庭经营收入为187.07元,财产性收入为240.91元,转移性收入为452.55元。

辽宁:农村居民家庭人均收入为169.61元,其中工资性收入为290.79元,家庭经营收入为214.38元,财产性收入为234.92元,转移性收入为290.44元。

吉林:农村居民家庭人均收入为171.11元,其中工资性收入为286.01元,家庭经营收入为278.67元,财产性收入为189.01元,转移性收入为483.66元。

黑龙江:农村居民家庭人均收入为124.01元,其中工资性收入为261.85元,家庭经营收入为172.73元,财产性收入为104.07元,转移性收入为261.57元。

上海:数据缺失,无法统计。

江苏:农村居民家庭人均收入为167.74元,其中工资性收入为238.43元,家庭经营收入为211.83元,财产性收入为163.99元,转移性收入为256.08元。

浙江:农村居民家庭人均收入为94.36元,其中工资性收入为159.61元,家庭经营收入为122.1元,财产性收入为268.26元,转移性收入为1947.52元。

安徽:农村居民家庭人均收入为339.47元,其中工资性收入为74.35元,家庭经营收入为2388.91元,财产性收入为177.67元,转移性收入为41.76元。

福建:农村居民家庭人均收入为53.58元,其中工资性收入为50.9元,家庭经营收入为71.37元,财产性收入为63.92元,转移性收入为109.83元。

江西:农村居民家庭人均收入为185.46元,其中工资性收入为86.01元,家庭经营收入为19.49元,财产性收入为148.55元,转移性收入为65.73元。

山东:农村居民家庭人均收入为174.58元,其中工资性收入为1594.67元,家庭经营收入为292.68元,财产性收入为91.19元,转移性收入为89.89元。

河南:农村居民家庭人均收入为294.03元,其中工资性收入为1537.59元,家庭经营收入为160.34元,财产性收入为367.74元,转移性收入为1627.58元。

湖北:农村居民家庭人均收入为217.86元,其中工资性收入为1119.64元,家庭经营收入为112.46元,财产性收入为218.5元,转移性收入为385.6元。

湖南:农村居民家庭人均收入为1483.16元,其中工资性收入为119.63元,家庭经营收入为1153.37元,财产性收入为175.5元,转移性收入为118.97元。

广东:农村居民家庭人均收入为140.06元,其中工资性收入为147.21元,家庭经营收入为62.26元,财产性收入为331.87元,转移性收入为1115.66元。

广西:农村居民家庭人均收入为95.58元,其中工资性收入为234.69元,家庭经营收入为219.91元,财产性收入为110.35元,转移性收入为316.75元。

海南:农村居民家庭人均收入为123.91元,其中工资性收入为299.29元,家庭经营收入为192.57元,财产性收入为97.58元,转移性收入为276.31元。

重庆:农村居民家庭人均收入为293.08元,其中工资性收入为1132.53元,家庭经营收入为134.66元,财产性收入为326.81元,转移性收入为220元。

四川:农村居民家庭人均收入为323.64元,其中工资性收入为1288.47元,家庭经营收入为217.17元,财产性收入为121.15元,转移性收入为792.23元。

贵州:农村居民家庭人均收入为1146.69元,其中工资性收入为218.61元,家庭经营收入为175.5元,财产性收入为118.97元,转移性收入为140.06元。

云南:农村居民家庭人均收入为331.87元,其中工资性收入为1115.66元,家庭经营收入为155.07元,财产性收入为270.63元,转移性收入为351.99元。

西藏:农村居民家庭人均收入为无数据。

陕西:农村居民家庭人均收入为97.58元,其中工资性收入为293.08元,家庭经营收入为168.99元,财产性收入为1132.53元,转移性收入为134.66元。

甘肃:农村居民家庭人均收入为326.81元,其中工资性
收入为220.02元,家庭经营收入为200.26元,财产性收入为323.64元,转移性收入为1288.47元。

青海:农村居民家庭人均收入为121.15元,其中工资性
收入为792.23元,家庭经营收入为219.91元,财产性收入为110.35元,转移性收入为316.75元。

宁夏:农村居民家庭人均收入为123.91元,其中工资性
收入为299.29元,家庭经营收入为192.57元,财产性收入为97.58元,转移性收入为276.31元。

新疆:农村居民家庭人均收入为293.08元,其中工资性
收入为1132.53元,家庭经营收入为134.66元,财产性收入为326.81元,转移性收入为220元。

以上数据来源于2009年《中国统计年鉴》。

经过典型相关估计,我们得到了31个样本的农村居民家
庭支出数据,并计算出了不同支出项目之间的相关系数。

其中,我们可以看到农村居民家庭人均食品支出、衣着支出、居住支
出、家庭设备及服务支出、交通和通讯支出、文教、娱乐用品及服务支出、医疗保健支出和其他商品及服务支出之间的相关系数。

为了更好地理解这些数据,我们可以进一步计算出线性组合和标准差。

通过运行命令predict pu。

u和predict pv。

v,我们可以计算出不同支出项目的线性组合。

同时,我们还可以通过predict pstdu。

stdu和predict pstdv。

stdv计算出这些线性组合的标准差。

通过对这些数据的分析,我们可以更好地理解农村居民家庭的支出情况,并为相关政策的制定提供参考。

The given text appears to be a table of coefficients and statistical tests。

but it is not properly formatted and some of the values are missing。

Therefore。

it is difficult to make any sense of the n presented。

XXX of the table。

we could reformat it as follows:
Variable Set 1:
1.2.3.4
x1 |。

0.0004.-0.0004.0.0008.-0.0012
x2 |。

0.0002.-0.0083.-0.0010.0.0047
x3 |。

0.0013.0.0011.-0.0034.-0.0045
Variable Set 2:
1.2.3.4
x5 |。

0.0008.0.0009.-0.0017.-0.0003
x6 |。

0.0026.-0.0090.-0.0054.0.0021
x7 |。

-0.0004.0.0014.0.0014.-0.0010
x8 |。

0.0007.0.0107.-0.0022.0.0173
x9 |。

-0.0001.-0.0070.0.0146.0.0112
x10 |。

0.0005.0.0027.-0.0008.-0.0082
x11 |。

0.0015.-0.0012.-0.0129.-0.0043
x12 |。

0.0033.0.0005.0.0084.-0.0400
We could also provide XXX of the table。

such as the purpose of the analysis or the meaning of the coefficients and tests.
在该运行结果中,我们可以看到标准化系数,它们表示在典型变量中每个观察变量的影响大小。

从结果中可以看出,第一个典型变量主要由第一个和第二个观察变量组成,而第二个典型变量则主要由第三个和第四个观察变量组成。

此外,根据Wilks' lambda、Pillai's trace、Lawley-Hotelling trace和Roy's largest root的显著性检验,我们可以得出结论,这些典型变量在总体上是显著的。

为了更好地理解这些结果,我们可以将数据进行标准化处理。

重新运行典型相关分析,并加入选项stdcoef,得到标准化后的系数。

从结果中可以看出,第一个典型变量主要受第一个和第二个观察变量的影响,而第二个典型变量主要受第三个和第四个观察变量的影响。

根据Wilks' lambda、Pillai's trace、Lawley-Hotelling trace和Roy's largest root的显著性检验,我们可以得出结论,这些典型变量在总体上是显著的。

The standardized coefficients for the second set of variables are presented in the table below。

Each row represents a different variable。

and each column XXX a particular variable in the first set.
1.2.3.4
x5 |0..5054-0.9698-0.1982
x6 |0.2856-0.9707-0.5840.0.2249
x7 |。

-0.1190.0.4806.0.4722.-0.3243
x8 |。

0..9983-0.2082.1.6067
x9 |。

-0.0213-1 (2177)
x10 |。

0.1118.0.5533.-0.1706.-1.6961
x11 |。

0.2202.-0.1724-1.8828-0.6265
x12 |。

0.1149.0.0164.0.2906.-1.3862
XXX een the variables in the second set and the variables in the first set。

The coefficients XXX。

a coefficient of 0.4477 for x5 and the first variable in the first set means that there is a positive nship een x5 and the first variable.
XXX in the table below。

There are four ns。

each XXX.
Canonical ns:
0.9728.0.8003.0.6015.0.4944
XXX.
Finally。

XXX.
Statistic。

df1.df2.F。

Prob>F
Wilks' lambda。

xxxxxxxx。

32.71.6637.5.7184.0.0000 a
The Wilks' lambda XXX is very low (p<0.0001)。

indicating that the XXX.
The results of Pillai's trace。

Lawley-Hotelling trace。

and Roy's largest root are presented in the table above。

These results were obtained from standardized data。

allowing us to observe the impact of each variable on the XXX the two sets of results。

we see that aside from changes in the sizes of the variables in the canonical ns。

all other results remain the same。

Therefore。

in practice。

when XXX sizes。

XXX.
XXX for the analysis。

The canonical variables are represented by U and V。

with three pairs of XXX 0.9728.with U1 being a linear n of X1.X2.X3.and X4.and V1 being a linear n of
X5 to X12.The second pair has a canonical n of 0.8003.with U2 being a linear n of X1 to X4.and V2 being a linear n of X5 to
X12.The third pair has a canonical n of 0.3573.with U3 being a linear n of X1 to X4.and V3 being a linear n of X5 to X12.
结果分析:通过因子分析我们得到了三对典型变量,每对典型变量都有两个因子(U和V)来解释观察变量之间的关系。

在第一对典型变量中,U1主要受工资性收入和转移性收入的
影响,而V1则主要受食品支出和衣着支出的影响。

在第二对
典型变量中,U2主要受工资性收入和财产性收入的影响,而
V2则主要受衣着支出、家庭设备及服务支出和交通和通讯支
出的影响。

在第三对典型变量中,U3主要受工资性收入和转
移性收入的影响,而V3则主要受食品支出、交通和通讯支出
和医疗保健支出的影响。

在检验过程中,我们可以检验各个观察变量之间的相关系数以及与其对应的典型变量的相关系数。

通过.estat ns命令,
我们可以得到各个变量之间的相关系数,其中变量x1到x4属于变量列表1,变量x5到x12属于变量列表2.
The given data shows the ns een two variable lists。

1 and 2.Each row represents a variable from list 1.and each column represents a variable from list 2.The numbers in the cells XXX.
The first row shows that variable x5 from list 1 has high positive ns with variables x1.x3.and x4 from list 2.but a low negative n with x2.This suggests that x5 is strongly related to
x1.x3.and x4.but not to x2.
The second row shows that variable x6 from list 1 has moderate positive ns with x1.x3.and x4 from list 2.This suggests that x6 is somewhat related to x1.x3.and x4.
The third row shows that variable x7 from list 1 has moderate positive ns with x1 and x3 from list 2.but a lower n with x2 and
x4.This suggests that x7 is somewhat related to x1 and x3.but not as much to x2 and x4.
XXX that variable x8 from list 1 has high positive ns with
x1.x3.and x4 from list 2.but a low negative n with x2.This suggests that x8 is strongly related to x1.x3.and x4.but not to x2.
XXX that variable x9 from list 1 has high positive ns with
x1.x3.and x4 from list 2.and a moderate positive n with x2.This suggests that x9 is strongly related to x1.x3.and x4.and somewhat related to x2.
XXX that variable x10 from list 1 has moderate positive ns with x1.x3.and x4 from list 2.and a moderate positive n with
x2.This suggests that x10 is somewhat related to all four variables.
XXX that variable x11 from list 1 has moderate positive ns with x1.x3.and x4 from list 2.but a lower n with x2.This suggests that x11 is somewhat related to x1.x3.and x4.but not as much to x2.
XXX and final row shows that variable x12 from list 1 has moderate positive ns with x1 and x3 from list 2.but lower ns with
x2 and x4.This suggests that x12 is somewhat related to x1 and
x3.but not as much to x2 and x4.
XXX。

For variable list 1.x1 has the highest loading of
0.9475.followed by x3 with a loading of 0.9019.x4 with a loading of 0.8625.and x2 with the lowest loading of -0.4199.
For variable list 2.x9 has the highest loading of
0.9622.followed by x8 with a loading of 0.9393.x5 with a loading of 0.9084.and x6 with the lowest loading of -0.3911.
It is important to note that the XXX loadings should be done in the context of the specific analysis being XXX variables and can be used to XXX related to each other。

Overall。

XXX。

XXX.
XXX een variable list 1 and canonical variates from list 2.as well as the n een variable list 2 and canonical variates from list 1.
For variable list 1.the highest n is with x1 at 0.9216.followed by x3 at 0.8773 and x4 at 0.8390.XXX is with x2 at 0.0239.
For variable list 2.the XXX is with x9 at 0.9360.followed by
x8 at 0.9137 and x5 at 0.8836.XXX is with x11 at 0.8838.
Overall。

XXX。

it is important to note that XXX variables.
在运行过程中,我们可以使用predict命令来生成预测变量。

在这个例子中,我们可以得出varlist1和varlist2的线性值,以及varlist1和varlist2的线性组合的标准差。

在进行运算时,我们可以使用predict预测命令来生成预
测变量。

在本例中,我们可以得出varlist1和varlist2的线性值,以及varlist1和varlist2的线性组合的标准差。

相关文档
最新文档