Library: | stats |
See also: | draftman factor FluryStepUp pca CPCprop CPC CPCFGalg Jacobirot |
Quantlet: | CPCp | |
Description: | CPCp computes the common eigenmatrix, eigenvalues, corresponding standard errors, and estimated population covariance matrices from sample covariances of k groups assuming q common eigenvectors in B; CPCp uses maximum likelihood |
Usage: | {Bplus, lambdaplus, lambdaerror, psi}=CPCp(A,N,q,{Binitial}) | |
Input: | ||
A | p x p x k array of k covariances | |
N | k x 1 vector of weights, usually number of observations in group k | |
q | scalar, determining the number of common components in B | |
Binitial | p x p matrix, optional inital approximation to B, usually obtained from the CPC model (default). This parameter is useful when estimating iteratively several CPCp models from the same data. | |
Output: | ||
Bplus | p x p x k array of orthogonal transformation matrix with q common and p-q specific components | |
lambdaplus | p x k matrix of p eigenvalues of each group k | |
lambdaerror | p x k matrix of p standard errors of eigenvalues of each group k | |
psi | p x p x k array of k estimated population covariance matrices |
library("stats") covar1=#(112.01, 106.64, 52.97)~#(106.64,108.13,54.75)~#(52.97,54.75,33.86) covar2=#(86.08,81.66,40.24)~#(81.66,85.54,42.08)~#(40.24,42.08,26.66) covar3=#(65.4,60.23,24.69)~#(60.23,62.27,23.47)~#(24.69,23.47,16.33) covar4=#(88.66,79.11,41.32)~#(79.11,80.57,38.81)~#(41.32,38.81,23.97) covar=reshape(covar1~covar2~covar3~covar4,#(3,3,4)) ;Sample size n=#(173,141,88,76) q=1 ZZ=CPCp(covar,n,q) ZZ
Contents of ZZ.Bplus [,,1,1,1,1,1,1] [1,] 0.67356 0.51816 0.52709 [2,] 0.66073 -0.10248 -0.7436 [3,] 0.33129 -0.84912 0.41139 [,,2,1,1,1,1,1] [1,] 0.67356 0.552 0.49154 [2,] 0.66073 -0.1516 -0.73516 [3,] 0.33129 -0.81995 0.46683 [,,3,1,1,1,1,1] [1,] 0.67356 0.15736 0.72218 [2,] 0.66073 0.30975 -0.68374 [3,] 0.33129 -0.93771 -0.10467 [,,4,1,1,1,1,1] [1,] 0.67356 -0.36931 -0.64025 [2,] 0.66073 -0.087404 0.74552 [3,] 0.33129 0.92519 -0.18514 Contents of ZZ.lambdaplus [1,] 244.27 188.39 133.55 183.87 [2,] 7.214 6.4869 6.9039 3.8194 [3,] 2.5201 3.4056 3.5447 5.5068 Contents of ZZ.lambdaerror [1,] 26.34 22.517 20.249 30.026 [2,] 0.7779 0.77533 1.0468 0.62371 [3,] 0.27175 0.40705 0.53745 0.89925 Contents of ZZ.psi [,,1,1,1,1,1,1] [1,] 113.46 107.34 51.879 [2,] 107.34 108.11 53.324 [3,] 51.879 53.324 32.436 [,,2,1,1,1,1,1] [1,] 88.269 82.067 39.883 [2,] 82.067 84.232 40.874 [3,] 39.883 40.874 25.779 [,,3,1,1,1,1,1] [1,] 62.611 58.022 28.514 [2,] 58.022 60.623 27.481 [3,] 28.514 27.481 20.767 [,,4,1,1,1,1,1] [1,] 86.2 79.326 40.378 [2,] 79.326 83.362 39.179 [3,] 40.378 39.179 23.638