Perguntas
1. Design de Produto Robusto
2. Quais os efeitos do tipo de material e da temperatura sobre a vida da bateria?
3. Há um tipo de material que produz uma vida uniformemente longa independentemente da temperatura?
4. Este é um exemplo da aplicação do Delineamento Estatístico de Experimentos para o design de produtos robustos.
library(agricolae)
library(ggplot2)
library(ggalt)
## Registered S3 methods overwritten by 'ggalt':
## method from
## grid.draw.absoluteGrob ggplot2
## grobHeight.absoluteGrob ggplot2
## grobWidth.absoluteGrob ggplot2
## grobX.absoluteGrob ggplot2
## grobY.absoluteGrob ggplot2
library(asbio) # Teste Tukey de Aditividade
## Loading required package: tcltk
library(WRS2)
library(effects)
## Loading required package: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
# Importanto Dados
bateria <- read.table("bateria.txt", header = T)
str(bateria)
## 'data.frame': 36 obs. of 4 variables:
## $ mat : int 1 1 1 1 2 2 2 2 3 3 ...
## $ temp: int 15 15 15 15 15 15 15 15 15 15 ...
## $ y : int 130 155 74 180 150 188 159 126 138 110 ...
## $ tr : int 2 3 1 3 2 3 3 2 2 2 ...
summary(bateria)
## mat temp y tr
## Min. :1 Min. : 15 Min. : 20.0 Min. :0.000
## 1st Qu.:1 1st Qu.: 15 1st Qu.: 70.0 1st Qu.:1.000
## Median :2 Median : 70 Median :108.0 Median :2.000
## Mean :2 Mean : 70 Mean :105.5 Mean :1.611
## 3rd Qu.:3 3rd Qu.:125 3rd Qu.:141.8 3rd Qu.:2.000
## Max. :3 Max. :125 Max. :188.0 Max. :3.000
Análise exploratória dos Dados
# Grafico de Pontos 1
ggplot(bateria, aes(x = mat, y=y, fill=mat)) + geom_point(aes(col=temp)) + geom_smooth(method = "loess", se=T)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 0.99
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 2.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 2.581e-016
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 4.0401
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used
## at 0.99
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 2.01
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal
## condition number 2.581e-016
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other
## near singularities as well. 4.0401

# Grafico de Pontos 2
ggplot(data=bateria, aes(x = mat, y = y, colour = tr, size = y, fill = tr, group = TRUE)) + geom_point() + xlab ("materiais") + ylab("horas de vida") + xlim (c(1,3)) + ylim(c(0,200))

Interação
# Verificando de há interação
asbio::tukey.add.test(bateria$y, bateria$mat, bateria$temp)
##
## Tukey's one df test for additivity
## F = 0.0260641 Denom df = 30 p-value = 0.8728263
obs.: Conforme resultado p-value (0.8728) o resultado ficou acima de 0.05, ou seja, H0 pode ser aceito. Contudo, nao existe interação entre as relações de tempo x material.
Estimação modelo ANAVA
# Estimação do Modelo com 1 Fator
mdic <- aov(y ~ mat, data = bateria)
# Estimação do modelo com blocagem dos dias
mdbca <- aov(y ~ mat + temp, data = bateria)
summary(mdbca)
## Df Sum Sq Mean Sq F value Pr(>F)
## mat 1 10542 10542 12.40 0.00128 **
## temp 1 39043 39043 45.91 0.0000001 ***
## Residuals 33 28062 850
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(mdic)
## Df Sum Sq Mean Sq F value Pr(>F)
## mat 1 10542 10542 5.341 0.027 *
## Residuals 34 67105 1974
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Obs: A informação na Tabela de Estimação do Modelo ANAVA é importante para se confirmar o valor Pr(F) do mat (material) que é o meu fator de interesse. O valor de P para temperatura, neste momento, nao é tão interessante avaliar. Contudo, esta análise visa obter a certeza de que foi retirado um fator que poderia alterar o resultado, melhorando assim, o poder do teste.
CV do pacote Agricolae
cv.model(mdic)
## [1] 42.09892
cv.model(mdbca)
## [1] 27.63361