Está en la página 1de 5

EJEMPLO

datos <- read.table(file= "D:/DCL.txt", header = T)


datos

## Lote Operadores Formulaciones Combustion


## 1 1 1 A 24
## 2 1 2 B 20
## 3 1 3 C 19
## 4 1 4 D 24
## 5 1 5 E 24
## 6 2 1 B 17
## 7 2 2 C 24
## 8 2 3 D 30
## 9 2 4 E 27
## 10 2 5 A 36
## 11 3 1 C 18
## 12 3 2 D 38
## 13 3 3 E 26
## 14 3 4 A 27
## 15 3 5 B 21
## 16 4 1 D 26
## 17 4 2 E 31
## 18 4 3 A 26
## 19 4 4 B 23
## 20 4 5 C 22
## 21 5 1 E 22
## 22 5 2 A 30
## 23 5 3 B 20
## 24 5 4 C 29
## 25 5 5 D 31

attach(datos)
TRC<- factor(Formulaciones)
FILA<-factor(Lote)
COL<-factor(Operadores)
Resp1<-as.numeric(as.vector(Combustion))
DCL.lm <- lm(Resp1 ~ TRC + FILA + COL)
anova(DCL.lm)

## Analysis of Variance Table


##
## Response: Resp1
## Df Sum Sq Mean Sq F value Pr(>F)
## TRC 4 330 82.500 7.7344 0.002537 **
## FILA 4 68 17.000 1.5937 0.239059
## COL 4 150 37.500 3.5156 0.040373 *
## Residuals 12 128 10.667
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Como P-value = 0.002537 ** < alfa = 0.05, se rechaza la hipótesis nula y se
concluye que hay una diferencia significativa en la tasa de combustión promedio,
generada por las diferentes formulaciones del combustible, a un nivel de
significancia del 5%
#Evaluacion de supuestos
#Ho: Los residuos siguen la distribución normal
#Ha: Los residuos no siguen la distribución normal
library(nortest)
lillie.test(residuals(DCL.lm))

##
## Lilliefors (Kolmogorov-Smirnov) normality test
##
## data: residuals(DCL.lm)
## D = 0.18, p-value = 0.03581

shapiro.test(residuals(DCL.lm))

##
## Shapiro-Wilk normality test
##
## data: residuals(DCL.lm)
## W = 0.92239, p-value = 0.05811

#Evaluacion de igualdad de varianzas


library(car)

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

## Loading required package: carData

leveneTest(Resp1~TRC, center = "median")

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


## Df F value Pr(>F)
## group 4 0.5858 0.6766
## 20

#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(DCL.lm)
##
## Durbin-Watson test
##
## data: DCL.lm
## DW = 2.2734, p-value = 0.4906
## alternative hypothesis: true autocorrelation is greater than 0

#Comparacion de medias
library(agricolae)
#Método de la diferencia mínima significativa, Least Significant
Difference (LSD)
Grupos<- LSD.test(y = DCL.lm, trt = "TRC", group = T, console = T)

##
## Study: DCL.lm ~ "TRC"
##
## LSD t Test for Resp1
##
## Mean Square Error: 10.66667
##
## TRC, means and individual ( 95 %) CI
##
## Resp1 std r LCL UCL Min Max
## A 28.6 4.669047 5 25.41764 31.78236 24 36
## B 20.2 2.167948 5 17.01764 23.38236 17 23
## C 22.4 4.393177 5 19.21764 25.58236 18 29
## D 29.8 5.403702 5 26.61764 32.98236 24 38
## E 26.0 3.391165 5 22.81764 29.18236 22 31
##
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813
##
## least Significant Difference: 4.500536
##
## Treatments with the same letter are not significantly different.
##
## Resp1 groups
## D 29.8 a
## A 28.6 a
## E 26.0 ab
## C 22.4 bc
## B 20.2 c

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

##
## Study: DCL.lm ~ "TRC"
##
## LSD t Test for Resp1
##
## Mean Square Error: 10.66667
##
## TRC, means and individual ( 95 %) CI
##
## Resp1 std r LCL UCL Min Max
## A 28.6 4.669047 5 25.41764 31.78236 24 36
## B 20.2 2.167948 5 17.01764 23.38236 17 23
## C 22.4 4.393177 5 19.21764 25.58236 18 29
## D 29.8 5.403702 5 26.61764 32.98236 24 38
## E 26.0 3.391165 5 22.81764 29.18236 22 31
##
## Alpha: 0.05 ; DF Error: 12
## Critical Value of t: 2.178813
##
## Comparison between treatments means
##
## difference pvalue signif. LCL UCL
## A - B 8.4 0.0016 ** 3.8994636 12.9005364
## A - C 6.2 0.0110 * 1.6994636 10.7005364
## A - D -1.2 0.5720 -5.7005364 3.3005364
## A - E 2.6 0.2321 -1.9005364 7.1005364
## B - C -2.2 0.3078 -6.7005364 2.3005364
## B - D -9.6 0.0006 *** -14.1005364 -5.0994636
## B - E -5.8 0.0158 * -10.3005364 -1.2994636
## C - D -7.4 0.0038 ** -11.9005364 -2.8994636
## C - E -3.6 0.1069 -8.1005364 0.9005364
## D - E 3.8 0.0907 . -0.7005364 8.3005364

#Prueba de Tukey
outHSD<-HSD.test(DCL.lm, "TRC",console=TRUE)

##
## Study: DCL.lm ~ "TRC"
##
## HSD Test for Resp1
##
## Mean Square Error: 10.66667
##
## TRC, means
##
## Resp1 std r Min Max
## A 28.6 4.669047 5 24 36
## B 20.2 2.167948 5 17 23
## C 22.4 4.393177 5 18 29
## D 29.8 5.403702 5 24 38
## E 26.0 3.391165 5 22 31
##
## Alpha: 0.05 ; DF Error: 12
## Critical Value of Studentized Range: 4.50771
##
## Minimun Significant Difference: 6.583932
##
## Treatments with the same letter are not significantly different.
##
## Resp1 groups
## D 29.8 a
## A 28.6 ab
## E 26.0 abc
## C 22.4 bc
## B 20.2 c

También podría gustarte