> #abrimos el archivo, leeremos en Yeso > Yeso<-read.table(file.choose()) > Yeso V1 V2 1 1 51 2 1 64 3 1 70 4 5 1 78 6 1 55 7 1 67 8 1 75 9 1 82 10 1 61 11 1 53 12 1 60 13 1 62 14 1 83 15 1 77 16 1 90 17 1 85 18 1 60 19 1 70 20 1 58 21 1 40 22 1 61 23 1 66 24 1 37 25 1 54 26 1 77 27 1 75 28 1 57 29 1 85 30 1 82 31 2 30 32 2 51 33 2 68 34 2 45 35 2 56 36 2 49 37 2 42 38 2 50 39 2 72 40 2 45 41 2 53 42 2 47 43 2 57 44 2 83 45 2 54 46 2 50 47 2 64 48 2 65 49 2 46 50 2 68 51 2 33 52 2 52 53 2 52 54 2 42 55 2 42 56 2 66 57 2 58 58 2 44 59 2 71 60 2 39 61 3 39 62 3 54 63 3 69 64 3 47 65 3 66 66 3 44 67 3 56 68 3 55 69 3 67 70 3 47 71 3 58 72 3 39 73 3 42 74 3 45 75 3 72 76 3 72 77 3 69 78 3 75 79 3 57 80 3 54 81 3 34 82 3 62 83 3 50 84 3 58 85 3 48 86 3 63 87 3 74 88 3 45 89 3 71 90 3 59 91 4 92 92 4 73 93 4 86 94 4 83 95 4 49 96 4 68 97 4 66 98 4 83 99 4 80 100 4 67 101 4 74 102 4 63 103 4 77 104 4 77 105 4 54 106 4 79 107 4 80 108 4 85 109 4 78 110 4 64 111 4 80 112 4 80 113 4 57 114 4 75 115 4 76 116 4 78 117 4 83 118 4 74 119 4 78 120 4 84 > > #damos nombres a las variables > names(Yeso)=c("Variedad","Tiempo") > Yeso Variedad Tiempo 1 1 51 2 1 64 3 1 70 4 1 63 5 1 78 6 1 55 7 1 67 8 1 75 9 1 82 10 1 61 11 1 53 12 1 60 13 1 62 14 1 83 15 1 77 16 1 90 17 1 85 18 1 60 19 1 70 20 1 58 21 1 40 22 1 61 23 1 66 24 1 37 25 1 54 26 1 77 27 1 75 28 1 57 29 1 85 30 1 82 31 2 30 32 2 51 33 2 68 34 2 45 35 2 56 36 2 49 37 2 42 38 2 50 39 2 72 40 2 45 41 2 53 42 2 47 43 2 57 44 2 83 45 2 54 46 2 50 47 2 64 48 2 65 49 2 46 50 2 68 51 2 33 52 2 52 53 2 52 54 2 42 55 2 42 56 2 66 57 2 58 58 2 44 59 2 71 60 2 39 61 3 39 62 3 54 63 3 69 64 3 47 65 3 66 66 3 44 67 3 56 68 3 55 69 3 67 70 3 47 71 3 58 72 3 39 73 3 42 74 3 45 75 3 72 76 3 72 77 3 69 78 3 75 79 3 57 80 3 54 81 3 34 82 3 62 83 3 50 84 3 58 85 3 48 86 3 63 87 3 74 88 3 45 89 3 71 90 3 59 91 4 92 92 4 73 93 4 86 94 4 83 95 4 49 96 4 68 97 4 66 98 4 83 99 4 80 100 4 67 101 4 74 102 4 63 103 4 77 104 4 77 105 4 54 106 4 79 107 4 80 108 4 85 109 4 78 110 4 64 111 4 80 112 4 80 113 4 57 114 4 75 115 4 76 116 4 78 117 4 83 118 4 74 119 4 78 120 4 84 > > attach(Yeso) > > Variedad=factor(Variedad) > is.factor(Variedad) [1] TRUE > > boxplot(Tiempo~Variedad) > > #realizamos Anova y vemos la tabla > AOYeso <- aov(Tiempo~Variedad) > > summary(AOYeso) Df Sum Sq Mean Sq F value Pr(>F) Variedad 3 8773.4 2924.46 20.790 7.537e-11 *** Residuals 116 16317.0 140.66 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 > > #obtenemos la tabla de las medias > > print(model.tables(AOYeso,"means"),digits=3) Tables of means Grand mean 62.71667 Variedad Variedad 1 2 3 4 66.6 53.1 56.4 74.8 > > #los graficos correspondientes > plot(AOYeso); Esperando para confirmar cambio de página... (aquí se ven los gráficos) > > #comparaciones multiples > > AoYesoTukey=TukeyHSD(AOYeso,"Variedad",ordered = FALSE, conf.level = 0.95) > AoYesoTukey Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov(formula = Tiempo ~ Variedad) $Variedad diff lwr upr p adj 2-1 -13.466667 -21.4490163 -5.484317 0.0001421 3-1 -10.233333 -18.2156830 -2.250984 0.0060887 4-1 8.166667 0.1843170 16.149016 0.0428500 3-2 3.233333 -4.7490163 11.215683 0.7169133 4-2 21.633333 13.6509837 29.615683 0.0000000 4-3 18.400000 10.4176504 26.382350 0.0000001 > plot(AoYesoTukey) > > #probamos sin poner algunas variables > > AoYesoTukey=TukeyHSD(AOYeso,conf.level = 0.95) > AoYesoTukey Tukey multiple comparisons of means 95% family-wise confidence level Fit: aov(formula = Tiempo ~ Variedad) $Variedad diff lwr upr p adj 2-1 -13.466667 -21.4490163 -5.484317 0.0001421 3-1 -10.233333 -18.2156830 -2.250984 0.0060887 4-1 8.166667 0.1843170 16.149016 0.0428500 3-2 3.233333 -4.7490163 11.215683 0.7169133 4-2 21.633333 13.6509837 29.615683 0.0000000 4-3 18.400000 10.4176504 26.382350 0.0000001 > > #ahora vemos los intervalos de confianza usando Bonferroni > AoYesoBonf=pairwise.t.test(Tiempo,Variedad,p.adj="bonf") > AoYesoBonf Pairwise comparisons using t tests with pooled SD data: Tiempo and Variedad 1 2 3 2 0.00015 - - 3 0.00673 1.00000 - 4 0.05250 7.7e-10 1.3e-07 P value adjustment method: bonferroni > > alfa<-0.05/(2*6);alfa [1] 0.004166667 > > alfaest<-0.05/6 > alfaest [1] 0.008333333 > > #miro los p-valores de la tabla y rechazo cuando los p-valores son menores que el nivel de significación de los #test simultáneos > #1-2 rechazo > #1-3 no rechazo > #1-4 rechazo > #2-3 no rechazo > #2-4 rechazo > #3-4 rechazo > #grupos de medias > #A : 1 y 3 > #B : 3 y 2 > #C : 4 > > > p<-1-alfaest/2;p [1] 0.9958333 > t<-qt(p,116);t [1] 2.684257 > > > > qtt<-qtukey(.95,4,116); > qtt [1] 3.686381 > qtt/sqrt(2) [1] 2.606665 > > #Para tener la info de medias y desvios > tapply(Tiempo,Variedad,mean) 1 2 3 4 66.60000 53.13333 56.36667 74.76667 > tapply(Tiempo,Variedad,sd) 1 2 3 4 13.314757 12.235430 11.737013 9.894908 > > #Normalidad > qqnorm(resid(AOYeso)) > shapiro.test(resid(AOYeso)) Shapiro-Wilk normality test data: resid(AOYeso) W = 0.9921, p-value = 0.7312 > > #Test de Levene > > med<-tapply(Tiempo,Variedad,median) > med 1 2 3 4 65.0 51.5 56.5 77.5 > > desv<- abs(Tiempo-med[Variedad]) > desv 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14.0 1.0 5.0 2.0 13.0 10.0 2.0 10.0 17.0 4.0 12.0 5.0 3.0 18.0 12.0 25.0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 20.0 5.0 5.0 7.0 25.0 4.0 1.0 28.0 11.0 12.0 10.0 8.0 20.0 17.0 21.5 0.5 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 16.5 6.5 4.5 2.5 9.5 1.5 20.5 6.5 1.5 4.5 5.5 31.5 2.5 1.5 12.5 13.5 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 5.5 16.5 18.5 0.5 0.5 9.5 9.5 14.5 6.5 7.5 19.5 12.5 17.5 2.5 12.5 9.5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 9.5 12.5 0.5 1.5 10.5 9.5 1.5 17.5 14.5 11.5 15.5 15.5 12.5 18.5 0.5 2.5 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 22.5 5.5 6.5 1.5 8.5 6.5 17.5 11.5 14.5 2.5 14.5 4.5 8.5 5.5 28.5 9.5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 11.5 5.5 2.5 10.5 3.5 14.5 0.5 0.5 23.5 1.5 2.5 7.5 0.5 13.5 2.5 2.5 4 4 4 4 4 4 4 4 20.5 2.5 1.5 0.5 5.5 3.5 0.5 6.5 > summary(aov(desv~Variedad)) Df Sum Sq Mean Sq F value Pr(>F) Variedad 3 217.5 72.500 1.3867 0.2504 Residuals 116 6065.0 52.284 >