ALVARO <- read.delim("~/R/ALVARO.txt")
attach(ALVARO)
#PARCELAS SUBDIVIDAS TOMATES HEIRLOM 
library  (ExpDes.pt)
#ANALISIS DE LAS VARIABLES AGRONOMICAS 
psub2.dbc(Genotipo, Acolchado, REP, DT, quali = c(TRUE, FALSE), mcomp = "tukey", fac.names = c("Genotipo", "Acolchado"), sigT = 0.05, sigF = 0.05)
## ------------------------------------------------------------------------
## Legenda:
## FATOR 1 (parcela):  Genotipo 
## FATOR 2 (subparcela):  Acolchado 
## ------------------------------------------------------------------------
## 
## ------------------------------------------------------------------------
## $`Quadro da analise de variancia\n------------------------------------------------------------------------\n`
##                    GL     SQ      QM     Fc  Pr(>Fc)    
## Genotipo            3 50.171 16.7238 47.176 0.000145 ***
## Bloco               2  1.742  0.8709  2.457 0.166184    
## Erro a              6  2.127  0.3545                    
## Acolchado           3  0.376  0.1253  0.508 0.680337    
## Genotipo*Acolchado  9  2.854  0.3171  1.286 0.294440    
## Erro b             24  5.917  0.2465                    
## Total              47 63.186                            
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------------
## CV 1 = 5.417681 %
## CV 2 = 4.517913 %
## 
## Interacao nao significativa: analisando os efeitos simples
## ------------------------------------------------------------------------
## Genotipo
## Teste de Tukey
## ------------------------------------------------------------------------
## Grupos Tratamentos Medias
## a     V   12.69453 
##  b    BR      10.84195 
##  b    E   10.356 
##  b    P   10.06716 
## ------------------------------------------------------------------------
## 
## Acolchado
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
## 
##   Niveis   Medias
## 1      B 10.98664
## 2      G 10.86950
## 3      N 11.11945
## 4     SA 10.98406
## ------------------------------------------------------------------------
psub2.dbc(Genotipo, Acolchado, REP, AP, quali = c(TRUE, FALSE), mcomp = "tukey", fac.names = c("Genotipo", "Acolchado"), sigT = 0.05, sigF = 0.05)
## ------------------------------------------------------------------------
## Legenda:
## FATOR 1 (parcela):  Genotipo 
## FATOR 2 (subparcela):  Acolchado 
## ------------------------------------------------------------------------
## 
## ------------------------------------------------------------------------
## $`Quadro da analise de variancia\n------------------------------------------------------------------------\n`
##                    GL     SQ      QM      Fc  Pr(>Fc)   
## Genotipo            3 5.0553 1.68509 16.3372 0.002719 **
## Bloco               2 0.2075 0.10377  1.0060 0.419967   
## Erro a              6 0.6189 0.10314                    
## Acolchado           3 0.0891 0.02969  0.3818 0.767024   
## Genotipo*Acolchado  9 0.2131 0.02368  0.3044 0.965988   
## Erro b             24 1.8666 0.07778                    
## Total              47 8.0504                            
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------------
## CV 1 = 11.42907 %
## CV 2 = 9.924465 %
## 
## Interacao nao significativa: analisando os efeitos simples
## ------------------------------------------------------------------------
## Genotipo
## Teste de Tukey
## ------------------------------------------------------------------------
## Grupos Tratamentos Medias
## a     E   3.186806 
## a     P   3.061806 
##  b    BR      2.591667 
##  b    V   2.399861 
## ------------------------------------------------------------------------
## 
## Acolchado
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
## 
##   Niveis   Medias
## 1      B 2.851250
## 2      G 2.853194
## 3      N 2.780139
## 4     SA 2.755556
## ------------------------------------------------------------------------
psub2.dbc(Genotipo, Acolchado, REP, Nfto, quali = c(TRUE, FALSE), mcomp = "tukey", fac.names = c("Genotipo", "Acolchado"), sigT = 0.05, sigF = 0.05)
## ------------------------------------------------------------------------
## Legenda:
## FATOR 1 (parcela):  Genotipo 
## FATOR 2 (subparcela):  Acolchado 
## ------------------------------------------------------------------------
## 
## ------------------------------------------------------------------------
## $`Quadro da analise de variancia\n------------------------------------------------------------------------\n`
##                    GL    SQ     QM     Fc Pr(>Fc)    
## Genotipo            3 24473 8157.8 85.472 2.6e-05 ***
## Bloco               2  1166  583.1  6.109 0.03572 *  
## Erro a              6   573   95.4                   
## Acolchado           3  1359  453.1  0.464 0.71006    
## Genotipo*Acolchado  9  2104  233.7  0.239 0.98461    
## Erro b             24 23434  976.4                   
## Total              47 53109                          
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------------
## CV 1 = 8.23712 %
## CV 2 = 26.34646 %
## 
## Interacao nao significativa: analisando os efeitos simples
## ------------------------------------------------------------------------
## Genotipo
## Teste de Tukey
## ------------------------------------------------------------------------
## Grupos Tratamentos Medias
## a     V   155.25 
##  b    BR      119.25 
##   c   E   100.5833 
##   c   P   99.33333 
## ------------------------------------------------------------------------
## 
## Acolchado
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
## 
##   Niveis   Medias
## 1      B 126.7500
## 2      G 111.8333
## 3      N 118.1667
## 4     SA 117.6667
## ------------------------------------------------------------------------
psub2.dbc(Genotipo, Acolchado, REP, ppf, quali = c(TRUE, FALSE), mcomp = "tukey", fac.names = c("Genotipo", "Acolchado"), sigT = 0.05, sigF = 0.05)
## ------------------------------------------------------------------------
## Legenda:
## FATOR 1 (parcela):  Genotipo 
## FATOR 2 (subparcela):  Acolchado 
## ------------------------------------------------------------------------
## 
## ------------------------------------------------------------------------
## $`Quadro da analise de variancia\n------------------------------------------------------------------------\n`
##                    GL    SQ      QM      Fc  Pr(>Fc)    
## Genotipo            3 45878 15292.6 27.1591 0.000687 ***
## Bloco               2   744   372.2  0.6609 0.550287    
## Erro a              6  3378   563.1                     
## Acolchado           3  2748   916.1  1.1238 0.359150    
## Genotipo*Acolchado  9  2963   329.2  0.4038 0.920673    
## Erro b             24 19564   815.2                     
## Total              47 75276                             
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------------
## CV 1 = 12.97673 %
## CV 2 = 15.6138 %
## 
## Interacao nao significativa: analisando os efeitos simples
## ------------------------------------------------------------------------
## Genotipo
## Teste de Tukey
## ------------------------------------------------------------------------
## Grupos Tratamentos Medias
## a     E   209.773 
## a     BR      197.2349 
## a     P   194.1511 
##  b    V   130.2794 
## ------------------------------------------------------------------------
## 
## Acolchado
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
## 
##   Niveis   Medias
## 1      B 195.4849
## 2      G 175.5065
## 3      N 179.3138
## 4     SA 181.1333
## ------------------------------------------------------------------------
psub2.dbc(Genotipo, Acolchado, REP, REND, quali = c(TRUE, FALSE), mcomp = "tukey", fac.names = c("Genotipo", "Acolchado"), sigT = 0.05, sigF = 0.05)
## ------------------------------------------------------------------------
## Legenda:
## FATOR 1 (parcela):  Genotipo 
## FATOR 2 (subparcela):  Acolchado 
## ------------------------------------------------------------------------
## 
## ------------------------------------------------------------------------
## $`Quadro da analise de variancia\n------------------------------------------------------------------------\n`
##                    GL      SQ     QM     Fc Pr(>Fc)  
## Genotipo            3  117.08 39.026 4.6962 0.05131 .
## Bloco               2   12.46  6.231 0.7499 0.51206  
## Erro a              6   49.86  8.310                 
## Acolchado           3  159.31 53.104 2.0396 0.13511  
## Genotipo*Acolchado  9   54.34  6.038 0.2319 0.98620  
## Erro b             24  624.87 26.036                 
## Total              47 1017.93                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------------
## CV 1 = 13.82144 %
## CV 2 = 24.46438 %
## 
## Interacao nao significativa: analisando os efeitos simples
## ------------------------------------------------------------------------
## Genotipo
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
##   Niveis   Medias
## 1     BR 23.35590
## 2      E 20.83957
## 3      P 19.15058
## 4      V 20.08247
## ------------------------------------------------------------------------
## Acolchado
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
## 
##   Niveis   Medias
## 1      B 23.82641
## 2      G 18.86742
## 3      N 20.26598
## 4     SA 20.46872
## ------------------------------------------------------------------------
psub2.dbc(Genotipo, Acolchado, REP, RP, quali = c(TRUE, FALSE), mcomp = "tukey", fac.names = c("Genotipo", "Acolchado"), sigT = 0.05, sigF = 0.05)
## ------------------------------------------------------------------------
## Legenda:
## FATOR 1 (parcela):  Genotipo 
## FATOR 2 (subparcela):  Acolchado 
## ------------------------------------------------------------------------
## 
## ------------------------------------------------------------------------
## $`Quadro da analise de variancia\n------------------------------------------------------------------------\n`
##                    GL      SQ      QM     Fc Pr(>Fc)  
## Genotipo            3  3.2522 1.08407 4.6961 0.05131 .
## Bloco               2  0.3462 0.17310 0.7499 0.51206  
## Erro a              6  1.3850 0.23084                 
## Acolchado           3  4.4253 1.47510 2.0396 0.13511  
## Genotipo*Acolchado  9  1.5095 0.16772 0.2319 0.98620  
## Erro b             24 17.3575 0.72323                 
## Total              47 28.2757                         
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## ------------------------------------------------------------------------
## CV 1 = 13.82144 %
## CV 2 = 24.46438 %
## 
## Interacao nao significativa: analisando os efeitos simples
## ------------------------------------------------------------------------
## Genotipo
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
##   Niveis   Medias
## 1     BR 3.892651
## 2      E 3.473262
## 3      P 3.191763
## 4      V 3.347079
## ------------------------------------------------------------------------
## Acolchado
## De acordo com o teste F, as medias desse fator sao estatisticamente iguais.
## 
##   Niveis   Medias
## 1      B 3.971069
## 2      G 3.144569
## 3      N 3.377663
## 4     SA 3.411454
## ------------------------------------------------------------------------
#MULTIVARIADO BIPLOT ACOLCHADO BLANCO
BLC <- read.delim("~/R/BLC.txt")
## Warning in read.table(file = file, header = header, sep = sep, quote =
## quote, : incomplete final line found by readTableHeader on '~/R/BLC.txt'
attach (BLC)
## The following objects are masked from ALVARO:
## 
##     Acolchado, AP, DT, Genotipo, HR, REND, TEMP
data <- BLC
cor(BLC[,3:9])
##              DT         AP           NF        PPF         REND       TEMP
## DT    1.0000000 -0.7183364  0.975990995 -0.8513627  0.104773255 -0.6321726
## AP   -0.7183364  1.0000000 -0.760565753  0.5799985 -0.517049602  0.3506701
## NF    0.9759910 -0.7605658  1.000000000 -0.9317390  0.003223192 -0.4519454
## PPF  -0.8513627  0.5799985 -0.931739000  1.0000000  0.339594274  0.1475469
## REND  0.1047733 -0.5170496  0.003223192  0.3395943  1.000000000 -0.5538056
## TEMP -0.6321726  0.3506701 -0.451945384  0.1475469 -0.553805631  1.0000000
## HR    0.6795609 -0.2051140  0.506166908 -0.2779735  0.280066571 -0.9543120
##              HR
## DT    0.6795609
## AP   -0.2051140
## NF    0.5061669
## PPF  -0.2779735
## REND  0.2800666
## TEMP -0.9543120
## HR    1.0000000
PCs <- prcomp(data [,3:9],scale=T)
summary(PCs)
## Importance of components:
##                          PC1    PC2    PC3       PC4
## Standard deviation     2.034 1.3462 1.0251 3.392e-16
## Proportion of Variance 0.591 0.2589 0.1501 0.000e+00
## Cumulative Proportion  0.591 0.8499 1.0000 1.000e+00
PCs
## Standard deviations:
## [1] 2.033995e+00 1.346151e+00 1.025057e+00 3.391787e-16
## 
## Rotation:
##             PC1         PC2         PC3         PC4
## DT    0.4843762 -0.11808698  0.06227491 -0.01554998
## AP   -0.3766977  0.02076069  0.62629969  0.25883904
## NF    0.4615796 -0.25314219 -0.04816137  0.00292791
## PPF  -0.3721549  0.48496970 -0.02770328 -0.27894872
## REND  0.1331571  0.60298145 -0.50482656  0.45607828
## TEMP -0.3558650 -0.46494920 -0.28330264  0.64850805
## HR    0.3571455  0.32647126  0.51543506  0.47578303
#Vectores de carga
PCs$rotation
##             PC1         PC2         PC3         PC4
## DT    0.4843762 -0.11808698  0.06227491 -0.01554998
## AP   -0.3766977  0.02076069  0.62629969  0.25883904
## NF    0.4615796 -0.25314219 -0.04816137  0.00292791
## PPF  -0.3721549  0.48496970 -0.02770328 -0.27894872
## REND  0.1331571  0.60298145 -0.50482656  0.45607828
## TEMP -0.3558650 -0.46494920 -0.28330264  0.64850805
## HR    0.3571455  0.32647126  0.51543506  0.47578303
#Despliegue los primeros renglones de los vectores de récords

head(PCs$x)
##             PC1        PC2        PC3           PC4
## [1,] -0.3199878  0.4652248 -1.4875032 -5.551115e-17
## [2,] -0.6854891  1.6116453  0.8595050  3.386180e-15
## [3,] -1.8777683 -1.5210537  0.3565363 -2.220446e-15
## [4,]  2.8832452 -0.5558164  0.2714619  1.110223e-16
#Grafica con los porcentajes de varianzas explicadas para los componentes
PCs_var <- PCs$sdev^2
porc_var <- PCs_var/(sum(PCs_var))
plot(porc_var,main="%de varianzas",col="salmon4", xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

porc_var_acum <- cumsum(porc_var)
#Grafica con los porcentajes acumulados de varianzas explicadas
porc_var_acum <- cumsum(porc_var)
plot(porc_var_acum,main="% acumulados de Varianzas",col="tomato4",xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

# Construccion del biplot

biplot (PCs, col=c("black","blue"), xlab="PC1 (59.10 %)",ylab="PC2 (25.89 %)", cex= c(1,.8))
abline(h=0, v=0 , col="black",cex= c(1,.7))

#MULTIVARIADO BIPLOT ACOLCHADO GRIS
GRIS <- read.delim("~/R/GRIS.txt")
## Warning in read.table(file = file, header = header, sep = sep, quote =
## quote, : incomplete final line found by readTableHeader on '~/R/GRIS.txt'
attach (GRIS)
## The following objects are masked from BLC:
## 
##     Acolchado, AP, DT, Genotipo, HR, NF, PPF, REND, TEMP
## 
## The following objects are masked from ALVARO:
## 
##     Acolchado, AP, DT, Genotipo, HR, REND, TEMP
data <- GRIS
cor(GRIS[,3:9])
##              DT         AP         NF        PPF       REND       TEMP
## DT    1.0000000 -0.8471964  0.9956653 -0.9696208  0.3613849 -0.5907301
## AP   -0.8471964  1.0000000 -0.8926072  0.7477128 -0.6603103  0.2014117
## NF    0.9956653 -0.8926072  1.0000000 -0.9547572  0.4143993 -0.5299562
## PPF  -0.9696208  0.7477128 -0.9547572  1.0000000 -0.1265627  0.5344825
## REND  0.3613849 -0.6603103  0.4143993 -0.1265627  1.0000000 -0.2151588
## TEMP -0.5907301  0.2014117 -0.5299562  0.5344825 -0.2151588  1.0000000
## HR    0.3876257  0.1294500  0.3028137 -0.4295621 -0.2210233 -0.9032437
##              HR
## DT    0.3876257
## AP    0.1294500
## NF    0.3028137
## PPF  -0.4295621
## REND -0.2210233
## TEMP -0.9032437
## HR    1.0000000
PCs <- prcomp(data [,3:9],scale=T)
summary(PCs)
## Importance of components:
##                           PC1    PC2    PC3       PC4
## Standard deviation     2.0861 1.3540 0.9027 1.458e-15
## Proportion of Variance 0.6217 0.2619 0.1164 0.000e+00
## Cumulative Proportion  0.6217 0.8836 1.0000 1.000e+00
PCs
## Standard deviations:
## [1] 2.086065e+00 1.354045e+00 9.027166e-01 1.458159e-15
## 
## Rotation:
##             PC1         PC2         PC3         PC4
## DT    0.4743397 -0.02602200  0.15525288  0.29770296
## AP   -0.3979507  0.41046982 -0.04881665  0.52598094
## NF    0.4708640 -0.09454008  0.15185904  0.27140906
## PPF  -0.4470768 -0.05588716 -0.39082810  0.10060470
## REND  0.2114247 -0.43083173 -0.75552948 -0.08379719
## TEMP -0.3241680 -0.45461760  0.44830515 -0.41109770
## HR    0.2127467  0.65305669 -0.16094532 -0.61229856
#Vectores de carga
PCs$rotation
##             PC1         PC2         PC3         PC4
## DT    0.4743397 -0.02602200  0.15525288  0.29770296
## AP   -0.3979507  0.41046982 -0.04881665  0.52598094
## NF    0.4708640 -0.09454008  0.15185904  0.27140906
## PPF  -0.4470768 -0.05588716 -0.39082810  0.10060470
## REND  0.2114247 -0.43083173 -0.75552948 -0.08379719
## TEMP -0.3241680 -0.45461760  0.44830515 -0.41109770
## HR    0.2127467  0.65305669 -0.16094532 -0.61229856
#Despliegue los primeros renglones de los vectores de récords

head(PCs$x)
##              PC1          PC2        PC3           PC4
## [1,]  0.04061678 -1.467631150 -0.9358740  1.110223e-16
## [2,] -0.41458645  1.798086802 -0.6035956 -6.661338e-16
## [3,] -2.34397722 -0.336479518  0.8685288  1.609823e-14
## [4,]  2.71794689  0.006023865  0.6709408 -1.110223e-14
#Grafica con los porcentajes de varianzas explicadas para los componentes
PCs_var <- PCs$sdev^2
porc_var <- PCs_var/(sum(PCs_var))
plot(porc_var,main="%de varianzas",col="salmon4", xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

porc_var_acum <- cumsum(porc_var)

#Grafica con los porcentajes acumulados de varianzas explicadas
porc_var_acum <- cumsum(porc_var)
plot(porc_var_acum,main="% acumulados de Varianzas",col="tomato4",xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

# Construccion del biplot

biplot (PCs, col=c("black","blue"), xlab="PC1 (62.17 %)",ylab="PC2 (26.19 %)", cex= c(1,.8))
abline(h=0, v=0 , col="black",cex= c(1,.7))

#MULTIVARIADO BIPLOT ACOLCHADO SIN ACOLCHAR
SA <- read.delim("~/R/SA.txt")
## Warning in read.table(file = file, header = header, sep = sep, quote =
## quote, : incomplete final line found by readTableHeader on '~/R/SA.txt'
attach (SA)
## The following objects are masked from GRIS:
## 
##     Acolchado, AP, DT, Genotipo, HR, NF, PPF, REND, TEMP
## 
## The following objects are masked from BLC:
## 
##     Acolchado, AP, DT, Genotipo, HR, NF, PPF, REND, TEMP
## 
## The following objects are masked from ALVARO:
## 
##     Acolchado, AP, DT, Genotipo, HR, REND, TEMP
data <- SA
cor(SA[,3:9])
##              DT         AP         NF        PPF       REND       TEMP
## DT    1.0000000 -0.9380604  0.9497552 -0.9475164 -0.6913257  0.8304548
## AP   -0.9380604  1.0000000 -0.9646288  0.9531898  0.6487132 -0.8092101
## NF    0.9497552 -0.9646288  1.0000000 -0.8796825 -0.4908226  0.9335980
## PPF  -0.9475164  0.9531898 -0.8796825  1.0000000  0.8431598 -0.6598887
## REND -0.6913257  0.6487132 -0.4908226  0.8431598  1.0000000 -0.1766038
## TEMP  0.8304548 -0.8092101  0.9335980 -0.6598887 -0.1766038  1.0000000
## HR   -0.8273134  0.8156136 -0.9363083  0.6619784  0.1745955 -0.9996309
##              HR
## DT   -0.8273134
## AP    0.8156136
## NF   -0.9363083
## PPF   0.6619784
## REND  0.1745955
## TEMP -0.9996309
## HR    1.0000000
PCs <- prcomp(data [,3:9],scale=T)
summary(PCs)
## Importance of components:
##                           PC1    PC2     PC3       PC4
## Standard deviation     2.3887 1.1021 0.28173 3.348e-15
## Proportion of Variance 0.8152 0.1735 0.01134 0.000e+00
## Cumulative Proportion  0.8152 0.9887 1.00000 1.000e+00
PCs
## Standard deviations:
## [1] 2.388737e+00 1.102073e+00 2.817279e-01 3.347941e-15
## 
## Rotation:
##             PC1         PC2        PC3         PC4
## DT   -0.4117170  0.08550980  0.5485071 -0.25053542
## AP    0.4091054 -0.07128118  0.6993636 -0.02321038
## NF   -0.4136025 -0.13159272 -0.1894409 -0.23699621
## PPF   0.3927272 -0.31118704  0.1706675  0.08651300
## REND  0.2578620 -0.71153763 -0.2672876 -0.27496856
## TEMP -0.3680845 -0.42807625  0.2338076 -0.38592919
## HR    0.3685665  0.42885660 -0.1375016 -0.80529034
#Vectores de carga
PCs$rotation
##             PC1         PC2        PC3         PC4
## DT   -0.4117170  0.08550980  0.5485071 -0.25053542
## AP    0.4091054 -0.07128118  0.6993636 -0.02321038
## NF   -0.4136025 -0.13159272 -0.1894409 -0.23699621
## PPF   0.3927272 -0.31118704  0.1706675  0.08651300
## REND  0.2578620 -0.71153763 -0.2672876 -0.27496856
## TEMP -0.3680845 -0.42807625  0.2338076 -0.38592919
## HR    0.3685665  0.42885660 -0.1375016 -0.80529034
#Despliegue los primeros renglones de los vectores de récords

head(PCs$x)
##             PC1        PC2        PC3          PC4
## [1,] -0.5843991 -1.4193623 -0.2053826 2.997602e-15
## [2,]  1.9603343 -0.2952514  0.3455905 2.775558e-15
## [3,]  1.7602112  1.0470226 -0.2526798 2.886580e-15
## [4,] -3.1361464  0.6675911  0.1124719 2.886580e-15
#Grafica con los porcentajes de varianzas explicadas para los componentes
PCs_var <- PCs$sdev^2
porc_var <- PCs_var/(sum(PCs_var))
plot(porc_var,main="%de varianzas",col="salmon4", xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

porc_var_acum <- cumsum(porc_var)

#Grafica con los porcentajes acumulados de varianzas explicadas
porc_var_acum <- cumsum(porc_var)
plot(porc_var_acum,main="% acumulados de Varianzas",col="tomato4",xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

# Construccion del biplot

biplot (PCs, col=c("black","blue"), xlab="PC1 (81.52 %)",ylab="PC2 (17.35 %)", cex= c(1,.8))
abline(h=0, v=0 , col="black",cex= c(1,.7))

#MULTIVARIADO BIPLOT ACOLCHADO NEGRO
NEGRO <- read.delim("~/R/NEGRO.txt")
## Warning in read.table(file = file, header = header, sep = sep, quote =
## quote, : incomplete final line found by readTableHeader on '~/R/NEGRO.txt'
attach (NEGRO)
## The following objects are masked from SA:
## 
##     Acolchado, AP, DT, Genotipo, HR, NF, PPF, REND, TEMP
## 
## The following objects are masked from GRIS:
## 
##     Acolchado, AP, DT, Genotipo, HR, NF, PPF, REND, TEMP
## 
## The following objects are masked from BLC:
## 
##     Acolchado, AP, DT, Genotipo, HR, NF, PPF, REND, TEMP
## 
## The following objects are masked from ALVARO:
## 
##     Acolchado, AP, DT, Genotipo, HR, REND, TEMP
data <- NEGRO
cor(NEGRO[,3:9])
##               DT         AP          NF         PPF        REND       TEMP
## DT    1.00000000 -0.8661857  0.99961681 -0.92321839  0.34936702 -0.1822574
## AP   -0.86618571  1.0000000 -0.87800112  0.66627660 -0.70362790 -0.3005973
## NF    0.99961681 -0.8780011  1.00000000 -0.91271525  0.37514512 -0.1645695
## PPF  -0.92321839  0.6662766 -0.91271525  1.00000000  0.02538596  0.3154172
## REND  0.34936702 -0.7036279  0.37514512  0.02538596  1.00000000  0.5014645
## TEMP -0.18225738 -0.3005973 -0.16456952  0.31541722  0.50146452  1.0000000
## HR    0.01669306  0.4644307 -0.00283108 -0.19239225 -0.62520851 -0.9831173
##               HR
## DT    0.01669306
## AP    0.46443068
## NF   -0.00283108
## PPF  -0.19239225
## REND -0.62520851
## TEMP -0.98311729
## HR    1.00000000
PCs <- prcomp(data [,3:9],scale=T)
summary(PCs)
## Importance of components:
##                          PC1    PC2     PC3      PC4
## Standard deviation     1.960 1.6275 0.71320 6.57e-16
## Proportion of Variance 0.549 0.3784 0.07266 0.00e+00
## Cumulative Proportion  0.549 0.9273 1.00000 1.00e+00
PCs
## Standard deviations:
## [1] 1.960290e+00 1.627455e+00 7.131986e-01 6.570123e-16
## 
## Rotation:
##              PC1        PC2          PC3        PC4
## DT   -0.49157248  0.1641936 -0.006584516 -0.3684095
## AP    0.49385511  0.1530823 -0.037507580 -0.3371108
## NF   -0.49461406  0.1502598  0.014051407  0.2462420
## PPF   0.41915679 -0.2990323  0.415988779  0.1980571
## REND -0.27808317 -0.3988085  0.744034473 -0.2380893
## TEMP -0.03752098 -0.5852628 -0.414413002 -0.5753087
## HR    0.12405677  0.5796785  0.316196593 -0.5129351
#Vectores de carga
PCs$rotation
##              PC1        PC2          PC3        PC4
## DT   -0.49157248  0.1641936 -0.006584516 -0.3684095
## AP    0.49385511  0.1530823 -0.037507580 -0.3371108
## NF   -0.49461406  0.1502598  0.014051407  0.2462420
## PPF   0.41915679 -0.2990323  0.415988779  0.1980571
## REND -0.27808317 -0.3988085  0.744034473 -0.2380893
## TEMP -0.03752098 -0.5852628 -0.414413002 -0.5753087
## HR    0.12405677  0.5796785  0.316196593 -0.5129351
#Despliegue los primeros renglones de los vectores de récords

head(PCs$x)
##             PC1        PC2        PC3           PC4
## [1,] -0.5665487 -2.0913297  0.5118996  5.551115e-16
## [2,]  1.9233982  1.3148341  0.5681332 -1.110223e-16
## [3,]  1.1364106 -0.4897921 -0.9630441  2.775558e-15
## [4,] -2.4932602  1.2662877 -0.1169887 -6.661338e-16
#Grafica con los porcentajes de varianzas explicadas para los componentes
PCs_var <- PCs$sdev^2
porc_var <- PCs_var/(sum(PCs_var))
plot(porc_var,main="%de varianzas",col="salmon4", xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

porc_var_acum <- cumsum(porc_var)

#Grafica con los porcentajes acumulados de varianzas explicadas
porc_var_acum <- cumsum(porc_var)
plot(porc_var_acum,main="% acumulados de Varianzas",col="tomato4",xlab="PC's",ylab="% varianzas PC's",type="b",lwd=2)

# Construccion del biplot

biplot (PCs, col=c("black","blue"), xlab="PC1 (54.90 %)",ylab="PC2 (37.84 %)", cex= c(1,.8))
abline(h=0, v=0 , col="black",cex= c(1,.7))