Principal Component Analysis Homework
Principal Component Analysis Homework
Homework3
Weedy
2026-01-10
Chapter 8
8.6
8.10
(a) Construct the sample covariance matrix S, and find the sample principal components in
(8-20). (Note that the sample mean vector is displayed in Example 8.5.)
(b) Determine the proportion of the total sample variance explained by the first three
principal components. Interpret these components.
(c) Construct Bonferroni simultaneous 90% confidence intervals for the variances λ1 , λ2
and λ3 of the first three population components Y1 , Y2 and Y3 .
8.16 Fish caught by the same fisherman live alongside of each other, so the data should provide
some evidence on how the fish group. The first four fish belong to the centrarchids, the most
plentiful family. The walleye is the most popular fish to eat.
(a) Comment on the pattern of correlation within the centrarchid family x 1 through x 4 . Does
the walleye appear to group with the other fish?
(b) Perform a principal component analysis using only x 1 through x 4 . Interpret your results.
(c) Perform a principal component analysis using all six variables. Interpret your results.
8.26
(a) Determine the appropriate number of components to effectively summarize the
variability. Construct a scree plot to aid in your determination.
(b) Interpret the sample principal components.
(c) Using the values for the first two principal components, plot the data in a twodimensional
space with along the vertical axis and along the horizontal axis. Can you distinguish groups
representing the two socioeconomic levels and/or the two genders? Are there any outliers?
(d) Construct a 95% confidence interval for λ1 , the variance of the first population principal
component from the covariance matrix.
Chapter 9
9.12
9.19
9.20
Chapter 10
10.18
Chapter 8
8.6
To obtain the eigenvalues of ρ, consider the equation:
2
|ρ − λI | = (1 + 2ρ − λ)(1 − ρ − λ) = 0
⇒ λ1 = 1 + 2ρ, λ2 = λ3 = 1 − ρ.
The results are consistent with (8-16) when p=3. ρei = λi ei , i = 1, . . . , p , which Verifies the eigenvalue–
eigenvector pairs for ρ given in (8-15)
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 1/37
2026/1/10 20:55 Homework3
8.10
data8.10 <- [Link]("[Link]")
data8.10
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 2/37
2026/1/10 20:55 Homework3
## V1 V2 V3 V4 V5
## 1 0.0130338 -0.0078431 -0.0031889 -0.0447693 0.0052151
## 2 0.0084862 0.0166886 -0.0062100 0.0119560 0.0134890
## 3 -0.0179153 -0.0086393 0.0100360 0.0000000 -0.0061428
## 4 0.0215589 -0.0034858 0.0174353 -0.0285917 -0.0069534
## 5 0.0108225 0.0037167 -0.0101345 0.0291900 0.0409751
## 6 0.0101713 -0.0121978 -0.0083768 0.0137083 0.0029895
## 7 0.0111288 0.0280044 0.0080721 0.0305433 0.0032290
## 8 0.0484801 -0.0051480 0.0182495 0.0063348 0.0076752
## 9 -0.0344914 -0.0137991 -0.0080468 -0.0299011 -0.0108108
## 10 -0.0046596 0.0209882 -0.0060841 -0.0203940 -0.0126677
## 11 -0.0018205 -0.0055675 -0.0107587 -0.0089898 -0.0183648
## 12 0.0148515 0.0346684 -0.0060004 0.0362855 0.0287032
## 13 -0.0092426 -0.0052029 0.0047161 0.0264916 0.0129547
## 14 -0.0458668 -0.0278243 -0.0142696 0.0374776 0.0332022
## 15 -0.0244432 -0.0182914 0.0059048 -0.0259572 -0.0202333
## 16 -0.0183742 -0.0140289 0.0011361 0.0073284 -0.0097182
## 17 -0.0297788 -0.0284571 -0.0164555 0.0310847 0.0164377
## 18 -0.0225080 -0.0228833 0.0344231 -0.0062006 0.0067584
## 19 0.0119617 -0.0067916 0.0185908 -0.0193632 -0.0153440
## 20 0.0209811 0.0240509 0.0129586 0.0355419 0.0150962
## 21 0.0118669 0.0025328 -0.0036036 0.0021186 0.0028784
## 22 0.0140160 0.0172255 0.0003617 0.0150106 0.0141115
## 23 -0.0149506 0.0031610 -0.0001808 0.0310352 0.0226415
## 24 0.0203322 -0.0148548 -0.0182607 -0.0028283 -0.0161439
## 25 0.0112265 -0.0221613 -0.0051565 -0.0247164 0.0105485
## 26 -0.0327505 -0.0158879 -0.0037023 0.0143332 0.0164695
## 27 -0.0261119 -0.0313390 0.0156076 0.0024575 0.0082154
## 28 0.0182675 0.0156863 -0.0219539 -0.0498468 -0.0110910
## 29 0.0219907 0.0043436 0.0136551 0.0152655 0.0217441
## 30 -0.0331257 -0.0204229 -0.0101495 -0.0186362 -0.0255376
## 31 0.0213763 0.0188864 0.0210664 0.0228744 0.0013793
## 32 0.0484518 0.0440539 0.0087639 0.0160338 0.0073462
## 33 0.0276183 0.0168319 0.0104977 0.0004153 0.0043300
## 34 0.0031932 0.0024943 0.0103887 0.0228311 0.0356251
## 35 -0.0010610 0.0085953 -0.0023046 -0.0040584 0.0065732
## 36 -0.0037175 -0.0060552 0.0035537 0.0114099 0.0211145
## 37 0.0023987 -0.0597924 -0.0118626 -0.0251813 -0.0110851
## 38 0.0148897 0.0163187 0.0265185 0.0200455 0.0219875
## 39 -0.0089075 -0.0068477 0.0047129 0.0129660 0.0196161
## 40 -0.0227333 -0.0140276 -0.0069493 0.0024000 -0.0165494
## 41 -0.0329997 -0.0313480 -0.0362141 0.0055866 -0.0065208
## 42 0.0302098 0.0522778 0.0317662 0.0267857 0.0105865
## 43 0.0195493 0.0395079 0.0381773 0.0216425 0.0238843
## 44 -0.0045273 0.0204825 0.0174547 0.0253452 0.0059341
## 45 -0.0446763 -0.0408118 -0.0163225 -0.0035049 -0.0008137
## 46 0.0070008 0.0060451 0.0154081 0.0320252 0.0252443
## 47 0.0100111 0.0048532 -0.0016675 -0.0050224 -0.0266084
## 48 -0.0112885 0.0057498 0.0100217 -0.0173067 -0.0024480
## 49 0.0236703 0.0155500 -0.0162064 0.0001835 -0.0069530
## 50 0.0165941 0.0457104 0.0065557 0.0284299 0.0434514
## 51 -0.0040139 -0.0118432 -0.0041750 0.0039237 -0.0136175
## 52 -0.0069855 0.0098061 0.0003354 -0.0261148 -0.0286114
## 53 -0.0154221 -0.0233060 -0.0238055 0.0113097 0.0257467
## 54 -0.0252817 0.0088378 -0.0094453 0.0075758 -0.0124498
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 5/37
2026/1/10 20:55 Homework3
## V1 V2 V3 V4 V5
## 1 0.596690 -0.427155 -0.33862637 -1.843306277 0.04296027
## 2 0.369310 0.799430 -0.55225040 0.300708535 0.33548681
## 3 -0.950765 -0.466965 0.59651528 -0.151185789 -0.35860213
## 4 1.022945 -0.209290 1.11972480 -1.231850471 -0.38726117
## 5 0.486125 0.150835 -0.82975445 0.952092508 1.30726720
## 6 0.453565 -0.644890 -0.70546629 0.366939249 -0.03572657
## 7 0.501440 1.365220 0.45764658 1.003242440 -0.02725897
## 8 2.369005 -0.292400 1.17729744 0.088247145 0.12993794
## 9 -1.779570 -0.724955 -0.68213177 -1.281341140 -0.52364086
## 10 -0.287980 1.014410 -0.54334792 -0.922006535 -0.58929218
## 11 -0.146025 -0.313375 -0.87389206 -0.490968291 -0.79071509
## 12 0.687575 1.698420 -0.53742944 1.220277199 0.87339001
## 13 -0.517130 -0.295145 0.22034154 0.850102574 0.31659645
## 14 -2.348340 -1.426215 -1.12215018 1.265334344 1.03245368
## 15 -1.277160 -0.949570 0.30439533 -1.132275731 -0.85677654
## 16 -0.973710 -0.736445 -0.03280268 0.125801695 -0.48501161
## 17 -1.543940 -1.457855 -1.27671665 1.023705436 0.43973910
## 18 -1.180400 -1.179165 2.32094366 -0.385546440 0.09752417
## 19 0.543085 -0.374580 1.20143099 -0.883045958 -0.68391368
## 20 0.994055 1.167545 0.80317431 1.192171761 0.39230991
## 21 0.538345 0.091640 -0.36795008 -0.071110236 -0.03965455
## 22 0.645800 0.826275 -0.08756103 0.416161563 0.35749551
## 23 -0.802530 0.123050 -0.12592158 1.021834512 0.65907655
## 24 0.961610 -0.777740 -1.40436356 -0.258085481 -0.71219441
## 25 0.506325 -1.143065 -0.47775670 -1.085377899 0.23152444
## 26 -1.692525 -0.829395 -0.37492923 0.390558249 0.44086340
## 27 -1.360595 -1.601950 0.99048689 -0.058301020 0.14903690
## 28 0.858375 0.749315 -1.66551224 -2.035217739 -0.53354742
## 29 1.044535 0.182180 0.85242430 0.425795877 0.62734867
## 30 -1.711285 -1.056145 -0.83081511 -0.855567940 -1.04431186
## 31 1.013815 0.909320 1.37648234 0.713385265 -0.09265574
## 32 2.367590 2.167695 0.50656423 0.454834888 0.11830604
## 33 1.325915 0.806595 0.62916240 -0.135488925 0.01166726
## 34 0.104660 0.089715 0.62145494 0.711748679 1.11811613
## 35 -0.108050 0.394765 -0.27609691 -0.304578891 0.09097636
## 36 -0.240875 -0.337760 0.13814745 0.280067895 0.60508895
## 37 0.064935 -3.024620 -0.95194958 -1.102949468 -0.53333883
## 38 0.689485 0.780935 1.76200403 0.606462895 0.63595416
## 39 -0.500375 -0.377385 0.22011527 0.338882947 0.55211251
## 40 -1.191665 -0.736380 -0.60452680 -0.060474316 -0.72653100
## 41 -1.704985 -1.602400 -2.67386065 0.059967843 -0.37196645
## 42 1.455490 2.578890 2.13307246 0.861218509 0.23286794
## 43 0.922465 1.940395 2.58640569 0.666823822 0.70301617
## 44 -0.281365 0.989125 1.12109659 0.806772727 0.06838076
## 45 -2.288815 -2.075590 -1.26731213 -0.283658557 -0.17019000
## 46 0.295040 0.267255 0.97638011 1.059252995 0.75109943
## 47 0.445555 0.207660 -0.23104714 -0.341014666 -1.08217036
## 48 -0.619425 0.252490 0.59550412 -0.805317564 -0.22797123
## 49 1.128515 0.742500 -1.25910262 -0.144250141 -0.38724703
## 50 0.774705 2.250520 0.35042091 0.923363428 1.39481762
## 51 -0.255695 -0.627160 -0.40835417 -0.002883869 -0.62287269
## 52 -0.404275 0.455305 -0.08942072 -1.138232451 -1.15298710
## 53 -0.826105 -1.200300 -1.79644013 0.276280691 0.76886195
## 54 -1.319085 0.406890 -0.78102065 0.135152536 -0.58158826
# Scree Plot
plot(lambda*1000, type = "o", pch = 19, xlab = "i",
ylab = expression(hat(lambda)[i]%*%10^(3)),
xaxt = "n",
main = "A Scree Plot for Stock Data")
axis(1, at = c(1:5))
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 9/37
2026/1/10 20:55 Homework3
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 10/37
2026/1/10 20:55 Homework3
## eigen() decomposition
## $values
## [1] 2.1539189 0.7875498 0.6156590 0.4428723
##
## $vectors
## [,1] [,2] [,3] [,4]
## [1,] -0.5265384 -0.4571582 0.2491110 -0.6719808
## [2,] -0.5033080 -0.4119833 -0.6142538 0.4467865
## [3,] -0.4427711 0.7584337 -0.3680028 -0.3056057
## [4,] -0.5228691 0.2146031 0.6520812 0.5053996
round(cumsum(eigen(R_14)$values)/sum(eigen(R_14)$values)*100, 1)
## eigen() decomposition
## $values
## [1] 2.3549250 1.0718567 0.9842486 0.6643858 0.5003897 0.4241942
##
## $vectors
## [,1] [,2] [,3] [,4] [,5] [,6]
## [1,] -0.4753543 0.02188910 0.47987482 0.04564932 0.3578888 -0.6425051
## [2,] -0.4719328 -0.01924243 0.20906455 0.70296351 -0.1771358 0.4556533
## [3,] -0.3931540 -0.56061775 -0.26440849 -0.17551515 -0.5973982 -0.2713733
## [4,] -0.4963538 -0.07723024 0.03226116 -0.60426514 0.3238962 0.5260914
## [5,] 0.2563177 -0.80502150 0.01294351 0.21817123 0.4823355 0.0768220
## [6,] -0.2910014 0.17559671 -0.80925398 0.24539324 0.3822272 -0.1524794
round(cumsum(eigen(R)$values)/sum(eigen(R)$values)*100, 1)
8.26
(a) Determine the appropriate number of components to
effectively summarize the variability. Construct a scree plot to aid
in your determination.
data8.26 <- [Link]("[Link]")
data8.26
## V1 V2 V3 V4 V5 V6 V7
## 1 27 13 14 20 11 2 1
## 2 12 13 24 25 6 2 1
## 3 14 20 15 16 7 2 1
## 4 18 20 17 12 6 2 1
## 5 9 22 22 21 6 2 1
## 6 18 15 17 25 9 2 1
## 7 12 18 29 18 4 2 1
## 8 10 19 21 10 16 2 1
## 9 8 23 23 19 9 2 1
## 10 21 11 17 9 16 2 1
## 11 15 16 16 12 19 2 1
## 12 9 20 29 14 7 2 1
## 13 16 22 24 17 4 2 1
## 14 14 19 17 18 15 2 1
## 15 13 26 23 17 5 2 1
## 16 13 20 22 18 5 2 1
## 17 18 17 11 23 14 2 1
## 18 15 24 15 8 15 2 1
## 19 18 22 24 11 6 2 1
## 20 18 18 17 24 7 2 1
## 21 9 16 27 18 9 2 1
## 22 25 17 15 14 14 2 1
## 23 9 21 21 18 4 2 1
## 24 28 17 19 12 7 2 1
## 25 18 18 26 14 6 2 1
## 26 25 13 11 20 6 2 1
## 27 6 16 22 23 15 2 1
## 28 25 13 18 9 15 2 1
## 29 4 23 27 16 8 2 1
## 30 17 7 19 22 12 2 1
## 31 13 14 16 20 16 2 1
## 32 14 16 21 19 10 2 1
## 33 17 12 22 19 12 2 1
## 34 14 16 19 18 13 2 1
## 35 10 19 23 23 3 2 1
## 36 8 21 16 20 10 1 1
## 37 15 12 15 23 11 1 1
## 38 8 22 18 15 9 1 1
## 39 9 17 29 20 10 1 1
## 40 9 14 23 21 12 1 1
## 41 21 16 22 11 11 1 1
## 42 12 18 19 18 8 1 1
## 43 18 20 13 13 17 1 1
## 44 10 14 28 20 10 1 1
## 45 15 11 22 25 9 1 1
## 46 20 14 14 9 17 1 1
## 47 7 14 23 17 23 1 1
## 48 22 17 11 15 11 1 1
## 49 18 21 15 8 15 1 1
## 50 7 14 24 24 14 1 1
## 51 13 17 19 24 8 1 1
## 52 15 20 17 19 10 1 1
## 53 15 19 29 17 2 1 1
## 54 7 21 21 25 8 1 1
## V1 V2 V3 V4 V5
## 1 29.83450 -21.35775 -23.9445 -69.670429 1.518875
## 2 18.46550 39.97150 -39.0500 11.365714 11.861250
## 3 -47.53825 -23.34825 42.1800 -5.714286 -12.678500
## 4 51.14725 -10.46450 79.1765 -46.559571 -13.691750
## 5 24.30625 7.54175 -58.6725 35.985714 46.218875
## 6 22.67825 -32.24450 -49.8840 13.869000 -1.263125
## 7 25.07200 68.26100 32.3605 37.919000 -0.963750
## 8 118.45025 -14.62000 83.2475 3.335429 4.594000
## 9 -88.97850 -36.24775 -48.2340 -48.430143 -18.513500
## 10 -14.39900 50.72050 -38.4205 -34.848571 -20.834625
## 11 -7.30125 -15.66875 -61.7935 -18.556857 -27.956000
## 12 34.37875 84.92100 -38.0020 46.122143 30.879000
## 13 -25.85650 -14.75725 15.5805 32.130857 11.193375
## 14 -117.41700 -71.31075 -79.3480 47.825143 36.502750
## 15 -63.85800 -47.47850 21.5240 -42.796000 -30.291625
## 16 -48.68550 -36.82225 -2.3195 4.754857 -17.147750
## 17 -77.19700 -72.89275 -90.2775 38.692429 15.547125
## 18 -59.02000 -58.95825 164.1155 -14.572286 3.448000
## 19 27.15425 -18.72900 84.9540 -33.376000 -24.180000
## 20 49.70275 58.37725 56.7930 45.059857 13.870250
## 21 26.91725 4.58200 -26.0180 -2.687714 -1.402000
## 22 32.29000 41.31375 -6.1915 15.729429 12.639375
## 23 -40.12650 6.15250 -8.9040 38.621714 23.301875
## 24 48.08050 -38.88700 -99.3035 -9.754714 -25.179875
## 25 25.31625 -57.15325 -33.7825 -41.023429 8.185625
## 26 -84.62625 -41.46975 -26.5115 14.761714 15.586875
## 27 -68.02975 -80.09750 70.0380 -2.203571 5.269250
## 28 42.91875 37.46575 -117.7695 -76.924000 -18.863750
## 29 52.22675 9.10900 60.2755 16.093571 22.180125
## 30 -85.56425 -52.80725 -58.7475 -32.337429 -36.922000
## 31 50.69075 45.46600 97.3320 26.963429 -3.275875
## 32 118.37950 108.38475 35.8195 17.191143 4.182750
## 33 66.29575 40.32975 44.4885 -5.121000 0.412500
## 34 5.23300 4.48575 43.9435 26.901571 39.531375
## 35 -5.40250 19.73825 -19.5230 -11.512000 3.216500
## 36 -12.04375 -16.88800 9.7685 10.585571 21.393125
## 37 3.24675 -151.23100 -67.3130 -41.687571 -18.856375
## 38 34.47425 39.04675 124.5925 22.922143 22.484375
## 39 -25.01875 -18.86925 15.5645 12.808571 19.520125
## 40 -59.58325 -36.81900 -42.7465 -2.285714 -25.686750
## 41 -85.24925 -80.12000 -189.0705 2.266571 -13.151000
## 42 72.77450 128.94450 150.8310 32.551000 8.233125
## 43 46.12325 97.01975 182.8865 25.203571 24.855375
## 44 -14.06825 49.45625 79.2735 30.493143 2.417625
## 45 -114.44075 -103.77950 -89.6125 -10.721286 -6.017125
## 46 14.75200 13.36275 69.0405 40.036000 26.555375
## 47 22.27775 10.38300 -16.3375 -12.889143 -38.260500
## 48 -30.97125 12.62450 42.1085 -30.438143 -8.060000
## 49 56.42575 37.12500 -89.0320 -5.452143 -13.691250
## 50 38.73525 112.52600 24.7785 34.899857 49.314250
## 51 -12.78475 -31.35800 -28.8750 -0.109000 -22.021875
## 52 -20.21375 22.76525 -6.3230 -43.021143 -40.764250
## 53 -41.30525 -60.01500 -127.0275 10.442429 27.183375
## 54 -65.95425 20.34450 -55.2265 5.108286 -20.562250
# Scree Plot
plot(lambda8.26*1000, type = "o", pch = 19, xlab = "i",
ylab = expression(hat(lamdda)[i]%*%10^(3)),
xaxt = "n",
main = "A Scree Plot for Data8.26")
axis(1, at = c(1:7))
Under the S condition, the first component contracts independence and leadership with benevolence and
conformity. The second component contracts conformity and leadership with support.
(c) Using the values for the first two principal components, plot
the data in a twodimensional space with along the vertical axis
and along the horizontal axis. Can you distinguish groups
representing the two socioeconomic levels and/or the two
genders? Are there any outliers?
biplot(X_prcomp8.26)
Chapter 9
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 20/37
2026/1/10 20:55 Homework3
9.12
data6.9 <- [Link]("[Link]", header = FALSE)
data6.9
## V1 V2 V3 V4
## 1 98 81 38 female
## 2 103 84 38 female
## 3 103 86 42 female
## 4 105 86 42 female
## 5 109 88 44 female
## 6 123 92 50 female
## 7 123 95 46 female
## 8 133 99 51 female
## 9 133 102 51 female
## 10 133 102 51 female
## 11 134 100 48 female
## 12 136 102 49 female
## 13 138 98 51 female
## 14 138 99 51 female
## 15 141 105 53 female
## 16 147 108 57 female
## 17 149 107 55 female
## 18 153 107 56 female
## 19 155 115 63 female
## 20 155 117 60 female
## 21 158 115 62 female
## 22 159 118 63 female
## 23 162 124 61 female
## 24 177 132 67 female
## 25 93 74 37 male
## 26 94 78 35 male
## 27 96 80 35 male
## 28 101 84 39 male
## 29 102 85 38 male
## 30 103 81 37 male
## 31 104 83 39 male
## 32 106 83 39 male
## 33 107 82 38 male
## 34 112 89 40 male
## 35 113 88 40 male
## 36 114 86 40 male
## 37 116 90 43 male
## 38 117 90 41 male
## 39 117 91 41 male
## 40 119 93 41 male
## 41 120 89 40 male
## 42 120 93 44 male
## 43 121 95 42 male
## 44 125 93 45 male
## 45 127 96 45 male
## 46 128 95 45 male
## 47 131 95 46 male
## 48 135 106 47 male
n <- 24
S <- 10 ^ (-3) * matrix(c(11.072, 8.019, 8.160, 8.019, 6.417, 6.005, 8.160, 6.005, 6.773), ncol
= 3, nrow = 3)
L_hat <- c(0.1022, 0.0752, 0.0765)
L_hat %*% t(L_hat)
Sn <- (n - 1) / n * S
Sn
## [1] 94.41336
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 22/37
2026/1/10 20:55 Homework3
9.19
library(psych)
data9.19 <- [Link]("[Link]")
data9.19_scale <- scale(data9.19, center = TRUE, scale = TRUE)
fac.ml2 <- fa(r = data9.19_scale, nfactors = 2, fm = "mle", rotate = "none")
print(fac.ml2, digits = 3)
## V1 V2 V3 V4 V5 V6 V7
## V1 1.0000000 0.9295185 0.8834713 0.5720627 0.6642314 0.5543376 0.9311883
## V2 0.9295185 1.0000000 0.8749727 0.5413952 0.6547844 0.5624010 0.9373106
## V3 0.8834713 0.8749727 1.0000000 0.6996404 0.6751659 0.4798313 0.8449575
## V4 0.5720627 0.5413952 0.6996404 1.0000000 0.5918666 0.1504776 0.4126431
## V5 0.6642314 0.6547844 0.6751659 0.5918666 1.0000000 0.3412918 0.6189365
## V6 0.5543376 0.5624010 0.4798313 0.1504776 0.3412918 1.0000000 0.6017606
## V7 0.9311883 0.9373106 0.8449575 0.4126431 0.6189365 0.6017606 1.0000000
round(R9.19-L.ml2%*%t(L.ml2)-diag(Psi.ml2), 3)
## V1 V2 V3 V4 V5 V6 V7
## V1 0.000 -0.003 0.001 0.000 0.044 0.120 -0.004
## V2 -0.003 0.000 -0.032 0.000 0.091 -0.097 0.007
## V3 0.001 -0.032 0.000 0.001 -0.038 0.161 0.008
## V4 0.000 0.000 0.001 0.000 -0.001 -0.004 0.000
## V5 0.044 0.091 -0.038 -0.001 0.000 0.045 -0.044
## V6 0.120 -0.097 0.161 -0.004 0.045 0.000 -0.035
## V7 -0.004 0.007 0.008 0.000 -0.044 -0.035 0.000
## V1 V2 V3 V4 V5 V6 V7
## V1 1.0000000 0.9228132 0.9120900 0.5714373 0.6949346 0.6738835 0.9255325
## V2 0.9228132 1.0000000 0.8471023 0.5417814 0.6799445 0.4654561 0.9481931
## V3 0.9120900 0.8471023 1.0000000 0.6991263 0.6969684 0.6402870 0.8255831
## V4 0.5714373 0.5417814 0.6991263 1.0000000 0.5910467 0.1469508 0.4130097
## V5 0.6949346 0.6799445 0.6969684 0.5910467 1.0000000 0.3841949 0.6425632
## V6 0.6738835 0.4654561 0.6402870 0.1469508 0.3841949 1.0000000 0.5669006
## V7 0.9255325 0.9481931 0.8255831 0.4130097 0.6425632 0.5669006 1.0000000
round(R9.19-L.ml3%*%t(L.ml3)-diag(Psi.ml3), 3)
## V1 V2 V3 V4 V5 V6 V7
## V1 0.000 0.003 -0.028 0.001 0.013 0.001 0.002
## V2 0.003 0.000 -0.005 0.000 0.066 0.000 -0.004
## V3 -0.028 -0.005 0.000 0.001 -0.059 0.001 0.027
## V4 0.001 0.000 0.001 0.000 0.000 0.000 0.000
## V5 0.013 0.066 -0.059 0.000 0.000 0.002 -0.068
## V6 0.001 0.000 0.001 0.000 0.002 0.000 -0.001
## V7 0.002 -0.004 0.027 0.000 -0.068 -0.001 0.000
## [1] 80.22979
## [1] 90.63956
m = c(2, 3)
p = 7
n = 50
(n - 1 - (2 * p + 4 * m[1] + 5) / 6) * log(det(L.ml2%*%t(L.ml2)+diag(Psi.ml2))/det(R9.19))
## [1] 117.3066
(n - 1 - (2 * p + 4 * m[2] + 5) / 6) * log(det(L.ml3%*%t(L.ml3)+diag(Psi.ml3))/det(R9.19))
## [1] 62.82397
print([Link], digits = 3)
L <- [Link]$loadings
Psi <- diag([Link]$uniquenesses)
## [,1]
## WLS1 1.416
## WLS2 -1.491
## WLS3 3.185
9.20
library(psych)
data9.20 <- [Link]("[Link]")
data9.20 <- [Link](
X1 = data9.20$V1,
X2 = data9.20$V2,
X3 = data9.20$V5,
X4 = data9.20$V6
)
data9.20
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 30/37
2026/1/10 20:55 Homework3
## X1 X2 X3 X4
## 1 8 98 12 8
## 2 7 107 9 5
## 3 7 103 5 6
## 4 10 88 8 15
## 5 6 91 8 10
## 6 8 90 12 12
## 7 9 84 12 15
## 8 5 72 21 14
## 9 7 82 11 11
## 10 8 64 13 9
## 11 6 71 10 3
## 12 6 91 12 7
## 13 7 72 18 10
## 14 10 70 11 7
## 15 10 72 8 10
## 16 9 77 9 10
## 17 8 76 7 7
## 18 8 71 16 4
## 19 9 67 13 2
## 20 9 69 9 5
## 21 10 62 14 4
## 22 9 88 7 6
## 23 8 80 13 11
## 24 5 30 5 2
## 25 6 83 10 23
## 26 8 84 7 6
## 27 6 78 11 11
## 28 8 79 7 10
## 29 6 62 9 8
## 30 10 37 7 2
## 31 8 71 10 7
## 32 7 52 12 8
## 33 5 48 8 4
## 34 6 75 10 24
## 35 10 35 6 9
## 36 8 85 9 10
## 37 5 86 6 12
## 38 5 86 13 18
## 39 7 79 9 25
## 40 7 79 8 6
## 41 6 68 11 14
## 42 8 40 6 5
##
## Loadings:
## ML1
## X1 -0.324
## X2 0.410
## X3 0.232
## X4 0.771
##
## ML1
## SS loadings 0.921
## Proportion Var 0.230
round(Psi.ml1, 3)
## X1 X2 X3 X4
## 0.895 0.832 0.946 0.405
##
## Loadings:
## ML1 ML2
## X1 -0.489
## X2 0.559 0.102
## X3 0.172 0.192
## X4 0.493 0.426
##
## ML1 ML2
## SS loadings 0.594 0.468
## Proportion Var 0.148 0.117
## Cumulative Var 0.148 0.265
round(Psi.ml2, 3)
## X1 X2 X3 X4
## 0.895 0.832 0.946 0.405
Chapter 10
盘桌面请来这里/Weedy's-(1)/课程日常学习/专业课/多元统计分析/25秋多元统计作业/[Link]
[Link] 34/37
2026/1/10 20:55 Homework3
10.18
normalize_b <- function
(b, mat22){
return
(b/c(sqrt((t(b)%*%mat22%*%b))))
}
get_canon_var <- function
(mat, p, q){
# 矩阵的分块
mat11 <- mat[1:p, 1:p]
mat12 <- mat[1:p, (p+1):(p+q)]
mat21 <- mat[(p+1):(p+q), 1:p]
mat22 <- mat[(p+1):(p+q), (p+1):(p+q)]
# 求逆
mat11_inv <- solve(mat11)
mat22_inv <- solve(mat22)
mat11_sqrt_inv <- eigen(mat11)$vectors%*%diag(eigen(mat11)$values^(-0.5))%*%t(eigen(mat11)$ve
ctors)
mat22_sqrt_inv <- eigen(mat22)$vectors%*%diag(eigen(mat22)$values^(-0.5))%*%t(eigen(mat22)$ve
ctors)
## $rho_star
## [1] 0.91732930 0.81692694 0.26538537 0.09168402
##
## $A
## [,1] [,2] [,3] [,4]
## [1,] 1.5054 0.2119 -1.9984 -0.6764
## [2,] -3.4956 -1.5431 1.0760 3.7679
## [3,] 5.7015 -3.5252 4.7135 -7.1532
## [4,] 5.0848 0.5867 -6.0694 0.6861
##
## $B
## V5 V6 V7 V8
## [1,] 0.1593 -0.6325 -0.3249 -0.8179
## [2,] 0.6886 1.0029 0.0050 -1.5619
## [3,] 0.5130 -0.0772 1.6631 0.7786
## [4,] -2.3330 2.1803 -0.0222 -0.0891
get_var_expla(R, 4, 4, 1)
## $R2Z1
## [1] 0.8801116
##
## $R2Z2
## [1] 0.6979143
## $`H_0^(k)`
## [1] 0 1 2
##
## $statistic
## [1] 170.864715 66.794152 4.603281
##
## $df
## [1] 16 9 4
##
## $[Link]
## [1] 26.296228 16.918978 9.487729
## V1 V2 V3 V4 V5 V6 V7
## V1 1.0000000 0.9138256 0.9838790 0.9875554 0.6477987 0.7350138 -0.5418813
## V2 0.9138256 1.0000000 0.9422199 0.8746665 0.5370190 0.6085413 -0.5559586
## V3 0.9838790 0.9422199 1.0000000 0.9745114 0.6807025 0.7644251 -0.5745904
## V4 0.9875554 0.8746665 0.9745114 1.0000000 0.7063811 0.7962528 -0.5636592
## V5 0.6477987 0.5370190 0.6807025 0.7063811 1.0000000 0.9055912 -0.7334321
## V6 0.7350138 0.6085413 0.7644251 0.7962528 0.9055912 1.0000000 -0.7109855
## V7 -0.5418813 -0.5559586 -0.5745904 -0.5636592 -0.7334321 -0.7109855 1.0000000
## V8 0.8217782 0.8495981 0.8651424 0.8132479 0.7842212 0.7927309 -0.7845570
## V8
## V1 0.8217782
## V2 0.8495981
## V3 0.8651424
## V4 0.8132479
## V5 0.7842212
## V6 0.7927309
## V7 -0.7845570
## V8 1.0000000