diff --git a/R/legTools.R b/R/legTools.R index 16239ecc6a1db50c4f28a5a16ac849173f1300be..115262bcc6e803a275f684b71032537541b8e399 100644 --- a/R/legTools.R +++ b/R/legTools.R @@ -764,3 +764,55 @@ NULL #' xlab="Nutrient content") #' NULL + +#' @name coffeeFert +#' +#' @title Number of dry branches in coffee trees as function of NPK +#' +#' @description These data are from a \eqn{2^3} factorial experiment +#' studing the effect of NPK fertilizaton on the number of dry +#' branches in coffee trees. +#' +#' \itemize{ +#' \item \code{N} content of nitrogen in the fertilizer (low/high). +#' \item \code{P} content of phosphorus in the fertilizer (low/high). +#' \item \code{K} content of potassium in the fertilizer (low/high). +#' \item \code{block} an unordered factor representing the blocks +#' used. +#' \item \code{branches} an integer variable, the number of dry +#' branches in a coffee the. +#' } +#' +#' @details The experiment was carried out in a randomized block design +#' with 6 blocks. In the book, the data is presented at squared root +#' scale. +#' +#' @docType data +#' +#' @keywords datasets +#' +#' @usage data(coffeeFert) +#' +#' @format a \code{data.frame} with 48 records and 5 variables. +#' +#' @source Pimentel Gomes, F. (2009). Curso de Estatística Experimental +#' (15th ed.). Piracicaba, São Paulo: FEALQ. (page 137) +#' +#' Malavolta, E.; Pimentel Gomes, F.; Coury, T. (1958). Estudos sobre a +#' alimentação mineral do cafeeiro (\emph{Coffea arabica} L., +#' variedade Bourbon Vermelho). Piracicaba. +#' +#' @examples +#' +#' library(lattice) +#' library(latticeExtra) +#' +#' data(coffeeFert) +#' str(coffeeFert) +#' +#' xyplot(branches~N|P, groups=K, +#' data=coffeeFert, type=c("p", "a"), +#' ylab=expression(Branches~(plant^{-1})), +#' xlab="Nutrient level") +#' +NULL diff --git a/data-raw/coffeeFert.R b/data-raw/coffeeFert.R new file mode 100644 index 0000000000000000000000000000000000000000..f799d122e9e0c0b0bb917dfe903cbe8a7866463e --- /dev/null +++ b/data-raw/coffeeFert.R @@ -0,0 +1,78 @@ +##---------------------------------------------------------------------- +## Data generation. + +coffeeFert <- expand.grid(N=c(-1,1), P=c(-1,1), K=c(-1,1), + block=gl(6, 1), KEEP.OUT.ATTRS=FALSE) + +coffeeFert$branches <- c(104, 29, 73, 78, 71, 5, 44, 19, 57, 58, 155, + 45, 13, 10, 39, 4, 58, 22, 53, 14, 25, 1, 15, + 3, 111, 11, 70, 9, 21, 1, 11, 7, 64, 30, 64, + 89, 64, 15, 84, 7, 21, 18, 37, 15, 23, 5, 10, + 0) + +## coffeeFert$sqrtBranches <- sqrt(coffeeFert$branches) + +str(coffeeFert) + +save(coffeeFert, file="../data/coffeeFert.RData") + +##---------------------------------------------------------------------- +## Examples. + +library(lattice) +library(latticeExtra) + +data(coffeeFert) +str(coffeeFert) + +xyplot(branches~N|P, groups=K, + data=coffeeFert, type=c("p", "a"), + ylab=expression(Branches~(plant^{-1})), + xlab="Nutrient level") + +range(coffeeFert$branches) + +## Sum a positive number to avoid zeros and allow BoxCox +## transformation. +m0 <- lm(branches+1~block+(N+P+K)^3, data=coffeeFert) + +## Departures from homecedasticity and normality. +par(mfrow=c(2,2)); plot(m0); layout(1) + +MASS::boxcox(m0) +abline(v=0, col=2) + +m1 <- update(m0, log(.)~.) +par(mfrow=c(2,2)); plot(m1); layout(1) + +anova(m1) + +m2 <- update(m1, .~block+N*K) +par(mfrow=c(2,2)); plot(m2); layout(1) + +anova(m1, m2) +anova(m2) + +summary(m2) + +pred <- expand.grid(block="1", + N=seq(-1, 1, by=0.1), + K=seq(-1, 1, by=0.1)) +pred$mu <- predict(m2, newdata=pred) + +wireframe(mu~N+K, data=pred, + scales=list(arrows=FALSE), + zlab=list(expression(log(Branches+1)), rot=90), + drape=TRUE, cuts=20, + col.regions=colorRampPalette( + color=brewer.pal(n=11, name="Spectral"))(21)) + +levelplot(mu~N+K, data=pred, aspect=1, + main=expression(log(Branches+1)), + col.regions=colorRampPalette( + color=brewer.pal(n=11, name="Spectral"))) + +rm(list=ls()) +load("../data/coffeeFert.RData") +ls() +str(coffeeFert) diff --git a/data/coffeeFert.RData b/data/coffeeFert.RData new file mode 100644 index 0000000000000000000000000000000000000000..b86ba2ae621e613e72cb12359ed765231426b18f Binary files /dev/null and b/data/coffeeFert.RData differ diff --git a/man/cassavaYield.Rd b/man/cassavaYield.Rd index 9cf4bd0b4eff74c7971081c84602c284293c6049..286b7221910bd30610ff7e84a8e499cec3439c92 100644 --- a/man/cassavaYield.Rd +++ b/man/cassavaYield.Rd @@ -6,8 +6,8 @@ \title{Cassava variety competition experiment} \format{a \code{data.frame} with 24 records and 3 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 93) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 93) } \usage{ data(cassavaYield) diff --git a/man/coffeeFert.Rd b/man/coffeeFert.Rd new file mode 100644 index 0000000000000000000000000000000000000000..9632a965d942c237f721ab8542ee6056673d9136 --- /dev/null +++ b/man/coffeeFert.Rd @@ -0,0 +1,52 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/legTools.R +\docType{data} +\name{coffeeFert} +\alias{coffeeFert} +\title{Number of dry branches in coffee trees as function of NPK} +\format{a \code{data.frame} with 48 records and 5 variables.} +\source{ +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 137) + +Malavolta, E.; Pimentel Gomes, F.; Coury, T. (1958). Estudos sobre a + alimentação mineral do cafeeiro (\emph{Coffea arabica} L., + variedade Bourbon Vermelho). Piracicaba. +} +\usage{ +data(coffeeFert) +} +\description{ +These data are from a \eqn{2^3} factorial experiment + studing the effect of NPK fertilizaton on the number of dry + branches in coffee trees. + +\itemize{ + \item \code{N} content of nitrogen in the fertilizer (low/high). + \item \code{P} content of phosphorus in the fertilizer (low/high). + \item \code{K} content of potassium in the fertilizer (low/high). + \item \code{block} an unordered factor representing the blocks + used. + \item \code{branches} an integer variable, the number of dry + branches in a coffee the. +} +} +\details{ +The experiment was carried out in a randomized block design + with 6 blocks. In the book, the data is presented at squared root + scale. +} +\examples{ +library(lattice) +library(latticeExtra) + +data(coffeeFert) +str(coffeeFert) + +xyplot(branches~N|P, groups=K, + data=coffeeFert, type=c("p", "a"), + ylab=expression(Branches~(plant^{-1})), + xlab="Nutrient level") +} +\keyword{datasets} + diff --git a/man/cornYield.Rd b/man/cornYield.Rd index 7c7d0580367cb88c9d9e49a22fac3b7036e31580..79457d6afe9309b1ce9b1c7163763d6b045afb8f 100644 --- a/man/cornYield.Rd +++ b/man/cornYield.Rd @@ -6,8 +6,8 @@ \title{Corn yield as function of fertilization with NPK} \format{a \code{data.frame} with 32 records and 4 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 115) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 115) } \usage{ data(cornYield) diff --git a/man/cornYield2.Rd b/man/cornYield2.Rd index e6f18b139b10b52eb16a3583cb58d9c023e62644..c4f825233b6002cc72778c93ee0b7f1a306d169a 100644 --- a/man/cornYield2.Rd +++ b/man/cornYield2.Rd @@ -6,14 +6,14 @@ \title{Axial factorial NPK experiment with added treatments} \format{a \code{data.frame} with 9 records and 5 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 132) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 132) Simão, S. (1960). Estudo da planta e dos frutos da mangueira (\emph{Manginifera indica} L.). Piracicaba, 1960. Thesis. } \usage{ -data(sugarcaneYield4) +data(cornYield2) } \description{ These data are from an axial 3 factorial experiment @@ -30,7 +30,7 @@ These data are from an axial 3 factorial experiment } } \details{ -The experiment was caried out in 16 different locations but +The experiment was carried out in 16 different locations but only the mean by cell combinations were available in the text book. } diff --git a/man/filterCake.Rd b/man/filterCake.Rd index 6ddae712d3635d514921f43d8296b20c26f83a62..8d859f0ae444722d9de14ac21e8d19a7058a9e45 100644 --- a/man/filterCake.Rd +++ b/man/filterCake.Rd @@ -6,8 +6,8 @@ \title{Fertilization with filter cake and mineral} \format{a \code{data.frame} with 16 records and 4 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 120) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 120) } \usage{ data(filterCake) diff --git a/man/mangoAcidity.Rd b/man/mangoAcidity.Rd index 85fb633e3498df0486d95aac11912c4d51d5cb39..2185e702f067566c1ce760c5a76e3a10e4ea95df 100644 --- a/man/mangoAcidity.Rd +++ b/man/mangoAcidity.Rd @@ -6,14 +6,14 @@ \title{Acidity of mango fruits by varieties, years and months} \format{a \code{data.frame} with 54 records and 6 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 132) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 132) Simão, S. (1960). Estudo da planta e dos frutos da mangueira (\emph{Manginifera indica} L.). Piracicaba, 1960. Thesis. } \usage{ -data(sugarcaneYield4) +data(mangoAcidity) } \description{ These data are from an observational study along 3 years @@ -30,7 +30,6 @@ These data are from an observational study along 3 years } \examples{ library(lattice) -library(latticeExtra) data(mangoAcidity) str(mangoAcidity) diff --git a/man/plowing.Rd b/man/plowing.Rd index 30c69cacc5761c0d39ad9463b2e461cf81dcf26b..3330108ceb25433beb9f604f9c414ef22b4129e9 100644 --- a/man/plowing.Rd +++ b/man/plowing.Rd @@ -6,8 +6,8 @@ \title{Plowing level on corn yield} \format{a \code{data.frame} with 24 records and 3 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 91) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 91) } \usage{ data(plowing) diff --git a/man/potatoYield.Rd b/man/potatoYield.Rd index 3a0752606e317a05121ac7558ed23f1a5014e590..39588d387b36392e93ffd45ba231c855bb7e75f2 100644 --- a/man/potatoYield.Rd +++ b/man/potatoYield.Rd @@ -6,8 +6,8 @@ \title{Potato variety competition experiment} \format{a \code{data.frame} with 32 records and 3 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 76) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 76) } \usage{ data(potatoYield) diff --git a/man/sugarcaneYield.Rd b/man/sugarcaneYield.Rd index a79e78b4eb9c57758b40d00368ec127201b9f603..c5fa0523d8f5495aeb00db6fc71615c9039eb475 100644 --- a/man/sugarcaneYield.Rd +++ b/man/sugarcaneYield.Rd @@ -6,8 +6,8 @@ \title{Sugarcane variety experiment} \format{a \code{data.frame} with 28 records and 3 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 92) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 92) } \usage{ data(sugarcaneYield) diff --git a/man/sugarcaneYield2.Rd b/man/sugarcaneYield2.Rd index da824a950fb64ee73f38aec5702e2e9c0806c72e..40272aabfac363a7e2382659cca2b77a05bab4ef 100644 --- a/man/sugarcaneYield2.Rd +++ b/man/sugarcaneYield2.Rd @@ -6,8 +6,8 @@ \title{Sugarcane variety competition experiment} \format{a \code{data.frame} with 28 records and 3 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 96) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 96) } \usage{ data(sugarcaneYield2) diff --git a/man/sugarcaneYield3.Rd b/man/sugarcaneYield3.Rd index 048af7a28000f61f627a4957d2ed5d733898fa35..48a9945d9b93f950c23bfe9bc13974093845cc04 100644 --- a/man/sugarcaneYield3.Rd +++ b/man/sugarcaneYield3.Rd @@ -6,8 +6,8 @@ \title{Sugarcane yield as function of fertilization strategy} \format{a \code{data.frame} with 28 records and 3 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 99) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 99) } \usage{ data(sugarcaneYield3) diff --git a/man/sugarcaneYield4.Rd b/man/sugarcaneYield4.Rd index b0a20021e4e7cf9284dde5a41e0adf2d7dd855d4..93ff7e03adc8b270f250fbdf9603f718b05c2207 100644 --- a/man/sugarcaneYield4.Rd +++ b/man/sugarcaneYield4.Rd @@ -6,8 +6,8 @@ \title{Triple factorial NPK fertilization on sugar cane yield} \format{a \code{data.frame} with 54 records and 6 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 126) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 126) } \usage{ data(sugarcaneYield4) diff --git a/man/vinasseFert.Rd b/man/vinasseFert.Rd index c52ece6e40284557829e798b3e7279cf95c6783a..def3ee5bcde5361b33d18d242fe70ee7b192b901 100644 --- a/man/vinasseFert.Rd +++ b/man/vinasseFert.Rd @@ -6,8 +6,8 @@ \title{Fertilization with vinasse and mineral} \format{a \code{data.frame} with 16 records and 4 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 119) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 119) } \usage{ data(vinasseFert) diff --git a/man/wgPigs.Rd b/man/wgPigs.Rd index e107692f914c6ec870518286efbb857f8a2c4e78..5efbb505e2b01be6f723391fff87bffd2dd3200f 100644 --- a/man/wgPigs.Rd +++ b/man/wgPigs.Rd @@ -6,8 +6,8 @@ \title{Feeding type in pig weight gain} \format{a \code{data.frame} with 20 records and 2 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 62) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 62) } \usage{ data(wgPigs) diff --git a/man/wgPigs2.Rd b/man/wgPigs2.Rd index 8ac1bb48b2aae8dae99418fa7113c493a9e978b3..697f2abd3a8b7f6ed2b907e3aa81bfc5c9142629 100644 --- a/man/wgPigs2.Rd +++ b/man/wgPigs2.Rd @@ -6,8 +6,8 @@ \title{Age of castration in pig weight gain} \format{a \code{data.frame} with 16 records and 4 variables.} \source{ -Frederico, P. (2009). Curso de Estatística Experimental (15th - ed.). Piracicaba, São Paulo: FEALQ. (page 110) +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 110) } \usage{ data(wgPigs2)