¿PCA con ordinales? Primera entrega

estadística
factorial
Author

José Luis Cañadas Reche

Published

June 2, 2020

Supongo que todos sabemos lo de las escalas de medida, ¿verdad? Nominal, ordinal, intervalo y de razón. Y que todos sabemos lo que es un PCA y que sólo sirve para variables numéricas, ¿seguro?. Un PCA y otras técnicas relacionadas se basan en diagonalizar una matriz, ya sea mediante SVD, autovalores o a lo Gifi en dónde se utiliza Alternative Least Squares.

La materia prima de la que parte un PCA es una matriz de covarianzas o de correlaciones, pero, ¿qué pasa si nuestras variables no son numéricas sino ordinales? Pues entonces podemos utilizar lo que se conoce como correlaciones policóricas, propuestas por Pearson en 1900, aunque os aconsejo leer el artículo que viene en la Encyclopedia Of Statistica Sciences, ojo, 9686 páginas y 7680$ que cuestan todos los volúmenes.

Básicamente, las correlaciones policóricas suponen la existencia de variables latentes continuas asociadas a las variables ordinales observadas. La estimación de la correlación policórica entre dos variables se basa en encontrar la distribución normal bivariante subyacente y el coeficiente de correlación de pearson que mejor aproxima las frecuencias observadas en la tabla de contingencia entre las dos varibles ordinales. La librería polycor de R incorpora la función polychor que implementa el cálculo. Se puede ver el código simplemente poniendo polycor::polychor, si tienes la librería instalada, por supuesto.

Pues una vez tenemos estas correlaciones podemos aplicar las técnicas de PCA o de Análisis factorial sobre nuestra matriz. Veamos un ejemplo, de un curso que di hace unos años en la Pablo de Olavide.

Utilizamos el conjunto de datos Science: Consumer Protection and Perceptions of Science and Technology section of the 1992 Euro-Barometer Survey (Karlheinz and Melich, 1992) based on a sample from Great Britain. Se pregunta por diferentes aspectos de la ciencia, y las categorías de respuesta son “strongly disagree”,“disagree”, “agree” y “strongly agree” .

Variables

Tengo los datos guardados en un rds y subidos al github

Mostrar / ocultar código

datos <- readRDS(here::here("data/science.rds"))

head(datos)
#>          Comfort       Environment           Work         Future     Technology
#> 1 strongly agree    strongly agree strongly agree          agree strongly agree
#> 2          agree    strongly agree          agree          agree          agree
#> 3          agree          disagree       disagree       disagree strongly agree
#> 4          agree             agree       disagree       disagree strongly agree
#> 5          agree strongly disagree strongly agree strongly agree       disagree
#> 6 strongly agree             agree strongly agree          agree          agree
#>         Industry           Benefit
#> 1          agree          disagree
#> 2          agree             agree
#> 3 strongly agree             agree
#> 4 strongly agree             agree
#> 5          agree strongly disagree
#> 6 strongly agree             agree
Mostrar / ocultar código
summary(datos)
#>               Comfort               Environment                 Work    
#>  strongly disagree:  5   strongly disagree: 29   strongly disagree: 33  
#>  disagree         : 32   disagree         : 90   disagree         : 98  
#>  agree            :266   agree            :145   agree            :206  
#>  strongly agree   : 89   strongly agree   :128   strongly agree   : 55  
#>                Future                Technology               Industry  
#>  strongly disagree: 14   strongly disagree: 18   strongly disagree: 10  
#>  disagree         : 72   disagree         : 91   disagree         : 47  
#>  agree            :210   agree            :157   agree            :173  
#>  strongly agree   : 96   strongly agree   :126   strongly agree   :162  
#>               Benefit   
#>  strongly disagree: 21  
#>  disagree         :100  
#>  agree            :193  
#>  strongly agree   : 78

Nos aseguramos de que los niveles de los factores están codificados correctamente y en el orden que queremos

Mostrar / ocultar código
levels(datos$Work)
#> [1] "strongly disagree" "disagree"          "agree"            
#> [4] "strongly agree"

Pues ya podemos utilizar las correlaciones policóricas y el análisis factorial o un PCA.

Mostrar / ocultar código
library(psych)
library(polycor)

Utilizamos la función hetcor que nos permite calcular correlaciones entre variables continuas, entre continuas con dicotómicas, continuas con ordinales y entre ordinales.

Mostrar / ocultar código
cor_poly <-  hetcor(datos)
Mostrar / ocultar código
cor_poly
#> 
#> Two-Step Estimates
#> 
#> Correlations/Type of Correlation:
#>             Comfort Environment       Work     Future Technology   Industry
#> Comfort           1  Polychoric Polychoric Polychoric Polychoric Polychoric
#> Environment 0.09934           1 Polychoric Polychoric Polychoric Polychoric
#> Work         0.2012    -0.08277          1 Polychoric Polychoric Polychoric
#> Future       0.3463    -0.02804     0.4786          1 Polychoric Polychoric
#> Technology  0.08963      0.4638    -0.1039   -0.03596          1 Polychoric
#> Industry     0.1857      0.4108  -0.007643     0.1027     0.4348          1
#> Benefit       0.408    -0.03652     0.2086     0.3769   -0.01434      0.118
#>                Benefit
#> Comfort     Polychoric
#> Environment Polychoric
#> Work        Polychoric
#> Future      Polychoric
#> Technology  Polychoric
#> Industry    Polychoric
#> Benefit              1
#> 
#> Standard Errors:
#>             Comfort Environment    Work  Future Technology Industry
#> Comfort                                                            
#> Environment 0.06309                                                
#> Work        0.06062      0.0594                                    
#> Future      0.05651     0.06057 0.04566                            
#> Technology  0.06331     0.04529  0.0591 0.06049                    
#> Industry    0.06306     0.04979 0.06213 0.06176    0.04825         
#> Benefit     0.05315     0.05985  0.0566 0.05062    0.05977  0.06078
#> 
#> n = 392 
#> 
#> P-values for Tests of Bivariate Normality:
#>             Comfort Environment      Work    Future Technology Industry
#> Comfort                                                                
#> Environment  0.1763                                                    
#> Work        0.00592     0.01337                                        
#> Future       0.3163     0.00311    0.3021                              
#> Technology  0.01695    0.001547   0.07819  0.009519                    
#> Industry     0.4694   1.891e-05 0.0001493 0.0005283  4.817e-07         
#> Benefit     0.08673    0.005932   0.01871  0.009679    0.06082 0.007907
Mostrar / ocultar código
corrplot::corrplot(cor_poly$correlations)

Y sin más hacemos el análisis factorial. Veamos qué número de factores elegimos

Mostrar / ocultar código

VSS(cor_poly$correlations)

#> 
#> Very Simple Structure
#> Call: vss(x = x, n = n, rotate = rotate, diagonal = diagonal, fm = fm, 
#>     n.obs = n.obs, plot = plot, title = title, use = use, cor = cor)
#> VSS complexity 1 achieves a maximimum of 0.7  with  2  factors
#> VSS complexity 2 achieves a maximimum of 0.78  with  7  factors
#> 
#> The Velicer MAP achieves a minimum of 0.07  with  2  factors 
#> BIC achieves a minimum of  -19.96  with  3  factors
#> Sample Size adjusted BIC achieves a minimum of  -10.44  with  3  factors
#> 
#> Statistics by number of factors 
#>   vss1 vss2   map dof   chisq     prob sqresid  fit RMSEA BIC SABIC complex
#> 1 0.39 0.00 0.083  14 6.6e+02 2.4e-132     6.0 0.39 0.215 566   610     1.0
#> 2 0.70 0.73 0.074   8 7.7e+01  2.1e-13     2.6 0.73 0.093  22    47     1.1
#> 3 0.67 0.78 0.131   3 7.6e-01  8.6e-01     2.0 0.80 0.000 -20   -10     1.3
#> 4 0.67 0.78 0.244  -1 2.5e-07       NA     2.0 0.80    NA  NA    NA     1.2
#> 5 0.67 0.78 0.429  -4 9.0e-08       NA     1.9 0.80    NA  NA    NA     1.2
#> 6 0.67 0.78 1.000  -6 8.8e-13       NA     1.9 0.80    NA  NA    NA     1.2
#> 7 0.67 0.78    NA  -7 8.8e-13       NA     1.9 0.80    NA  NA    NA     1.2
#>    eChisq    SRMR  eCRMS eBIC
#> 1 1.3e+03 1.8e-01 0.2174 1227
#> 2 6.8e+01 4.0e-02 0.0651   13
#> 3 4.8e-01 3.4e-03 0.0089  -20
#> 4 1.6e-07 1.9e-06     NA   NA
#> 5 6.2e-08 1.2e-06     NA   NA
#> 6 3.5e-13 2.9e-09     NA   NA
#> 7 3.5e-13 2.9e-09     NA   NA
Mostrar / ocultar código
res_factorial <-  fa(cor_poly$correlations, nfactors = 3, n.obs = nrow(datos))
Mostrar / ocultar código
diagram(res_factorial)

Y listo ya tenemos el análsis factorial hecho. Ahora habría que interpretar y demás, ver las cargas factoriales y las comunalidades (cómo de bien está representada la variable en la estructura factorial)

Mostrar / ocultar código
res_factorial$loadings
#> 
#> Loadings:
#>             MR2    MR1    MR3   
#> Comfort      0.168  0.222  0.357
#> Environment  0.666              
#> Work                0.617       
#> Future              0.813       
#> Technology   0.695              
#> Industry     0.632              
#> Benefit                    0.861
#> 
#>                  MR2   MR1   MR3
#> SS loadings    1.362 1.096 0.885
#> Proportion Var 0.195 0.157 0.126
#> Cumulative Var 0.195 0.351 0.478
res_factorial$communalities
#>     Comfort Environment        Work      Future  Technology    Industry 
#>   0.2940500   0.4429437   0.3519061   0.6846375   0.4854217   0.4208926 
#>     Benefit 
#>   0.7309609

Aunque el análisis lo hemos hecho utilizando las correlaciones policóricas, para obtener las puntuaciones para cada fila hay que convertir los datos a numéricos.

Mostrar / ocultar código
science.num <- data.frame(sapply(datos, as.numeric))
table(datos$Comfort, science.num$Comfort)
#>                    
#>                       1   2   3   4
#>   strongly disagree   5   0   0   0
#>   disagree            0  32   0   0
#>   agree               0   0 266   0
#>   strongly agree      0   0   0  89

Science data: Puntuaciones factoriales

Mostrar / ocultar código
puntuaciones <- factor.scores(science.num, res_factorial)
puntuaciones$scores
#>                 MR2          MR1          MR3
#>   [1,]  0.983783784  0.586931403 -0.704801916
#>   [2,]  0.316308160  0.075403203  0.072119271
#>   [3,]  0.511214907 -1.267647217  0.111088544
#>   [4,]  0.971164636 -1.283190166  0.069652282
#>   [5,] -1.601261361  1.428869944 -1.845504751
#>   [6,]  0.483437248  0.817348345  0.546986739
#>   [7,]  0.511546440 -0.225286108  1.304894202
#>   [8,] -0.035027006 -0.161537530  1.334985660
#>   [9,]  0.980349283  1.002260263 -0.808566327
#>  [10,]  0.016011850  0.319878827  0.455157733
#>  [11,] -0.666247071  1.124247892  0.248753651
#>  [12,] -0.059594604 -1.574845059  0.129568131
#>  [13,] -0.057017852  0.042740522  0.124900336
#>  [14,] -1.656341385  0.019112260 -0.995177681
#>  [15,]  0.948905669 -0.480305368 -1.046938254
#>  [16,]  1.392694657  0.089972097  0.133589749
#>  [17,] -0.549010849 -1.868036524 -1.172346199
#>  [18,] -0.690215015  0.154694729  0.143646992
#>  [19,] -0.517567236 -0.385470894 -0.933974272
#>  [20,] -1.220028066  0.076377257  0.052085055
#>  [21,] -0.897804321 -2.013344274 -0.408168528
#>  [22,]  0.510946786 -0.669040472  0.204583332
#>  [23,] -0.143641569  0.090946151  0.113555533
#>  [24,] -1.555827177 -0.838028790 -0.602960737
#>  [25,] -1.039904617  0.049224102 -0.892270941
#>  [26,] -0.057617506 -0.401013842 -0.975410534
#>  [27,]  0.378695812 -0.343748845  0.071852202
#>  [28,]  0.016011850  0.319878827  0.455157733
#>  [29,]  1.541106372 -0.821139944 -0.955643386
#>  [30,]  0.378695812 -0.343748845  0.071852202
#>  [31,]  0.012845469  0.136600942  0.257898535
#>  [32,] -0.603922832 -0.935872010 -1.038813862
#>  [33,]  0.211250129  0.019189516  1.687932664
#>  [34,]  0.822484801  0.226528620  1.252380205
#>  [35,]  1.431445899 -0.256372004  1.222021678
#>  [36,] -0.841499957 -0.068187324  0.537763188
#>  [37,] -0.143641569  0.090946151  0.113555533
#>  [38,] -1.150164745  0.170237677  0.185083253
#>  [39,] -0.046375802  0.739030874  0.455424802
#>  [40,] -1.293389301 -1.243122157 -1.471977999
#>  [41,] -0.143641569  0.090946151  0.113555533
#>  [42,] -0.286802713  0.318554172 -0.256205275
#>  [43,]  0.015080662 -1.166236647 -1.838958794
#>  [44,] -1.174132688 -0.799315486  0.079976594
#>  [45,]  0.315976627 -0.966957907 -1.121686386
#>  [46,]  1.599952430  1.215649990 -0.508400389
#>  [47,] -0.665978950  0.525641147  0.155258864
#>  [48,]  0.288242649 -2.563543320 -2.524363114
#>  [49,] -0.296087439  0.973632688 -0.001286612
#>  [50,] -1.679977795  0.091920206  0.093521317
#>  [51,] -0.119673625  1.060499315  0.218662193
#>  [52,]  1.392694657  0.089972097  0.133589749
#>  [53,] -0.119673625  1.060499315  0.218662193
#>  [54,]  1.393026191  1.132333206  1.327395406
#>  [55,]  1.393026191  1.132333206  1.327395406
#>  [56,] -0.603591298  0.106489100  0.154991795
#>  [57,] -0.057617506 -0.401013842 -0.975410534
#>  [58,] -1.402003864 -0.990638475 -2.693408126
#>  [59,] -1.543960787  0.393660827  1.523822514
#>  [60,]  1.306339062 -0.460429019  0.028750158
#>  [61,]  1.440299012  0.986717314 -0.850002589
#>  [62,]  1.629519025 -1.416144540  1.458250149
#>  [63,]  0.475961579  0.304335878  0.413721471
#>  [64,]  1.469534074 -2.687438325 -0.077157708
#>  [65,] -0.603591298  0.106489100  0.154991795
#>  [66,] -1.112076570 -2.260828643 -1.114096132
#>  [67,] -0.168209167 -1.322361377 -1.091861997
#>  [68,] -1.033028602  0.118482204 -1.859316543
#>  [69,] -1.237119995 -0.823917804 -1.020067207
#>  [70,] -1.555202491 -0.746383889  0.092987179
#>  [71,] -0.493930825 -0.458278840 -2.022673269
#>  [72,]  1.431114366 -1.298733114  0.028216020
#>  [73,]  1.490291957  1.780417929  1.669264675
#>  [74,]  0.051328590  0.388863586  1.439825251
#>  [75,]  0.971496170 -0.240829056  1.263457940
#>  [76,]  0.622995850 -1.336853014  1.529777870
#>  [77,] -0.666578605  0.081886782 -0.945052006
#>  [78,] -0.822465989  0.479986356  0.010915862
#>  [79,] -0.081253917 -0.328205896  0.113288464
#>  [80,]  1.513928368  1.707609983  0.580565678
#>  [81,]  0.005369800 -0.376411525  0.124633267
#>  [82,] -1.586146530  1.155333789  0.331626175
#>  [83,] -0.373743025  1.471643304  1.823397851
#>  [84,]  1.552348076  0.318904772  0.475191949
#>  [85,]  1.662340082  0.796497942 -0.508667458
#>  [86,]  1.541106372 -0.821139944 -0.955643386
#>  [87,] -0.943368166 -0.095290420  0.757745590
#>  [88,] -1.483881767 -2.241683546  1.434728452
#>  [89,] -0.555986944  1.003234317 -0.828600543
#>  [90,] -1.111745036 -1.218467534  0.079709525
#>  [91,] -2.015152221 -0.730840941  0.134423441
#>  [92,]  0.463010898 -2.608146799 -0.005629988
#>  [93,]  1.304282004  0.684976693 -2.280303786
#>  [94,]  0.465319529 -0.391954473  0.083197005
#>  [95,] -3.438023559  1.325474742  0.925957627
#>  [96,]  0.909108518  0.178322991  1.263725009
#>  [97,]  0.621206913 -0.790054047 -0.872770862
#>  [98,] -0.081585450 -1.370567006 -1.080517193
#>  [99,] -0.839226384  0.622052405  0.132569257
#> [100,]  0.932413395 -0.936846064 -1.018779646
#> [101,]  1.502686664  0.567565267 -0.850269658
#> [102,]  1.068162282 -0.036498698  0.505016339
#> [103,]  0.300147419  0.661223616  1.294083536
#> [104,]  0.476561233  0.748090243  1.514032341
#> [105,] -0.167277980  0.163754097  1.202254530
#> [106,] -0.468173945 -0.035524643  0.484982123
#> [107,]  0.741647896 -1.605983261 -0.404948116
#> [108,]  0.967354922  1.771358561  0.610657136
#> [109,]  1.392694657  0.089972097  0.133589749
#> [110,] -1.975979755 -1.481114201 -2.872187738
#> [111,]  0.364180636  0.373541675 -1.004967854
#> [112,] -0.151448772 -1.464427425 -1.213515392
#> [113,] -1.047380287 -0.463788365 -1.025536208
#> [114,] -2.139927525  0.107463154  0.134957579
#> [115,]  1.416331068  0.017164151 -0.955109248
#> [116,] -1.656341385  0.019112260 -0.995177681
#> [117,]  0.409807892  0.096455676 -0.883581528
#> [118,] -3.118716722  1.783340093  1.609162027
#> [119,] -1.519992844  1.363213991  1.628929174
#> [120,] -0.049810304  1.154359734  0.351660391
#> [121,]  0.943718511  1.844166507  1.699356134
#> [122,] -0.555986944  1.003234317 -0.828600543
#> [123,] -1.150164745  0.170237677  0.185083253
#> [124,] -1.126528334  0.097429731 -0.903615744
#> [125,]  0.347751774  1.557968833  0.310491198
#> [126,]  0.763638742 -1.810261314  0.805137207
#> [127,] -0.270725504 -1.286942080  0.025262678
#> [128,]  1.392363124 -0.952389013 -1.060215908
#> [129,] -0.628158897 -1.306818428 -1.050425735
#> [130,]  1.415999535 -1.025196959 -2.148914906
#> [131,]  0.932744928  0.105515045  0.175026011
#> [132,] -0.603591298  0.106489100  0.154991795
#> [133,] -0.081253917 -0.328205896  0.113288464
#> [134,]  1.455413843  0.713181159  1.327128337
#> [135,]  1.022866558  1.282948411  1.577435670
#> [136,]  1.439967479 -0.055643795 -2.043808246
#> [137,]  1.106913523 -0.382842799  1.593448267
#> [138,]  0.275579821 -0.752083912  0.088666007
#> [139,]  1.393026191  1.132333206  1.327395406
#> [140,] -0.081253917 -0.328205896  0.113288464
#> [141,]  0.078399502 -0.099273221  0.454890664
#> [142,] -1.006940188  1.583597510  1.842144506
#> [143,] -0.541203646 -0.312662948  0.154724726
#> [144,] -0.033381441 -0.030067424 -0.963798661
#> [145,] -0.143641569  0.090946151  0.113555533
#> [146,]  1.493502018 -1.717885161  0.027948951
#> [147,] -1.815994803 -0.209820416 -1.336779881
#> [148,] -0.143973102 -0.951414958 -1.080250124
#> [149,] -1.108836751  1.441479157  1.268847388
#> [150,] -1.286181752 -0.131502945 -1.245217944
#> [151,]  0.910154428 -0.133961267 -2.135370183
#> [152,]  1.552679609  1.361265882  1.668997606
#> [153,]  1.454750776 -1.371541060 -1.060482977
#> [154,] -0.603591298  0.106489100  0.154991795
#> [155,] -0.517567236 -0.385470894 -0.933974272
#> [156,] -1.196391655  0.003569311 -1.036613943
#> [157,]  0.784065093  1.615233831  1.357753934
#> [158,]  0.316308160  0.075403203  0.072119271
#> [159,]  0.337109724  0.861678482 -0.020033267
#> [160,] -0.081253917 -0.328205896  0.113288464
#> [161,]  0.608212552 -0.020955749  0.546452601
#> [162,] -0.081585450 -1.370567006 -1.080517193
#> [163,]  0.838913663 -0.957898538 -0.063078847
#> [164,] -0.019197798 -1.789719053 -1.080784262
#> [165,] -0.082962894 -2.100643857  1.124772341
#> [166,] -0.081253917 -0.328205896  0.113288464
#> [167,] -0.189868480 -0.075722214 -1.108141663
#> [168,]  0.378695812 -0.343748845  0.071852202
#> [169,] -0.327262931 -1.107539688 -0.333153327
#> [170,] -0.022407859  1.708584038  0.560531462
#> [171,] -0.035090418 -1.802505385  0.047685216
#> [172,]  1.552348076  0.318904772  0.475191949
#> [173,]  1.392363124 -0.952389013 -1.060215908
#> [174,]  1.006106163  1.425014459  1.699089065
#> [175,] -0.024384956  0.534752821  1.665510126
#> [176,]  1.576316020  1.288457936  0.580298609
#> [177,]  1.552348076  0.318904772  0.475191949
#> [178,] -0.627559242 -0.863064064  0.049885135
#> [179,] -0.143641569  0.090946151  0.113555533
#> [180,] -0.738150903 -1.784411598 -0.066566328
#> [181,]  0.507405192  1.786901509  0.652093398
#> [182,] -1.077135043  0.447375981  0.515340650
#> [183,] -0.935331223 -1.131600907  0.299658330
#> [184,] -1.150164745  0.170237677  0.185083253
#> [185,] -0.143973102 -0.951414958 -1.080250124
#> [186,] -0.136765554  0.160204254 -0.853490069
#> [187,] -0.547321992  0.525693453  0.606902587
#> [188,] -0.690215015  0.154694729  0.143646992
#> [189,]  1.493833551 -0.675524052  1.221754609
#> [190,]  1.599952430  1.215649990 -0.508400389
#> [191,] -1.239954842  0.035165421 -0.023520748
#> [192,]  1.615067261  0.942113834  1.668730537
#> [193,] -0.610798847 -1.005130112 -0.071768260
#> [194,] -1.558744085  1.709558092  0.540497246
#> [195,] -0.134688376 -1.606493474 -1.335168787
#> [196,]  1.416662601  1.059525260  0.238696409
#> [197,] -0.771051920 -1.677817152 -1.513681330
#> [198,] -0.787480782 -0.493389994 -0.198222278
#> [199,]  0.956712872  1.075068209  0.280132671
#> [200,] -0.127212707 -1.093481007 -1.201903519
#> [201,] -1.529277569  2.018292506  1.883847837
#> [202,]  0.569792844  1.367749461  0.651826329
#> [203,] -0.603259765  1.148850209  1.348797452
#> [204,] -0.073778247  0.184806571  0.246553732
#> [205,] -0.604190953 -0.337265265 -0.945319075
#> [206,]  0.943718511  1.844166507  1.699356134
#> [207,]  0.260796524  0.563813353 -0.894659262
#> [208,] -0.081585450 -1.370567006 -1.080517193
#> [209,]  0.362535071  0.242071569  1.293816467
#> [210,] -0.264875279 -1.526691735 -0.333420396
#> [211,] -1.519992844  1.363213991  1.628929174
#> [212,]  0.492721974  0.162269830  0.292068076
#> [213,] -0.492141889 -1.005077807  0.379875463
#> [214,]  1.614735728 -0.100247275  0.474924880
#> [215,] -0.143641569  0.090946151  0.113555533
#> [216,] -1.174400809 -0.200708742  0.173471381
#> [217,]  0.796128266 -0.639979941 -2.355586056
#> [218,] -0.143641569  0.090946151  0.113555533
#> [219,] -0.112197956  1.573511782  0.351927460
#> [220,]  1.392694657  0.089972097  0.133589749
#> [221,]  0.355059402 -0.270940898  1.160551199
#> [222,] -0.616585659  0.875587398  1.574215258
#> [223,]  0.909108518  0.178322991  1.263725009
#> [224,] -0.690546549 -0.887666381 -1.050158666
#> [225,] -0.697422564 -0.956924483 -0.083113063
#> [226,]  1.552348076  0.318904772  0.475191949
#> [227,] -1.610714128 -0.257973739 -0.873791354
#> [228,]  0.608812207  0.422798615  1.646763471
#> [229,] -1.008629045 -0.810132466  0.062895720
#> [230,] -1.109767939 -0.044636318 -1.025269139
#> [231,] -0.627227709  0.179297046  1.243690792
#> [232,] -0.589407655 -1.653162530  0.038006194
#> [233,] -0.381550228 -0.083730272  0.496326926
#> [234,] -0.119673625  1.060499315  0.218662193
#> [235,]  0.464987996 -1.434315583 -1.110608652
#> [236,]  0.386503015  1.211624732  1.398923127
#> [237,] -0.530561597  0.383627404  0.485249192
#> [238,]  0.956381339  0.032707099 -0.913672986
#> [239,]  0.386171482  0.169263623  0.205117470
#> [240,] -1.150164745  0.170237677  0.185083253
#> [241,] -1.610114474  0.185780625  0.226519515
#> [242,]  1.552348076  0.318904772  0.475191949
#> [243,] -0.389918704 -0.089780895 -0.239391471
#> [244,] -0.534059510 -0.842011590 -0.905815664
#> [245,]  0.933076461  1.147876155  1.368831668
#> [246,]  1.354274949  1.478677308  0.238963478
#> [247,]  1.479050253  0.640373213  0.238429340
#> [248,] -0.213504890 -0.002914268 -0.019442666
#> [249,] -0.326931398 -0.065178578  0.860652330
#> [250,]  0.085875171  0.413739246  0.588155932
#> [251,] -1.071016697 -0.390980419  0.063162789
#> [252,] -0.074377902 -0.258947794 -0.853757138
#> [253,]  0.355327523 -0.869547643  1.067056412
#> [254,]  0.496431609  0.048250048 -0.872236724
#> [255,] -0.443937880  0.335421775  0.496593995
#> [256,] -2.092323170  1.004208371 -0.848634759
#> [257,]  0.886518017 -0.061153320 -1.046671185
#> [258,] -0.057617506 -0.401013842 -0.975410534
#> [259,] -0.990511326  0.399170352  0.526685454
#> [260,] -1.656341385  0.019112260 -0.995177681
#> [261,]  0.995132580 -0.313637002  0.174758942
#> [262,]  1.552348076  0.318904772  0.475191949
#> [263,]  1.537564778  1.634802037 -0.508133320
#> [264,] -0.635134991  1.564452413 -0.706680079
#> [265,] -2.867813702  1.188918218 -0.192832829
#> [266,]  0.316308160  0.075403203  0.072119271
#> [267,]  0.760097149  0.645680668  1.252647274
#> [268,]  0.054763091 -0.026465275  1.543589662
#> [269,]  0.210318942 -1.466925958 -0.606183863
#> [270,]  1.295097358 -1.600473736 -1.402085177
#> [271,] -1.087777093 -0.248914370  0.184816185
#> [272,]  1.493833551 -0.675524052  1.221754609
#> [273,] -1.634019005  0.857195316  1.408713300
#> [274,] -0.649486676  0.982181844  0.127100256
#> [275,] -1.512517174  1.876226458  1.762194442
#> [276,]  0.846121211  0.153720674  0.163681208
#> [277,]  0.464719875 -0.835708838 -1.017113864
#> [278,]  0.862881607  0.011654626  0.042027812
#> [279,] -0.530561597  0.383627404  0.485249192
#> [280,] -0.745395119  1.685465988  0.370674115
#> [281,]  1.046502969  1.210140465  0.488736672
#> [282,] -1.087777093 -0.248914370  0.184816185
#> [283,]  0.402931877  0.027197574  0.083464074
#> [284,]  0.402931877  0.027197574  0.083464074
#> [285,] -1.688930988  1.789359831  1.542245637
#> [286,]  1.393026191  1.132333206  1.327395406
#> [287,] -1.247762044 -1.520208156 -1.350591673
#> [288,] -0.701188598 -1.583956733 -1.380683131
#> [289,] -2.059090620  1.939975035  1.792285900
#> [290,] -0.541203646 -0.312662948  0.154724726
#> [291,] -0.603591298  0.106489100  0.154991795
#> [292,]  0.472795199  0.121057994  0.216462273
#> [293,] -0.850199967 -1.116599056 -1.391760866
#> [294,]  0.869757622  0.080912728 -0.925017790
#> [295,]  0.039648260  0.247070881 -0.633541264
#> [296,]  0.378963933 -0.942355589 -0.021642585
#> [297,]  0.005369800 -0.376411525  0.124633267
#> [298,] -0.105221861 -1.297759060  0.008181804
#> [299,] -1.656341385  0.019112260 -0.995177681
#> [300,]  1.537564778  1.634802037 -0.508133320
#> [301,] -0.049810304  1.154359734  0.351660391
#> [302,]  0.448559134 -0.249888425  0.204850401
#> [303,] -0.059594604 -1.574845059  0.129568131
#> [304,] -1.220028066  0.076377257  0.052085055
#> [305,] -1.126528334  0.097429731 -0.903615744
#> [306,] -1.220028066  0.076377257  0.052085055
#> [307,] -1.133672470  0.626778373  0.156924646
#> [308,]  1.493833551 -0.675524052  1.221754609
#> [309,]  0.410139426  1.138816786  0.310224129
#> [310,] -1.019646308  1.132797048  0.377140519
#> [311,]  0.862550073 -1.030706484 -1.151777845
#> [312,]  1.354274949  1.478677308  0.238963478
#> [313,]  1.478718720 -0.401987897 -0.955376317
#> [314,] -1.133404349  0.028171629  0.063429858
#> [315,]  0.346820586  0.071853359 -1.983625329
#> [316,] -1.236188807  0.662197671  1.274049320
#> [317,] -0.666247071  1.124247892  0.248753651
#> [318,]  0.101474638  1.377241787 -0.042455805
#> [319,] -1.033296723  0.717088949 -1.765821756
#> [320,] -0.143641569  0.090946151  0.113555533
#> [321,] -0.120005158  0.018138205 -0.975143465
#> [322,] -0.081585450 -1.370567006 -1.080517193
#> [323,] -0.096037214  0.987691369 -0.870036805
#> [324,] -0.143641569  0.090946151  0.113555533
#> [325,]  1.552348076  0.318904772  0.475191949
#> [326,] -0.666578605  0.081886782 -0.945052006
#> [327,] -2.037143067 -0.526562888 -1.075661883
#> [328,] -0.081253917 -0.328205896  0.113288464
#> [329,] -0.229665632  0.582906145  1.202521599
#> [330,] -1.676479882  1.317559200  1.484586172
#> [331,]  0.316639694  1.117764312  1.265924928
#> [332,]  1.368726714 -0.879581067  0.028483089
#> [333,]  0.869757622  0.080912728 -0.925017790
#> [334,]  1.393026191  1.132333206  1.327395406
#> [335,] -0.711874328  1.401333891  0.127367325
#> [336,]  0.389937516  0.796295872  1.502687538
#> [337,]  0.423660002 -2.705557063 -2.194372786
#> [338,]  1.392363124 -0.952389013 -1.060215908
#> [339,] -0.057617506 -0.401013842 -0.975410534
#> [340,]  1.392694657  0.089972097  0.133589749
#> [341,] -0.849868434 -0.074237947 -0.197955209
#> [342,] -0.080985796 -0.926812641  0.019793677
#> [343,] -1.507330016 -0.448245417 -0.984099946
#> [344,]  1.416662601  1.059525260  0.238696409
#> [345,]  0.555109626 -0.256882217  0.291801007
#> [346,] -1.133072816  1.070532738  1.257235515
#> [347,] -0.199421327  1.177963046 -0.759728213
#> [348,]  1.092398347  0.334447721  0.516628211
#> [349,] -0.081253917 -0.328205896  0.113288464
#> [350,]  0.981806686 -0.586899814  0.400176748
#> [351,]  0.884540919 -1.234984537  0.058307479
#> [352,] -0.143641569  0.090946151  0.113555533
#> [353,] -0.714182959 -0.814858435  0.038540332
#> [354,]  1.057520232 -0.732789050  0.174491873
#> [355,] -0.279658577 -0.210794470 -1.316745665
#> [356,]  0.869757622  0.080912728 -0.925017790
#> [357,]  0.598323260 -0.078814150 -2.685309315
#> [358,]  1.590767784 -1.069800439  0.369818221
#> [359,] -1.805309073 -3.195111040 -2.844830337
#> [360,] -0.143909690  0.689552896  0.207050320
#> [361,] -0.565171590 -1.282216111  0.049618066
#> [362,] -0.184038375  0.305820146  1.323907926
#> [363,]  0.023219398  1.431498039  0.681917788
#> [364,] -0.081253917 -0.328205896  0.113288464
#> [365,]  1.005774630  0.382653350  0.505283408
#> [366,]  0.039648260  0.247070881 -0.633541264
#> [367,]  0.386171482  0.169263623  0.205117470
#> [368,]  0.402931877  0.027197574  0.083464074
#> [369,]  1.392694657  0.089972097  0.133589749
#> [370,] -1.512517174  1.876226458  1.762194442
#> [371,] -0.230265286  0.139151780  0.102210730
#> [372,]  1.369058247  0.162780043  1.222288747
#> [373,] -0.119405504  0.461892570  0.125167405
#> [374,]  0.594028909  1.738695880  0.663438202
#> [375,]  1.490291957  1.780417929  1.669264675
#> [376,] -0.143641569  0.090946151  0.113555533
#> [377,]  1.197500058 -3.290919568 -2.937760103
#> [378,]  0.110442769  1.827046775  1.793573461
#> [379,]  0.005101679  0.222195220  0.218128055
#> [380,]  0.032772245  0.177812778  0.333504338
#> [381,]  0.029006211 -0.449219471 -0.964065730
#> [382,]  1.490291957  1.780417929  1.669264675
#> [383,]  1.018437457 -1.428806058 -2.107745713
#> [384,] -0.677220654 -0.614403569 -1.275576472
#> [385,] -0.689883482  1.197055838  1.337452649
#> [386,] -1.512517174  1.876226458  1.762194442
#> [387,] -0.689883482  1.197055838  1.337452649
#> [388,]  1.541106372 -0.821139944 -0.955643386
#> [389,] -1.117243608 -0.557648785 -1.158534407
#> [390,]  0.297527375 -3.218621835 -2.779281777
#> [391,] -1.710821754 -0.946891060  0.955460259
#> [392,] -0.096368748 -0.054669741 -2.063842462

Y ya con esas tres dimensiones ya podemos hacer lo que queramos.