Cyclops Script R
Cyclops Script R
Davi
2024-11-17
library(phia)
#analises Exploratorias
tapply(Cyclops$TaxaCresc, Cyclops$Detergente, mean)
1
tapply(Cyclops$TaxaCresc, Cyclops$Cyclops, mean)
tapply
## function (X, INDEX, FUN = NULL, ..., default = NA, simplify = TRUE)
## {
## FUN <- if (!is.null(FUN))
## match.fun(FUN)
## if (inherits(INDEX, "formula")) {
## if (is.data.frame(X))
## INDEX <- .formula2varlist(INDEX, X)
## else stop("’X’ must be a data frame when ’INDEX’ is a formula")
## }
## if (!is.list(INDEX))
## INDEX <- list(INDEX)
## INDEX <- lapply(INDEX, as.factor)
## nI <- length(INDEX)
## if (!nI)
## stop("’INDEX’ is of length zero")
## if (!is.object(X) && !all(lengths(INDEX) == length(X)))
## stop("arguments must have same length")
## namelist <- lapply(INDEX, levels)
## extent <- lengths(namelist, use.names = FALSE)
## cumextent <- cumprod(extent)
## if (cumextent[nI] > .Machine$integer.max)
## stop("total number of levels >= 2^31")
## storage.mode(cumextent) <- "integer"
## ngroup <- cumextent[nI]
## group <- as.integer(INDEX[[1L]])
## if (nI > 1L)
## for (i in 2L:nI) group <- group + cumextent[i - 1L] *
## (as.integer(INDEX[[i]]) - 1L)
## if (is.null(FUN))
## return(group)
## levels(group) <- as.character(seq_len(ngroup))
## class(group) <- "factor"
## ans <- split(X, group)
## names(ans) <- NULL
## index <- as.logical(lengths(ans))
## ans <- lapply(X = ans[index], FUN = FUN, ...)
## ansmat <- array(if (simplify && all(lengths(ans) == 1L)) {
## ans <- unlist(ans, recursive = FALSE, use.names = FALSE)
## if (is.na(default) && is.atomic(ans))
## vector(typeof(ans))
2
## else default
## }
## else vector("list", prod(extent)), dim = extent, dimnames = namelist)
## if (length(ans)) {
## ansmat[index] <- ans
## }
## ansmat
## }
## <bytecode: 0x0000023e7f109e60>
## <environment: namespace:base>
5
4
3
2
A B C D
Marca do detergente
3
coresCYPS = c("blue", "red", "pink","Clone1", "Clone2",
"Clone3")
boxplot(Cyclops$TaxaCresc ~ Cyclops$Cyclops,
ylab = "Taxa de crescimento", xlab = "Cyclops",
col = coresCYPS,
border = "white",
whiskcol = "black",
staplecol = "black",
medcol = "white",
boxwex = 0.5,
names = c("Clone 1","Clone 2", "Clone 3"))
7
6
Taxa de crescimento
5
4
3
2
Cyclops
#anova e modelo
modeloc = glm (Cyclops$TaxaCresc ~ Cyclops$Detergente *
Cyclops$Cyclops)
anova (modeloc, test = "F")
4
##
## Df Deviance Resid. Df Resid. Dev F
## NULL 35 76.493
## Cyclops$Detergente 3 0.798 32 75.695 0.4132
## Cyclops$Cyclops 2 38.870 30 36.824 30.1924
## Cyclops$Detergente:Cyclops$Cyclops 6 21.375 24 15.449 5.5343
## Pr(>F)
## NULL
## Cyclops$Detergente 0.745020
## Cyclops$Cyclops 2.801e-07 ***
## Cyclops$Detergente:Cyclops$Cyclops 0.001018 **
## ---
## Signif. codes: 0 ’***’ 0.001 ’**’ 0.01 ’*’ 0.05 ’.’ 0.1 ’ ’ 1
rdiagnostic(modeloc)
Pearson Residuals
1.5
27
6
1
0.0
−1
−1.5
25
−3
−2 0 1 2 3 4 5 6
Theoretical Quantiles Predicted values
media.crescimento = interactionMeans(modeloc)
contraste.media.crescimento.dt= testInteractions(modeloc,
pairwise =
c("Cyclops$Detergente"), fixed = "Cyclops$Cyclops")
5
plot(media.crescimento)
contraste.teste.media.cyclops = testInteractions(modeloc,
pairwise =
c("Cyclops$Cyclops"), fixed = "Cyclops$Detergente")
adjusted mean
6
Cyclops$Detergente
5
MarcaA
MarcaB
4
MarcaC
MarcaD
3
2
6
Cyclops$Cyclops
5
Clone1
Clone2
4
Clone3
3
2
6
adjusted mean
5 Cyclops$Detergente
MarcaA
MarcaB
4 MarcaC
MarcaD