0% found this document useful (0 votes)
12 views11 pages

DBCA

Uploaded by

Nilton Lp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views11 pages

DBCA

Uploaded by

Nilton Lp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

EJEMPLO

DBA <- read.table("https://archive.org/download/byrong_DBA1/DBA1.txt",header=T,


sep="\t", dec=",")
DBA

## Material Bloque Altura DAP Volumen


## 1 CA-30 I 5.09 5.41 6.64
## 2 1214 I 4.93 5.76 9.81
## 3 1203 I 4.8 5.76 9.77
## 4 1084 I 4.36 5.65 4.99
## 5 1198 I 5.4 7.0 5.76
## 6 1197 I 4.85 6.35 8.14
## 7 1066 I 4.17 4.51 2.43
## 8 1846 I 4.93 6.24 11.07
## 9 PE-11 I 4.25 4.58 4.0
## 10 Urophylla I 3.93 4.75 6.38
## 11 1188 I 4.12 3.03 3.01
## 12 Camal I 3.12 3.42 2.95
## 13 CA-30 II 4.88 5.97 8.27
## 14 1214 II 4.78 5.33 6.16
## 15 1203 II 3.63 4.81 4.43
## 16 1084 II 4.82 6.75 13.28
## 17 1198 II 4.23 6.18 9.5
## 18 1197 II 3.94 5.07 3.47
## 19 1066 II 4.5 5.51 8.36
## 20 1846 II 3.8 4.54 3.36
## 21 PE-11 II 3.9 5.24 6.69
## 22 Urophylla II 3.62 4.81 3.87
## 23 1188 II 3.14 3.24 1.95
## 24 Camal II 2.79 3.48 2.0
## 25 CA-30 III 3.71 5.29 5.36
## 26 1214 III 3.93 5.25 6.91
## 27 1203 III 4.46 6.02 9.28
## 28 1084 III 3.54 5.05 5.03
## 29 1198 III 3.06 4.19 3.46
## 30 1197 III 3.2 4.05 2.66
## 31 1066 III 3.27 5.08 4.48
## 32 1846 III 3.14 4.26 2.91
## 33 PE-11 III 3.42 4.89 4.78
## 34 Urophylla III 3.63 4.63 5.25
## 35 1188 III 3.17 4.28 3.68
## 36 Camal III 3.68 4.76 4.28

attach(DBA)
#Se crea un objeto tipo factor TRB con la columna Material (tratamientos)
TRB<- factor(Material)
BLOQ<-factor(Bloque)
ALT<-as.numeric(as.vector(Altura))
boxplot(split(ALT,TRB),xlab="Clones de eucalipto", ylab="Altura en metros")

#Analisis de varianza
euc.lm <- lm(ALT ~ TRB + BLOQ)
anova(euc.lm)

## Analysis of Variance Table


##
## Response: ALT
## Df Sum Sq Mean Sq F value Pr(>F)
## TRB 11 5.4822 0.49838 1.994 0.0810671 .
## BLOQ 2 5.7430 2.87148 11.489 0.0003834 ***
## Residuals 22 5.4986 0.24994
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

#Evaluación de los Supuestos del modelo estadístico


par(mfrow=c(2,2))
plot(euc.lm)
#Normalidad
library(nortest)
lillie.test(residuals(euc.lm))

##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: residuals(euc.lm)
## D = 0.11536, p-value = 0.2617

#Prueba de homocedasticidad (homogeneidad de las varianzas)


library(car)

## Warning: package 'car' was built under R version 4.0.4

## Loading required package: carData

leveneTest(ALT~TRB, center = "median")

## Levene's Test for Homogeneity of Variance (center = "median")


## Df F value Pr(>F)
## group 11 0.4147 0.9351
## 24

leveneTest(ALT~TRB, center = "mean")

## Levene's Test for Homogeneity of Variance (center = "mean")


## Df F value Pr(>F)
## group 11 0.7938 0.6446
## 24

#Independencia
library(zoo)

## Warning: package 'zoo' was built under R version 4.0.4

##
## Attaching package: 'zoo'

## The following objects are masked from 'package:base':


##
## as.Date, as.Date.numeric
library(lmtest)

## Warning: package 'lmtest' was built under R version 4.0.4

dwtest(euc.lm)

##
## Durbin-Watson test
##
## data: euc.lm
## DW = 1.9378, p-value = 0.3334
## alternative hypothesis: true autocorrelation is greater than 0

#Pruebas de comparación múltiple de medias


library(agricolae) #instalar previamente la libreria agricolae
Grupos <- LSD.test(y = euc.lm, trt = "TRB", group = T, console = T)

##
## Study: euc.lm ~ "TRB"
##
## LSD t Test for ALT
##
## Mean Square Error: 0.2499354
##
## TRB, means and individual ( 95 %) CI
##
## ALT std r LCL UCL Min Max
## 1066 3.980000 0.6366318 3 3.381402 4.578598 3.27 4.50
## 1084 4.240000 0.6483826 3 3.641402 4.838598 3.54 4.82
## 1188 3.476667 0.5573449 3 2.878068 4.075265 3.14 4.12
## 1197 3.996667 0.8264583 3 3.398068 4.595265 3.20 4.85
## 1198 4.230000 1.1700000 3 3.631402 4.828598 3.06 5.40
## 1203 4.296667 0.6018582 3 3.698068 4.895265 3.63 4.80
## 1214 4.546667 0.5392897 3 3.948068 5.145265 3.93 4.93
## 1846 3.956667 0.9052256 3 3.358068 4.555265 3.14 4.93
## CA-30 4.560000 0.7435725 3 3.961402 5.158598 3.71 5.09
## Camal 3.196667 0.4499259 3 2.598068 3.795265 2.79 3.68
## PE-11 3.856667 0.4166933 3 3.258068 4.455265 3.42 4.25
## Urophylla 3.726667 0.1761628 3 3.128068 4.325265 3.62 3.93
##
## Alpha: 0.05 ; DF Error: 22
## Critical Value of t: 2.073873
##
## least Significant Difference: 0.8465457
##
## Treatments with the same letter are not significantly different.
##
## ALT groups
## CA-30 4.560000 a
## 1214 4.546667 a
## 1203 4.296667 ab
## 1084 4.240000 ab
## 1198 4.230000 ab
## 1197 3.996667 abc
## 1066 3.980000 abc
## 1846 3.956667 abc
## PE-11 3.856667 abc
## Urophylla 3.726667 abc
## 1188 3.476667 bc
## Camal 3.196667 c

Grupos <- LSD.test(y = euc.lm, trt = "TRB", group = F, console = T)

##
## Study: euc.lm ~ "TRB"
##
## LSD t Test for ALT
##
## Mean Square Error: 0.2499354
##
## TRB, means and individual ( 95 %) CI
##
## ALT std r LCL UCL Min Max
## 1066 3.980000 0.6366318 3 3.381402 4.578598 3.27 4.50
## 1084 4.240000 0.6483826 3 3.641402 4.838598 3.54 4.82
## 1188 3.476667 0.5573449 3 2.878068 4.075265 3.14 4.12
## 1197 3.996667 0.8264583 3 3.398068 4.595265 3.20 4.85
## 1198 4.230000 1.1700000 3 3.631402 4.828598 3.06 5.40
## 1203 4.296667 0.6018582 3 3.698068 4.895265 3.63 4.80
## 1214 4.546667 0.5392897 3 3.948068 5.145265 3.93 4.93
## 1846 3.956667 0.9052256 3 3.358068 4.555265 3.14 4.93
## CA-30 4.560000 0.7435725 3 3.961402 5.158598 3.71 5.09
## Camal 3.196667 0.4499259 3 2.598068 3.795265 2.79 3.68
## PE-11 3.856667 0.4166933 3 3.258068 4.455265 3.42 4.25
## Urophylla 3.726667 0.1761628 3 3.128068 4.325265 3.62 3.93
##
## Alpha: 0.05 ; DF Error: 22
## Critical Value of t: 2.073873
##
## Comparison between treatments means
##
## difference pvalue signif. LCL UCL
## 1066 - 1084 -0.26000000 0.5307 -1.10654566 0.58654566
## 1066 - 1188 0.50333333 0.2306 -0.34321233 1.34987899
## 1066 - 1197 -0.01666667 0.9678 -0.86321233 0.82987899
## 1066 - 1198 -0.25000000 0.5465 -1.09654566 0.59654566
## 1066 - 1203 -0.31666667 0.4461 -1.16321233 0.52987899
## 1066 - 1214 -0.56666667 0.1790 -1.41321233 0.27987899
## 1066 - 1846 0.02333333 0.9549 -0.82321233 0.86987899
## 1066 - CA-30 -0.58000000 0.1694 -1.42654566 0.26654566
## 1066 - Camal 0.78333333 0.0680 . -0.06321233 1.62987899
## 1066 - PE-11 0.12333333 0.7654 -0.72321233 0.96987899
## 1066 - Urophylla 0.25333333 0.5412 -0.59321233 1.09987899
## 1084 - 1188 0.76333333 0.0748 . -0.08321233 1.60987899
## 1084 - 1197 0.24333333 0.5572 -0.60321233 1.08987899
## 1084 - 1198 0.01000000 0.9807 -0.83654566 0.85654566
## 1084 - 1203 -0.05666667 0.8909 -0.90321233 0.78987899
## 1084 - 1214 -0.30666667 0.4604 -1.15321233 0.53987899
## 1084 - 1846 0.28333333 0.4949 -0.56321233 1.12987899
## 1084 - CA-30 -0.32000000 0.4414 -1.16654566 0.52654566
## 1084 - Camal 1.04333333 0.0180 * 0.19678767 1.88987899
## 1084 - PE-11 0.38333333 0.3579 -0.46321233 1.22987899
## 1084 - Urophylla 0.51333333 0.2217 -0.33321233 1.35987899
## 1188 - 1197 -0.52000000 0.2160 -1.36654566 0.32654566
## 1188 - 1198 -0.75333333 0.0785 . -1.59987899 0.09321233
## 1188 - 1203 -0.82000000 0.0570 . -1.66654566 0.02654566
## 1188 - 1214 -1.07000000 0.0156 * -1.91654566 -0.22345434
## 1188 - 1846 -0.48000000 0.2522 -1.32654566 0.36654566
## 1188 - CA-30 -1.08333333 0.0145 * -1.92987899 -0.23678767
## 1188 - Camal 0.28000000 0.4999 -0.56654566 1.12654566
## 1188 - PE-11 -0.38000000 0.3620 -1.22654566 0.46654566
## 1188 - Urophylla -0.25000000 0.5465 -1.09654566 0.59654566
## 1197 - 1198 -0.23333333 0.5734 -1.07987899 0.61321233
## 1197 - 1203 -0.30000000 0.4701 -1.14654566 0.54654566
## 1197 - 1214 -0.55000000 0.1916 -1.39654566 0.29654566
## 1197 - 1846 0.04000000 0.9228 -0.80654566 0.88654566
## 1197 - CA-30 -0.56333333 0.1814 -1.40987899 0.28321233
## 1197 - Camal 0.80000000 0.0628 . -0.04654566 1.64654566
## 1197 - PE-11 0.14000000 0.7349 -0.70654566 0.98654566
## 1197 - Urophylla 0.27000000 0.5152 -0.57654566 1.11654566
## 1198 - 1203 -0.06666667 0.8718 -0.91321233 0.77987899
## 1198 - 1214 -0.31666667 0.4461 -1.16321233 0.52987899
## 1198 - 1846 0.27333333 0.5101 -0.57321233 1.11987899
## 1198 - CA-30 -0.33000000 0.4275 -1.17654566 0.51654566
## 1198 - Camal 1.03333333 0.0190 * 0.18678767 1.87987899
## 1198 - PE-11 0.37333333 0.3703 -0.47321233 1.21987899
## 1198 - Urophylla 0.50333333 0.2306 -0.34321233 1.34987899
## 1203 - 1214 -0.25000000 0.5465 -1.09654566 0.59654566
## 1203 - 1846 0.34000000 0.4138 -0.50654566 1.18654566
## 1203 - CA-30 -0.26333333 0.5255 -1.10987899 0.58321233
## 1203 - Camal 1.10000000 0.0132 * 0.25345434 1.94654566
## 1203 - PE-11 0.44000000 0.2927 -0.40654566 1.28654566
## 1203 - Urophylla 0.57000000 0.1765 -0.27654566 1.41654566
## 1214 - 1846 0.59000000 0.1624 -0.25654566 1.43654566
## 1214 - CA-30 -0.01333333 0.9742 -0.85987899 0.83321233
## 1214 - Camal 1.35000000 0.0032 ** 0.50345434 2.19654566
## 1214 - PE-11 0.69000000 0.1051 -0.15654566 1.53654566
## 1214 - Urophylla 0.82000000 0.0570 . -0.02654566 1.66654566
## 1846 - CA-30 -0.60333333 0.1536 -1.44987899 0.24321233
## 1846 - Camal 0.76000000 0.0760 . -0.08654566 1.60654566
## 1846 - PE-11 0.10000000 0.8087 -0.74654566 0.94654566
## 1846 - Urophylla 0.23000000 0.5788 -0.61654566 1.07654566
## CA-30 - Camal 1.36333333 0.0030 ** 0.51678767 2.20987899
## CA-30 - PE-11 0.70333333 0.0989 . -0.14321233 1.54987899
## CA-30 - Urophylla 0.83333333 0.0534 . -0.01321233 1.67987899
## Camal - PE-11 -0.66000000 0.1202 -1.50654566 0.18654566
## Camal - Urophylla -0.53000000 0.2076 -1.37654566 0.31654566
## PE-11 - Urophylla 0.13000000 0.7531 -0.71654566 0.97654566

#Prueba de tukey
outHSD<-HSD.test(euc.lm, "TRB",console=TRUE)

##
## Study: euc.lm ~ "TRB"
##
## HSD Test for ALT
##
## Mean Square Error: 0.2499354
##
## TRB, means
##
## ALT std r Min Max
## 1066 3.980000 0.6366318 3 3.27 4.50
## 1084 4.240000 0.6483826 3 3.54 4.82
## 1188 3.476667 0.5573449 3 3.14 4.12
## 1197 3.996667 0.8264583 3 3.20 4.85
## 1198 4.230000 1.1700000 3 3.06 5.40
## 1203 4.296667 0.6018582 3 3.63 4.80
## 1214 4.546667 0.5392897 3 3.93 4.93
## 1846 3.956667 0.9052256 3 3.14 4.93
## CA-30 4.560000 0.7435725 3 3.71 5.09
## Camal 3.196667 0.4499259 3 2.79 3.68
## PE-11 3.856667 0.4166933 3 3.42 4.25
## Urophylla 3.726667 0.1761628 3 3.62 3.93
##
## Alpha: 0.05 ; DF Error: 22
## Critical Value of Studentized Range: 5.144324
##
## Minimun Significant Difference: 1.484846
##
## Treatments with the same letter are not significantly different.
##
## ALT groups
## CA-30 4.560000 a
## 1214 4.546667 a
## 1203 4.296667 a
## 1084 4.240000 a
## 1198 4.230000 a
## 1197 3.996667 a
## 1066 3.980000 a
## 1846 3.956667 a
## PE-11 3.856667 a
## Urophylla 3.726667 a
## 1188 3.476667 a
## Camal 3.196667 a

#Prueba de Duncan
duncan.test(euc.lm, "TRB",console=TRUE)

##
## Study: euc.lm ~ "TRB"
##
## Duncan's new multiple range test
## for ALT
##
## Mean Square Error: 0.2499354
##
## TRB, means
##
## ALT std r Min Max
## 1066 3.980000 0.6366318 3 3.27 4.50
## 1084 4.240000 0.6483826 3 3.54 4.82
## 1188 3.476667 0.5573449 3 3.14 4.12
## 1197 3.996667 0.8264583 3 3.20 4.85
## 1198 4.230000 1.1700000 3 3.06 5.40
## 1203 4.296667 0.6018582 3 3.63 4.80
## 1214 4.546667 0.5392897 3 3.93 4.93
## 1846 3.956667 0.9052256 3 3.14 4.93
## CA-30 4.560000 0.7435725 3 3.71 5.09
## Camal 3.196667 0.4499259 3 2.79 3.68
## PE-11 3.856667 0.4166933 3 3.42 4.25
## Urophylla 3.726667 0.1761628 3 3.62 3.93
##
## Alpha: 0.05 ; DF Error: 22
##
## Critical Range
## 2 3 4 5 6 7 8
9
## 0.8465456 0.8888866 0.9159477 0.9349661 0.9490855 0.9599431 0.9684945
0.9753426
## 10 11 12
## 0.9808909 0.9854210 0.9891370
##
## Means with the same letter are not significantly different.
##
## ALT groups
## CA-30 4.560000 a
## 1214 4.546667 a
## 1203 4.296667 ab
## 1084 4.240000 ab
## 1198 4.230000 ab
## 1197 3.996667 abc
## 1066 3.980000 abc
## 1846 3.956667 abc
## PE-11 3.856667 abc
## Urophylla 3.726667 abc
## 1188 3.476667 bc
## Camal 3.196667 c

#Prueba de Scheffé
scheffe.test(euc.lm, "TRB",console=TRUE)

##
## Study: euc.lm ~ "TRB"
##
## Scheffe Test for ALT
##
## Mean Square Error : 0.2499354
##
## TRB, means
##
## ALT std r Min Max
## 1066 3.980000 0.6366318 3 3.27 4.50
## 1084 4.240000 0.6483826 3 3.54 4.82
## 1188 3.476667 0.5573449 3 3.14 4.12
## 1197 3.996667 0.8264583 3 3.20 4.85
## 1198 4.230000 1.1700000 3 3.06 5.40
## 1203 4.296667 0.6018582 3 3.63 4.80
## 1214 4.546667 0.5392897 3 3.93 4.93
## 1846 3.956667 0.9052256 3 3.14 4.93
## CA-30 4.560000 0.7435725 3 3.71 5.09
## Camal 3.196667 0.4499259 3 2.79 3.68
## PE-11 3.856667 0.4166933 3 3.42 4.25
## Urophylla 3.726667 0.1761628 3 3.62 3.93
##
## Alpha: 0.05 ; DF Error: 22
## Critical Value of F: 2.258518
##
## Minimum Significant Difference: 2.034587
##
## Means with the same letter are not significantly different.
##
## ALT groups
## CA-30 4.560000 a
## 1214 4.546667 a
## 1203 4.296667 a
## 1084 4.240000 a
## 1198 4.230000 a
## 1197 3.996667 a
## 1066 3.980000 a
## 1846 3.956667 a
## PE-11 3.856667 a
## Urophylla 3.726667 a
## 1188 3.476667 a
## Camal 3.196667 a

#Prueba de Bonferroni
LSD.test(euc.lm, "TRB", p.adj= "bon",console=TRUE)

##
## Study: euc.lm ~ "TRB"
##
## LSD t Test for ALT
## P value adjustment method: bonferroni
##
## Mean Square Error: 0.2499354
##
## TRB, means and individual ( 95 %) CI
##
## ALT std r LCL UCL Min Max
## 1066 3.980000 0.6366318 3 3.381402 4.578598 3.27 4.50
## 1084 4.240000 0.6483826 3 3.641402 4.838598 3.54 4.82
## 1188 3.476667 0.5573449 3 2.878068 4.075265 3.14 4.12
## 1197 3.996667 0.8264583 3 3.398068 4.595265 3.20 4.85
## 1198 4.230000 1.1700000 3 3.631402 4.828598 3.06 5.40
## 1203 4.296667 0.6018582 3 3.698068 4.895265 3.63 4.80
## 1214 4.546667 0.5392897 3 3.948068 5.145265 3.93 4.93
## 1846 3.956667 0.9052256 3 3.358068 4.555265 3.14 4.93
## CA-30 4.560000 0.7435725 3 3.961402 5.158598 3.71 5.09
## Camal 3.196667 0.4499259 3 2.598068 3.795265 2.79 3.68
## PE-11 3.856667 0.4166933 3 3.258068 4.455265 3.42 4.25
## Urophylla 3.726667 0.1761628 3 3.128068 4.325265 3.62 3.93
##
## Alpha: 0.05 ; DF Error: 22
## Critical Value of t: 3.906393
##
## Minimum Significant Difference: 1.594572
##
## Treatments with the same letter are not significantly different.
##
## ALT groups
## CA-30 4.560000 a
## 1214 4.546667 a
## 1203 4.296667 a
## 1084 4.240000 a
## 1198 4.230000 a
## 1197 3.996667 a
## 1066 3.980000 a
## 1846 3.956667 a
## PE-11 3.856667 a
## Urophylla 3.726667 a
## 1188 3.476667 a
## Camal 3.196667 a

You might also like