diff --git a/R/legTools.R b/R/legTools.R index c0e84bd9be14097927bd1e5e10e67ce3e9e4e42b..502dfd7466343b619801d42d60c8a43d0ad605eb 100644 --- a/R/legTools.R +++ b/R/legTools.R @@ -1196,3 +1196,246 @@ NULL #' NULL +#' @name bib3 +#' +#' @title A balanced incomplete block design of type III +#' +#' @description This data is under a balanced complete block design +#' named type III. There are 5 treatments and 10 blocks of size 3 +#' plots. Each treatment is repeated 6 times and they occour +#' together (in pairs) 3 times. +#' +#' \itemize{ +#' +#' \item \code{block} a categorical unordered factor with 10 levels. +#' +#' \item \code{treat} a categorical unordered factor with 5 levels, the +#' treatments studied. +#' +#' \item \code{y} some response variable. The book doesn't gave details. +#' +#' } +#' +#' @docType data +#' +#' @keywords datasets +#' +#' @usage data(bib3) +#' +#' @format a \code{data.frame} with 30 records and 3 variables. +#' +#' @source Pimentel Gomes, F. (2009). Curso de Estatística Experimental +#' (15th ed.). Piracicaba, São Paulo: FEALQ. (page 185) +#' +#' @examples +#' +#' require(lattice) +#' +#' data(bib3) +#' str(bib3) +#' +#' xyplot(y~treat|block, data=bib3, +#' ylab="Y", +#' xlab="Treatment") +#' +#' g <- nlevels(bib3$treat) +#' a <- seq(0, by=(2*pi)/(g), length.out=g) +#' y <- sin(a) +#' x <- cos(a) +#' plot(y~x, asp=1, xlim=c(-1,1), ylim=c(-1,1)) +#' +#' for (b in levels(bib3$block)){ +#' cbn <- combn(x=as.integer(bib3$treat[bib3$block==b]), +#' m=2) +#' segments( +#' x0=x[cbn[1,]], y0=y[cbn[1,]], +#' x1=x[cbn[2,]], y1=y[cbn[2,]], col=b) +#' } +#' +NULL + +#' @name bib1 +#' +#' @title A balanced incomplete block design of type I +#' +#' @description This data is under a balanced complete block design +#' named type I. There are 7 replications that are groups of 4 +#' blocks of size 2 in a such a way that each treatment occurs once +#' in each replication and 7 times at all. There are 8 treatments, +#' 28 blocks at all. Treatment occur in pairs once. These treatments +#' are in fact cells of a \eqn{2^3} factorial design from combining +#' nitrogen (P), phosphorus (P) and potassium (K) fertilizers at two +#' levels each. +#' +#' \itemize{ +#' +#' \item \code{rept} a categorical unordered factor with 7 levels. Each +#' \code{rept} has 4 bloks of size 2. +#' +#' \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} a categorical unordered factor with 4 levels in +#' each \code{rept}, so 28 at all. +#' +#' \item \code{treat} a categorical unordered factor with 8 levels, the +#' treatments studied. +#' +#' \item \code{y} some response variable. The book doesn't gave details. +#' +#' } +#' +#' @docType data +#' +#' @keywords datasets +#' +#' @usage data(bib1) +#' +#' @format a \code{data.frame} with 56 records and 4 variables. +#' +#' @source Pimentel Gomes, F. (2009). Curso de Estatística Experimental +#' (15th ed.). Piracicaba, São Paulo: FEALQ. (page 190) +#' +#' @examples +#' +#' require(lattice) +#' +#' data(bib1) +#' str(bib1) +#' +#' xyplot(y~treat|rept, groups=block, data=bib1, type="b", +#' ylab="Y", xlab="Treatment") +#' +#' xyplot(y~treat, data=bib1, jitter.x=TRUE, +#' ylab="Y", xlab="Treatment") +#' +#' xyplot(y~N|P+K, groups=rept, data=bib1, type="b", +#' ylab="Y", xlab="Nitrogen") +#' +NULL + +#' @name bib2 +#' +#' @title A balanced incomplete block design of type II +#' +#' @description This data is under a balanced complete block design +#' named type II. There are 3 replications that are groups of 7 +#' blocks of size 2 in a such a way that each treatment occurs twice +#' in each replication and 6 times at all. There are 7 treatments +#' and 21 blocks at all. Treatments occur in pairs once. +#' +#' \itemize{ +#' +#' \item \code{rept} a categorical unordered factor with 3 levels. Each +#' \code{rept} has 7 bloks of size 2. +#' +#' \item \code{block} a categorical unordered factor with 8 levels in +#' each \code{rept}, so 21 at all. +#' +#' \item \code{treat} a categorical unordered factor with 7 levels, the +#' treatments studied. +#' +#' \item \code{y} some response variable. The book doesn't gave details. +#' +#' } +#' +#' @docType data +#' +#' @keywords datasets +#' +#' @usage data(bib2) +#' +#' @format a \code{data.frame} with 42 records and 4 variables. +#' +#' @source Pimentel Gomes, F. (2009). Curso de Estatística Experimental +#' (15th ed.). Piracicaba, São Paulo: FEALQ. (page 192) +#' +#' @examples +#' +#' require(lattice) +#' +#' data(bib2) +#' str(bib2) +#' +#' xyplot(y~treat|rept, groups=block, data=bib2, type="b", +#' ylab="Y", xlab="Treatment") +#' +#' xyplot(y~treat, data=bib2, jitter.x=TRUE, +#' ylab="Y", xlab="Treatment") +#' +NULL + +#' @name bib3asin +#' +#' @title A balanced incomplete block design of type III +#' +#' @description This data is under a balanced complete block design +#' named type III. There are 13 treatments and 13 blocks of size 4 +#' plots. Each treatment is repeated 6 times and they occour +#' together (in pairs) only once. +#' +#' \itemize{ +#' +#' \item \code{block} a categorical unordered factor with 13 levels. +#' +#' \item \code{treat} a categorical unordered factor with 13 levels, the +#' treatments studied. +#' +#' \item \code{z} correpond a transformation of the original recorded +#' variable, the observed percentual of healthy plants, \eqn{p}. So, +#' \eqn{z = \arcsin{\sqrt{p/100}}}, in radians is applied to +#' stabilize the variance to comply with the assumption of constant +#' variance. +#' +#' } +#' +#' @docType data +#' +#' @keywords datasets +#' +#' @usage data(bib3asin) +#' +#' @format a \code{data.frame} with 52 records and 3 variables. +#' +#' @source Pimentel Gomes, F. (2009). Curso de Estatística Experimental +#' (15th ed.). Piracicaba, São Paulo: FEALQ. (page 198) +#' +#' Fraga Jr., C. G.; Costa, A. S. (1950). Análise de um experimento para +#' combate de vira-cabeça do tomateiro. Bragantia, 10:305-316. +#' +#' @examples +#' +#' require(lattice) +#' +#' data(bib3asin) +#' str(bib3asin) +#' +#' xyplot(z~treat|block, data=bib3asin, +#' ylab="Arc sin of heathy plants fraction", +#' xlab="Treatment") +#' +#' ## Why not consider a beta distribution for p? +#' bib3asin$p <- sin(bib3asin$z*pi/180)^2 +#' +#' xyplot(p~treat|block, data=bib3asin, +#' ylab="Fraction of healthy plants", +#' xlab="Treatment") +#' +#' g <- nlevels(bib3asin$treat) +#' a <- seq(0, by=(2*pi)/(g), length.out=g) +#' y <- sin(a) +#' x <- cos(a) +#' plot(y~x, asp=1, xlim=c(-1,1), ylim=c(-1,1)) +#' +#' for (b in levels(bib3asin$block)){ +#' cbn <- combn(x=as.integer(bib3asin$treat[bib3asin$block==b]), +#' m=2) +#' segments( +#' x0=x[cbn[1,]], y0=y[cbn[1,]], +#' x1=x[cbn[2,]], y1=y[cbn[2,]], col=b) +#' } +#' +NULL diff --git a/data-raw/bib1.R b/data-raw/bib1.R new file mode 100644 index 0000000000000000000000000000000000000000..00c7ae81176f4ec5098164ca606c1db651af346e --- /dev/null +++ b/data-raw/bib1.R @@ -0,0 +1,88 @@ +##---------------------------------------------------------------------- +## Data generation. Pimentel page 190. + +## bib1 <- read.table("clipboard", header=TRUE, sep="\t") +## names(bib1) <- c("rept", "treat", "block", "y") +## bib1 <- transform(bib1, rept=factor(rept), +## block=factor(block), treat=factor(treat)) + +bib1 <- structure(list( + rept = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, + 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, + 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, + 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, + 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L), + .Label = c("1", "2", "3", "4", "5", "6", "7"), + class = "factor"), + treat = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 1L, 3L, 2L, 8L, + 4L, 5L, 6L, 7L, 1L, 4L, 2L, 7L, 3L, 6L, 5L, 8L, + 1L, 5L, 2L, 3L, 4L, 7L, 6L, 8L, 1L, 6L, 2L, 4L, + 3L, 8L, 5L, 7L, 1L, 7L, 2L, 6L, 3L, 5L, 4L, 8L, + 1L, 8L, 2L, 5L, 3L, 7L, 4L, + 6L), + .Label = c("1", "2", "3", "4", "5", "6", "7", + "8"), + class = "factor"), + block = structure(c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, + 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, + 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, + 3L, 3L, 4L, 4L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, + 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L), + .Label = c("1", "2", "3", "4"), + class = "factor"), + y = c(20L, 18L, 15L, 16L, 14L, 15L, 16L, 18L, 24L, + 18L, 25L, 19L, 13L, 16L, 12L, 16L, 23L, 17L, + 26L, 18L, 15L, 17L, 13L, 16L, 21L, 13L, 23L, + 16L, 10L, 12L, 13L, 11L, 28L, 14L, 27L, 18L, + 18L, 15L, 16L, 17L, 22L, 17L, 24L, 16L, 18L, + 14L, 15L, 17L, 23L, 15L, 21L, 13L, 15L, 12L, + 13L, 16L)), + .Names = c("rept", "treat", "block", "y"), + row.names = c(NA, -56L), + class = "data.frame") + +npk <- expand.grid(N=c(-1,1), P=c(-1,1), K=c(-1,1)) +npk$treat <- c(4,5,3,7,8,6,2,1) + +bib1 <- merge(npk, bib1) +bib1$treat <- factor(bib1$treat) +str(bib1) + +bib1 <- bib1[, c(5:6, 1:4, 7)] + +bib <- bib1[with(bib1, order(rept, block, treat)), ] + +save(bib1, file="../data/bib1.RData") + +##---------------------------------------------------------------------- + +m0 <- aov(terms(y~rept/block+treat, keep.order=TRUE), data=bib1) +anova(m0) + +library(doBy) +LSmeans(m0, effect="treat") + +m1 <- aov(terms(y~rept/block+N*P*K, keep.order=TRUE), data=bib1) +anova(m1) + +##---------------------------------------------------------------------- +## Examples. + +require(lattice) + +data(bib1) +str(bib1) + +xyplot(y~treat|rept, groups=block, data=bib1, type="b", + ylab="Y", xlab="Treatment") + +xyplot(y~treat, data=bib1, jitter.x=TRUE, + ylab="Y", xlab="Treatment") + +xyplot(y~N|P+K, groups=rept, data=bib1, type="b", + ylab="Y", xlab="Nitrogen") + +rm(list=ls()) +load("../data/bib1.RData") +ls() +str(bib1) diff --git a/data-raw/bib2.R b/data-raw/bib2.R new file mode 100644 index 0000000000000000000000000000000000000000..ed0692de0fc6d2b59fb4bdc45b67dd7cbd42681f --- /dev/null +++ b/data-raw/bib2.R @@ -0,0 +1,60 @@ +##---------------------------------------------------------------------- +## Data generation. Pimentel page 192. + +## bib2 <- read.table("clipboard", header=TRUE, sep="\t") +## bib2$y <- as.numeric(sub(x=bib2$y, ",", ".")) +## names(bib2) <- c("rept", "block", "treat", "y") +## bib2 <- transform(bib2, rept=factor(rept), +## block=factor(block), treat=factor(treat)) +## dput(bib2) + +bib2 <- structure(list( + rept = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, + 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, + 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, + 3L, 3L, 3L, 3L, 3L, 3L), + .Label = c("1", "2", "3"), class = "factor"), + block = structure(c(1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 6L, + 7L, 7L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, + 6L, 6L, 7L, 7L, 1L, 1L, 2L, 2L, 3L, 3L, 4L, 4L, + 5L, 5L, 6L, 6L, 7L, 7L), + .Label = c("1", "2", "3", "4", "5", "6", "7"), + class = "factor"), + treat = structure(c(1L, 2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 6L, 7L, + 7L, 1L, 1L, 3L, 3L, 5L, 5L, 7L, 7L, 2L, 2L, 4L, + 4L, 6L, 6L, 1L, 1L, 4L, 4L, 7L, 7L, 3L, 3L, 6L, + 6L, 2L, 2L, 5L, 5L, 1L), + .Label = c("1", "2", "3", "4", "5", "6", "7"), + class = "factor"), + y = c(3.5, 2.8, 3.2, 3.7, 3.5, 2.5, 2.8, 2.7, 3, 3.2, 2.4, 2.6, 3.1, + 2.7, 3.8, 4, 3.6, 2.7, 2.3, 3, 2.8, 2.5, 2.6, 2.8, 2.3, 2.4, + 2.8, 3.3, 3, 2.2, 2.7, 3.4, 3.2, 3.9, 3.3, 2.4, 2.8, 3.4, 2.9, + 2.6, 2.3, 3.3)), + .Names = c("rept", "block", "treat", "y"), + row.names = c(NA, -42L), + class = "data.frame") + +str(bib2) + +bib <- bib2[with(bib2, order(rept, block, treat)), ] + +save(bib2, file="../data/bib2.RData") + +##---------------------------------------------------------------------- +## Examples. + +require(lattice) + +data(bib2) +str(bib2) + +xyplot(y~treat|rept, groups=block, data=bib2, type="b", + ylab="Y", xlab="Treatment") + +xyplot(y~treat, data=bib2, jitter.x=TRUE, + ylab="Y", xlab="Treatment") + +rm(list=ls()) +load("../data/bib2.RData") +ls() +str(bib2) diff --git a/data-raw/bib3.R b/data-raw/bib3.R new file mode 100644 index 0000000000000000000000000000000000000000..f708996410c991c5d9cb59d93c400fda8a154727 --- /dev/null +++ b/data-raw/bib3.R @@ -0,0 +1,62 @@ +##---------------------------------------------------------------------- +## Data generation. Pimentel page 185. + +## bib3 <- read.table("clipboard", header=TRUE, sep="\t") +## names(bib3) <- c("block", "treat", "y") +## bib3 <- transform(bib3, +## block=factor(block), treat=factor(treat)) +## dput(bib3) + +bib3 <- structure(list( + block = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, + 5L, 5L, 5L, 6L, 6L, 6L, 7L, 7L, 7L, 8L, 8L, 8L, + 9L, 9L, 9L, 10L, 10L, 10L), + .Label = c("1", "2", "3", "4", "5", "6", "7", "8", + "9", "10"), + class = "factor"), + treat = structure(c(1L, 2L, 3L, 1L, 2L, 4L, 1L, 2L, 5L, 1L, 3L, 4L, + 1L, 3L, 5L, 1L, 4L, 5L, 2L, 3L, 4L, 2L, 3L, 5L, + 2L, 4L, 5L, 3L, 4L, 5L), + .Label = c("1", "2", "3", "4", "5"), + class = "factor"), + y = c(35L, 28L, 27L, 30L, 20L, 22L, 28L, 16L, 18L, 36L, 29L, 30L, + 29L, 19L, 22L, 25L, 16L, 19L, 26L, 30L, 28L, 27L, 29L, 27L, + 29L, 29L, 27L, 27L, 26L, 29L)), + .Names = c("block", "treat", "y"), + row.names = c(NA, -30L), + class = "data.frame") + +bib <- bib3[with(bib3, order(block, treat)), ] + +save(bib3, file="../data/bib3.RData") + +##---------------------------------------------------------------------- +## Examples. + +require(lattice) + +data(bib3) +str(bib3) + +xyplot(y~treat|block, data=bib3, + ylab="Y", + xlab="Treatment") + +g <- nlevels(bib3$treat) +a <- seq(0, by=(2*pi)/(g), length.out=g) +y <- sin(a) +x <- cos(a) +plot(y~x, asp=1, xlim=c(-1,1), ylim=c(-1,1)) + +for (b in levels(bib3$block)){ + cbn <- combn(x=as.integer(bib3$treat[bib3$block==b]), + m=2) + segments( + x0=x[cbn[1,]], y0=y[cbn[1,]], + x1=x[cbn[2,]], y1=y[cbn[2,]], col=b) +} + +rm(list=ls()) +load("../data/bib3.RData") +ls() +str(bib3) diff --git a/data-raw/bib3asin.R b/data-raw/bib3asin.R new file mode 100644 index 0000000000000000000000000000000000000000..508cde830ce941fcdd488388df43fea72818bd5a --- /dev/null +++ b/data-raw/bib3asin.R @@ -0,0 +1,77 @@ +##---------------------------------------------------------------------- +## Data generation. Pimentel page 198. + +## bib3asin <- read.table("clipboard", header=TRUE, sep="\t") +## bib3asin[, 3] <- as.numeric(sub(x=bib3asin[, 3], ",", ".")) +## names(bib3asin) <- c("block", "treat", "z") +## bib3asin <- transform(bib3asin, +## block=factor(block), treat=factor(treat)) +## dput(bib3asin) + +bib3asin <- structure(list( + block = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, + 12L, 13L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, + 10L, 11L, 12L, 13L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, + 8L, 9L, 10L, 11L, 12L, 13L, 1L, 2L, 3L, 4L, 5L, + 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L), + .Label = c("1", "2", "3", "4", "5", "6", "7", "8", + "9", "10", "11", "12", "13"), + class = "factor"), + treat = structure(c(1L, 2L, 1L, 3L, 4L, 1L, 2L, 1L, 6L, 3L, 5L, 4L, + 2L, 2L, 8L, 7L, 4L, 8L, 3L, 3L, 5L, 10L, 7L, 9L, + 5L, 6L, 4L, 12L, 11L, 6L, 9L, 9L, 5L, 6L, 11L, + 8L, 10L, 7L, 7L, 10L, 13L, 12L, 12L, 11L, 13L, + 11L, 8L, 13L, 10L, 12L, 13L, 9L), + .Label = c("1", "2", "3", "4", "5", "6", "7", "8", + "9", "10", "11", "12", "13"), + class = "factor"), + z = c(52.7, 71.6, 58.9, 75, 71.6, 56.8, 75, 48.8, 63.4, 71.6, 75, + 63.4, 71.6, 79.5, 56.8, 75, 65.9, 75, 65.9, 65.9, 68.6, 90, + 63.4, 68.6, 61.1, 63.4, 63.4, 71.6, 75, 79.5, 71.6, 71.6, + 65.9, 63.4, 90, 61.1, 75, 50.8, 61.1, 65.9, 65.9, 71.6, 79.5, + 79.5, 65.9, 90, 61.1, 71.6, 58.9, 75, 79.5, 75)), + .Names = c("block", "treat", "z"), + row.names = c(NA, -52L), + class = "data.frame") + +bib3asin <- bib3asin[with(bib3asin, order(block, treat)), ] + +save(bib3asin, file="../data/bib3asin.RData") + +##---------------------------------------------------------------------- +## Examples. + +require(lattice) + +data(bib3asin) +str(bib3asin) + +xyplot(z~treat|block, data=bib3asin, + ylab="Arc sin of heathy plants fraction", + xlab="Treatment") + +## Why not consider a beta distribution for p? +bib3asin$p <- sin(bib3asin$z*pi/180)^2 + +xyplot(p~treat|block, data=bib3asin, + ylab="Fraction of healthy plants", + xlab="Treatment") + +g <- nlevels(bib3asin$treat) +a <- seq(0, by=(2*pi)/(g), length.out=g) +y <- sin(a) +x <- cos(a) +plot(y~x, asp=1, xlim=c(-1,1), ylim=c(-1,1)) + +for (b in levels(bib3asin$block)){ + cbn <- combn(x=as.integer(bib3asin$treat[bib3asin$block==b]), + m=2) + segments( + x0=x[cbn[1,]], y0=y[cbn[1,]], + x1=x[cbn[2,]], y1=y[cbn[2,]], col=b) +} + +rm(list=ls()) +load("../data/bib3asin.RData") +ls() +str(bib3asin) diff --git a/data/bib1.RData b/data/bib1.RData new file mode 100644 index 0000000000000000000000000000000000000000..26f9b0921a0dd9b30d96329f43d525dd87ba86e1 Binary files /dev/null and b/data/bib1.RData differ diff --git a/data/bib2.RData b/data/bib2.RData new file mode 100644 index 0000000000000000000000000000000000000000..47930bd56843028b2c404d9abdcc61b4f76b14fa Binary files /dev/null and b/data/bib2.RData differ diff --git a/data/bib3.RData b/data/bib3.RData new file mode 100644 index 0000000000000000000000000000000000000000..7d2db17aaa692a1944f2c93437ce46ded23ea729 Binary files /dev/null and b/data/bib3.RData differ diff --git a/data/bib3asin.RData b/data/bib3asin.RData new file mode 100644 index 0000000000000000000000000000000000000000..f4a3b225ec6291f0686030f14b6e2b55cd57e93b Binary files /dev/null and b/data/bib3asin.RData differ diff --git a/man/bib1.Rd b/man/bib1.Rd new file mode 100644 index 0000000000000000000000000000000000000000..8382ce121b56f716ec658cc36550f9ea24e8b2fb --- /dev/null +++ b/man/bib1.Rd @@ -0,0 +1,62 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/legTools.R +\docType{data} +\name{bib1} +\alias{bib1} +\title{A balanced incomplete block design of type I} +\format{a \code{data.frame} with 56 records and 4 variables.} +\source{ +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 190) +} +\usage{ +data(bib1) +} +\description{ +This data is under a balanced complete block design + named type I. There are 7 replications that are groups of 4 + blocks of size 2 in a such a way that each treatment occurs once + in each replication and 7 times at all. There are 8 treatments, + 28 blocks at all. Treatment occur in pairs once. These treatments + are in fact cells of a \eqn{2^3} factorial design from combining + nitrogen (P), phosphorus (P) and potassium (K) fertilizers at two + levels each. + +\itemize{ + +\item \code{rept} a categorical unordered factor with 7 levels. Each + \code{rept} has 4 bloks of size 2. + +\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} a categorical unordered factor with 4 levels in + each \code{rept}, so 28 at all. + +\item \code{treat} a categorical unordered factor with 8 levels, the + treatments studied. + +\item \code{y} some response variable. The book doesn't gave details. + +} +} +\examples{ +require(lattice) + +data(bib1) +str(bib1) + +xyplot(y~treat|rept, groups=block, data=bib1, type="b", + ylab="Y", xlab="Treatment") + +xyplot(y~treat, data=bib1, jitter.x=TRUE, + ylab="Y", xlab="Treatment") + +xyplot(y~N|P+K, groups=rept, data=bib1, type="b", + ylab="Y", xlab="Nitrogen") +} +\keyword{datasets} + diff --git a/man/bib2.Rd b/man/bib2.Rd new file mode 100644 index 0000000000000000000000000000000000000000..c8224c5d68d50d04bf80a95423b5c21136039b6b --- /dev/null +++ b/man/bib2.Rd @@ -0,0 +1,50 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/legTools.R +\docType{data} +\name{bib2} +\alias{bib2} +\title{A balanced incomplete block design of type II} +\format{a \code{data.frame} with 42 records and 4 variables.} +\source{ +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 192) +} +\usage{ +data(bib2) +} +\description{ +This data is under a balanced complete block design + named type II. There are 3 replications that are groups of 7 + blocks of size 2 in a such a way that each treatment occurs twice + in each replication and 6 times at all. There are 7 treatments + and 21 blocks at all. Treatments occur in pairs once. + +\itemize{ + +\item \code{rept} a categorical unordered factor with 3 levels. Each + \code{rept} has 7 bloks of size 2. + +\item \code{block} a categorical unordered factor with 8 levels in + each \code{rept}, so 21 at all. + +\item \code{treat} a categorical unordered factor with 7 levels, the + treatments studied. + +\item \code{y} some response variable. The book doesn't gave details. + +} +} +\examples{ +require(lattice) + +data(bib2) +str(bib2) + +xyplot(y~treat|rept, groups=block, data=bib2, type="b", + ylab="Y", xlab="Treatment") + +xyplot(y~treat, data=bib2, jitter.x=TRUE, + ylab="Y", xlab="Treatment") +} +\keyword{datasets} + diff --git a/man/bib3.Rd b/man/bib3.Rd new file mode 100644 index 0000000000000000000000000000000000000000..b9b0d763cc7dbab926aa4c1e59671a816ddff0ee --- /dev/null +++ b/man/bib3.Rd @@ -0,0 +1,57 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/legTools.R +\docType{data} +\name{bib3} +\alias{bib3} +\title{A balanced incomplete block design of type III} +\format{a \code{data.frame} with 30 records and 3 variables.} +\source{ +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 185) +} +\usage{ +data(bib3) +} +\description{ +This data is under a balanced complete block design + named type III. There are 5 treatments and 10 blocks of size 3 + plots. Each treatment is repeated 6 times and they occour + together (in pairs) 3 times. + +\itemize{ + +\item \code{block} a categorical unordered factor with 10 levels. + +\item \code{treat} a categorical unordered factor with 5 levels, the + treatments studied. + +\item \code{y} some response variable. The book doesn't gave details. + +} +} +\examples{ +require(lattice) + +data(bib3) +str(bib3) + +xyplot(y~treat|block, data=bib3, + ylab="Y", + xlab="Treatment") + +g <- nlevels(bib3$treat) +a <- seq(0, by=(2*pi)/(g), length.out=g) +y <- sin(a) +x <- cos(a) +plot(y~x, asp=1, xlim=c(-1,1), ylim=c(-1,1)) + +for (b in levels(bib3$block)){ + cbn <- combn(x=as.integer(bib3$treat[bib3$block==b]), + m=2) + segments( + x0=x[cbn[1,]], y0=y[cbn[1,]], + x1=x[cbn[2,]], y1=y[cbn[2,]], col=b) +} +} +\keyword{datasets} + diff --git a/man/bib3asin.Rd b/man/bib3asin.Rd new file mode 100644 index 0000000000000000000000000000000000000000..206f7b45f0ec2580c6d9acab7228a1f9cb80bae7 --- /dev/null +++ b/man/bib3asin.Rd @@ -0,0 +1,71 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/legTools.R +\docType{data} +\name{bib3asin} +\alias{bib3asin} +\title{A balanced incomplete block design of type III} +\format{a \code{data.frame} with 52 records and 3 variables.} +\source{ +Pimentel Gomes, F. (2009). Curso de Estatística Experimental + (15th ed.). Piracicaba, São Paulo: FEALQ. (page 198) + +Fraga Jr., C. G.; Costa, A. S. (1950). Análise de um experimento para + combate de vira-cabeça do tomateiro. Bragantia, 10:305-316. +} +\usage{ +data(bib3asin) +} +\description{ +This data is under a balanced complete block design + named type III. There are 13 treatments and 13 blocks of size 4 + plots. Each treatment is repeated 6 times and they occour + together (in pairs) only once. + +\itemize{ + +\item \code{block} a categorical unordered factor with 13 levels. + +\item \code{treat} a categorical unordered factor with 13 levels, the + treatments studied. + +\item \code{z} correpond a transformation of the original recorded + variable, the observed percentual of healthy plants, \eqn{p}. So, + \eqn{z = \arcsin{\sqrt{p/100}}}, in radians is applied to + stabilize the variance to comply with the assumption of constant + variance. + +} +} +\examples{ +require(lattice) + +data(bib3asin) +str(bib3asin) + +xyplot(z~treat|block, data=bib3asin, + ylab="Arc sin of heathy plants fraction", + xlab="Treatment") + +## Why not consider a beta distribution for p? +bib3asin$p <- sin(bib3asin$z*pi/180)^2 + +xyplot(p~treat|block, data=bib3asin, + ylab="Fraction of healthy plants", + xlab="Treatment") + +g <- nlevels(bib3asin$treat) +a <- seq(0, by=(2*pi)/(g), length.out=g) +y <- sin(a) +x <- cos(a) +plot(y~x, asp=1, xlim=c(-1,1), ylim=c(-1,1)) + +for (b in levels(bib3asin$block)){ + cbn <- combn(x=as.integer(bib3asin$treat[bib3asin$block==b]), + m=2) + segments( + x0=x[cbn[1,]], y0=y[cbn[1,]], + x1=x[cbn[2,]], y1=y[cbn[2,]], col=b) +} +} +\keyword{datasets} +