Package 'easyanova'

Title: Analysis of Variance and Other Important Complementary Analyses
Description: Perform analysis of variance and other important complementary analyses. The functions are easy to use. Performs analysis in various designs, with balanced and unbalanced data.
Authors: Emmanuel Arnhold [aut, cre]
Maintainer: Emmanuel Arnhold <[email protected]>
License: GPL-2
Version: 11.0
Built: 2024-12-16 06:58:09 UTC
Source: CRAN

Help Index


Analysis of Variance and Other Important Complementary Analyzes

Description

Perform analysis of variance and other important complementary analyzes. The functions are easy to use. Performs analysis in various designs, with balanced and unbalanced data.

Details

Package: easyanova
Type: Package
Version: 11.0
Date: 2024-09-14
License: GPL-2

Author(s)

Emmanuel Arnhold <[email protected]>

References

CRUZ, C.D. and CARNEIRO, P.C.S. Modelos biometricos aplicados ao melhoramento genetico. 2nd Edition. Vicosa, UFV, v.2, 2006. 585p.

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.

SANDERS W.L. and GAYNOR, P.J. Analysis of switchback data using Statistical Analysis System, Inc. Software. Journal of Dairy Science, 70.2186-2191. 1987.

PIMENTEL-GOMES, F. and GARCIA C.H. Estatistica aplicada a experimentos agronomicos e florestais: exposicao com exemplos e orientacoes para uso de aplicativos. Editora Fealq, v.11, 2002. 309p.

RAMALHO, M. A. P.; FERREIRA, D. F. and OLIVEIRA, A. C. Experimentacao em Genetica e Melhoramento de Plantas. Editora UFLA, 2005, 322p.

See Also

ea1, ea2, ec

Examples

# Kaps and Lamberson(2009)
data(data1)
data(data2)
data(data3)
data(data4)

# analysis in completely randomized design
r1<-ea1(data1, design=1)

names(r1)

r1

# analysis in randomized block design
r2<-ea1(data2, design=2)

# analysis in latin square design
r3<-ea1(data3, design=3)

# analysis in several latin squares design
r4<-ea1(data4, design=4)

r1[1]
r2[1]
r3[1]
r4[1]

# analysis in unbalanced randomized block design
response<-ifelse(data2$Gain>850, NA, data2$Gain)
ndata<-data.frame(data2[-3],response)
ndata

r5<-ea1(ndata, design=2 )

r5

# multivariable response (list argument = TRUE)
t<-c('a','a','a','b','b','b','c','c','c')
r1<-c(10,12,12.8,4,6,8,14,15,16)
r2<-c(102,105,106,125,123,124,99,95,96)
r3<-c(560,589,590,658,678,629,369,389,378)


d<-data.frame(t,r1,r2,r3)

results=ea1(d, design=1, list=TRUE)
names(results)
results

results[1][[1]]

names(results[1][[1]])

Box plot

Description

Plot quartis

Usage

box.plot(data,test=1, xlab=NULL, ylab=NULL,legend=TRUE,
letters=TRUE, family="Times", bg="white",  cex.axis=0.7,...)

Arguments

data

data.frame with data (see examples)

test

type of test 1 = Kruskall-Wallis 2 = Friedman

xlab

name of x-axis

ylab

name of y-axis

legend

TRUE = plot p-value of test FALSE = not plot p-value

letters

TRUE = plot letters FALSE = not plot letters

family

font of plot

bg

background color

cex.axis

font size in the axis

...

more plot parameters

Value

Returns box plots and test of Kruskall-Wallis and Friedman

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2, means.plot

Examples

#data3: Kaps and Lamberson (2009)
#Description:
##The experiment compared three diets for pigs in a completely randomized design
data(data1)

# Kruskal-Wallis test
box.plot(data1, test=1)

#Description
#Complete randomized block design to determine the average daily gain of steers
data(data2)
box.plot(data2, test=2)

#More plot parameters
box.plot(data2, test=2, col=c(2,7,3), col.axis="red",las=1, 
legend=FALSE, bg="cornsilk", sub="Treatments", cex=1.2);grid(10, lwd=1.5)

data1: Kaps and Lamberson(2009): page 252

Description

The experiment compared three diets for pigs in a completely randomized design

Usage

data(data1)

Format

A data frame with 15 observations on the following 2 variables.

Diet

a factor with levels d1 d2 d3

Gain

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data1)
summary(data1)

data10: Kaps and Lamberson (2009): page 395

Description

Completely randomized design with a covariate.The effect of three diets on daily gain of steers was investigated. The design was a completely randomized design. Weight at the beginning of the experiment (initial weight) was recorded, but not used in the assignment of animals to diet.

Usage

data(data10)

Format

A data frame with 15 observations on the following 4 variables.

Diets

a factor with levels A B C

Initial_weight

a numeric vector

Repetitions

a numeric vector

Gain

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data10)
summary(data10)

data11: Pimentel Gomes and Garcia (2002): page 199

Description

Incomplete block design

Usage

data(data11)

Format

A data frame with 56 observations on the following 4 variables.

treatments

a numeric vector

rep

a numeric vector

blocks

a numeric vector

yield

a numeric vector

References

PIMENTEL-GOMES, F. and GARCIA C.H. Estatistica aplicada a experimentos agronomicos e florestais: exposicao com exemplos e orientacoes para uso de aplicativos. Editora Fealq, v.11, 2002. 309p.

Examples

data(data11)
summary(data11)

data12: Pimentel Gomes and Garcia (2002): page 202

Description

Incomplete block design

Usage

data(data12)

Format

A data frame with 42 observations on the following 4 variables.

treatments

a numeric vector

rep

a numeric vector

blocks

a numeric vector

yield

a numeric vector

References

PIMENTEL-GOMES, F. and GARCIA C.H. Estatistica aplicada a experimentos agronomicos e florestais: exposicao com exemplos e orientacoes para uso de aplicativos. Editora Fealq, v.11, 2002. 309p.

Examples

data(data12)
summary(data12)

data13: Cruz and Carneiro (2006): page 575

Description

Incomplete block design

Usage

data(data13)

Format

A data frame with 23 observations on the following 3 variables.

genotypes

a factor with levels f1 f10 f11 f12 f13 f14 f2 f3 f4 f5 f6 f7 f8 f9 test1 test2 test3

blocks

a factor with levels b1 b2 b3

yield

a numeric vector

References

CRUZ, C.D. and CARNEIRO, P.C.S. Modelos biometricos aplicados ao melhoramento genetico. 2nd Edition. Vicosa, UFV, v.2, 2006. 585p.

Examples

data(data13)
summary(data13)

data14: Sampaio (2009): page173

Description

Incomplete block design in animals

Usage

data(data14)

Format

A data frame with 28 observations on the following 4 variables.

treatment

a factor with levels A B C D E F G

animal

a factor with levels A1 A2 A3 A4 A5 A6 A7

period

a factor with levels P1 P2 P3 P4

response

a numeric vector

References

SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.

Examples

data(data14)
summary(data14)

data15: Pimentel Gomes and Garcia (2002): page 211

Description

Lattice design

Usage

data(data15)

Format

A data frame with 48 observations on the following 4 variables.

treatments

a numeric vector

rep

a numeric vector

blocks

a numeric vector

yield

a numeric vector

References

PIMENTEL-GOMES, F. and GARCIA C.H. Estatistica aplicada a experimentos agronomicos e florestais: exposicao com exemplos e orientacoes para uso de aplicativos. Editora Fealq, v.11, 2002. 309p.

Examples

data(data15)
summary(data15)

data16: Sampaio (2010): page164

Description

Switchback design

Usage

data(data16)

Format

A data frame with 36 observations on the following 4 variables.

treatment

a factor with levels A B C

period

a numeric vector

animal

a numeric vector

gain

a numeric vector

References

SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.

Examples

data(data16)
summary(data16)

data17: Sanders and Gaynor (1987)

Description

Switchback design

Usage

data(data17)

Format

A data frame with 36 observations on the following 5 variables.

treatments

a numeric vector

blocks

a factor with levels b1 b2 b3

period

a numeric vector

animal

a numeric vector

gain

a numeric vector

References

SANDERS W.L. and GAYNOR, P.J. Analysis of switchback data using Statistical Analysis System, Inc. Software. Journal of Dairy Science, 70.2186-2191. 1987.

Examples

data(data17)
summary(data17)

data18: Ramalho et al. (2005): page 115

Description

Repetition of experiments in block design

Usage

data(data18)

Format

A data frame with 60 observations on the following 4 variables.

treatments

a numeric vector

experiments

a numeric vector

blocks

a numeric vector

response

a numeric vector

References

RAMALHO, M. A. P.; FERREIRA, D. F. and OLIVEIRA, A. C. Experimentacao em Genetica e Melhoramento de Plantas. Editora UFLA, 2005, 322p.

Examples

data(data18)
summary(data18)

data19: Sampaio (2010): page 155

Description

Repetition of latin square design

Usage

data(data19)

Format

A data frame with 32 observations on the following 5 variables.

treatments

a factor with levels A B C D

squares

a factor with levels 1 2

rows

a factor with levels 1 2 3 4

columns

a factor with levels 1 2 3 4

response

a numeric vector

References

SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.

Examples

data(data19)
summary(data19)

data2: Kaps and Lamberson (2009): page 313: randomizad block design

Description

Complete randomized block design to determine the average daily gain of steers

Usage

data(data2)

Format

A data frame with 12 observations on the following 3 variables.

Treatments

a factor with levels t1 t2 t3

Blocks

a factor with levels b1 b2 b3 b4

Gain

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data2)
summary(data2)

data3: Kaps and Lamberson (2009): page 347

Description

Latin square design for test four different treatments on hay intake of fattening steers

Usage

data(data3)

Format

A data frame with 16 observations on the following 4 variables.

treatment

a factor with levels A B C D

period

a factor with levels p1 p2 p3 p4

steer

a factor with levels a1 a2 a3 a4

response

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data3)
summary(data3)

data4: Kaps and Lamberson (2009): page 349

Description

Two latin squares design for test four different treatments on hay intake of fattening steers

Usage

data(data4)

Format

A data frame with 32 observations on the following 5 variables.

diet

a factor with levels A B C D

square

a numeric vector

steer

a numeric vector

period

a numeric vector

response

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data4)
summary(data4)

data5: Kaps and Lamberson (2009): page 361

Description

Factorial in randomized design for testing two vitamins in feed of pigs

Usage

data(data5)

Format

A data frame with 20 observations on the following 3 variables.

Vitamin_1

a numeric vector

Vitamin_2

a numeric vector

Gains

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data5)
summary(data5)

data6: Pimentel Gomes and Garcia (2002): page 127

Description

Factorial in randomized block design

Usage

data(data6)

Format

A data frame with 16 observations on the following 4 variables.

factor1

a numeric vector

factor2

a numeric vector

block

a numeric vector

yield

a numeric vector

References

PIMENTEL-GOMES, F. and GARCIA C.H. Estatistica aplicada a experimentos agronomicos e florestais: exposicao com exemplos e orientacoes para uso de aplicativos. Editora Fealq, v.11, 2002. 309p.

Examples

data(data6)
summary(data6)

data7: Kaps and Lamberson (2009): page 409

Description

The aim of this experiment was to test the difference between two treatments on gain of kids. A sample of 18 kids was chosen, nine for each treatment. One kid in treatment 1 was removed from the experiment due to illness. The experiment began at the age of 8 weeks. Weekly gain was measured at ages 9, 10, 11 and 12 weeks.

Usage

data(data7)

Format

A data frame with 68 observations on the following 4 variables.

treatment

a character vector

rep

a numeric vector

week

a character vector

gain

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data7)
summary(data7)

data8: Kaps and Lamberson (2009): page 386

Description

Split-plot Design. Main Plots in Randomized Blocks. An experiment was conducted in order to investigate four different treatments of pasture and two mineral supplements on milk yield. The total number of cows available was 24. The experiment was designed as a split-plot, with pasture treatments (factor A) assigned to the main plots and mineral supplements (factor B) assigned to split-plots. The experiment was replicated in three blocks.

Usage

data(data8)

Format

A data frame with 24 observations on the following 4 variables.

pasture

a factor with levels p1 p2 p3 p4

block

a numeric vector

mineral

a factor with levels m1 m2

milk

a numeric vector

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

Examples

data(data8)
summary(data8)

data9: Sampaio (2010): page 67

Description

Factorial design to evaluate egg quality according to the lineage of chicken, packaging and storage time.

Usage

data(data9)

Format

A data frame with 120 observations on the following 5 variables.

lineage

a factor with levels A B

packing

a factor with levels Ce Co S

time

a numeric vector

repetitions

a numeric vector

response

a numeric vector

References

SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.

Examples

data(data9)
summary(data9)

Analysis of variance in simple designs

Description

Perform analysis of variance and other important complementary analyzes. The function are easy to use. Performs analysis in various simples designs, with balanced and unbalanced data. Too performs analysis the kruskal-Wallis and Friedman (designs 14 and 15).

Usage

ea1(data, design = 1, alpha = 0.05, list = FALSE, p.adjust=1, plot=2)

Arguments

data

data is a data.frame

see how the input data in the examples

design

1 = completely randomized design

2 = randomized block design

3 = latin square design

4 = several latin squares

5 = analysis with a covariate (completely randomized design)

6 = analysis with a covariate (randomized block design)

7 = incomplete blocks type I and II

8 = incomplete blocks type III or augmented blocks

9 = incomplete blocks type III in animal experiments

10 = lattice (intra-block analysis)

11 = lattice (inter-block analysis)

12 = switchback design

13 = switchback design in blocks

14 = Kruskal-Wallis rank sum test

15 = Friedman rank sum test

alpha

significance level for multiple comparisons

list

FALSE = a single response variable

TRUE = multivariable response

p.adjust

1="none"; 2="holm"; 3="hochberg"; 4="hommel"; 5="bonferroni"; 6="BH", 7="BY"; 8="fdr"; for more details see function "p.adjust"

plot

1 = box plot for residuals; 2 = standardized residuals vs sequence data; 3 = standardized residuals vs theoretical quantiles

Details

The response variable must be numeric. Other variables can be numeric or factors.

Value

Returns analysis of variance, means (adjusted means), multiple comparison test (tukey, snk, duncan, t and scott knott) and residual analysis. Too returns analysis the kruskal-Wallis and Friedman (designs 14 and 15).

Author(s)

Emmanuel Arnhold <[email protected]>

References

CRUZ, C.D. and CARNEIRO, P.C.S. Modelos biometricos aplicados ao melhoramento genetico. 2nd Edition. Vicosa, UFV, v.2, 2006. 585p.

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.

SANDERS W.L. and GAYNOR, P.J. Analysis of switchback data using Statistical Analysis System, Inc. Software. Journal of Dairy Science, 70.2186-2191. 1987.

PIMENTEL-GOMES, F. and GARCIA C.H. Estatistica aplicada a experimentos agronomicos e florestais: exposicao com exemplos e orientacoes para uso de aplicativos. Editora Fealq, v.11, 2002. 309p.

See Also

ea2, ec

Examples

# Kaps and Lamberson(2009)
data(data1)
data(data2)
data(data3)
data(data4)

# analysis in completely randomized design
r1<-ea1(data1, design=1)

names(r1)

r1

# analysis in randomized block design
r2<-ea1(data2, design=2)

# analysis in latin square design
r3<-ea1(data3, design=3)

# analysis in several latin squares design
r4<-ea1(data4, design=4)

r1[1]
r2[1]
r3[1]
r4[1]

# analysis in unbalanced randomized block design
response<-ifelse(data2$Gain>850, NA, data2$Gain)
ndata<-data.frame(data2[-3],response)
ndata

r5<-ea1(ndata, design=2 )

r5

# multivariable response (list argument = TRUE)
t<-c('a','a','a','b','b','b','c','c','c')
r1<-c(10,12,12.8,4,6,8,14,15,16)
r2<-c(102,105,106,125,123,124,99,95,96)
r3<-c(560,589,590,658,678,629,369,389,378)


d<-data.frame(t,r1,r2,r3)

results=ea1(d, design=1, list=TRUE)
names(results)
results

results[1][[1]]

names(results[1][[1]])

# analysis with a covariate
# Kaps and Lamberson (2009)
data(data10)

# analysis in completely randomized design
r6<-ea1(data10[-3], design=5)

r6


# incomplete blocks type I and II
# Pimentel Gomes and Garcia (2002)
data(data11)
data(data12)

r7<-ea1(data11,design=7)
r8<-ea1(data12,design=7)

r7;r8


# incomplete blocks type III or augmented blocks 
# Cruz and Carneiro (2006)
data(data13)

r9<-ea1(data13, design=8)
r9



# incomplete blocks type III in animal experiments
# Sampaio (2010)
data(data14)

r10<-ea1(data14, design=9)
r10

# lattice 
# Pimentel Gomes and Garcia (2002)
data(data15)

r11<-ea1(data15, design=10) # intra-block analysis 
r12<-ea1(data15, design=11) # inter-block analysis

r11
r12

# switchback design
# Sampaio (2010)
data(data16)
r13<-ea1(data16, design=12)
r13

# switchback design in blocks
# Sanders and Gaynor (1987)
data(data17)
r14<-ea1(data17, design=13)
r14

#Kruskal-Wallis Rank Sum Test
r15<-ea1(data1, design=14)
r15

#Friedman Rank Sum Test
r16<-ea1(data2, design=15)
r16


# Graeco-Latin Square
#latin letters
treatment=c("A","B","C","D","E","B","C","D","E","A","C",
"D","E","A","B","D","E","A","B","C","E","A","B","C","D")
##blocked factors
#greek letters 
block=c(1,2,3,4,5,3,4,5,1,2,5,1,2,3,4,2,3,4,5,1,4,5,1,2,3)
# rowns
rows=rep(1:5,5)
#coluns
columns=rep(1:5, each=5)
#variable 
response=c(-1,-8,-7,1,-3,-5,-1,13,6,5,-6,5,1,1,-5,-1,2,2,-2,4,-1,11,-4,-3,6)
# table
data=data.frame(treatment, block, rows, columns, response)
r16=ea1(data, design=16)
r16

### Repetitions of Graeco-Latin Square
#latin letters
treatment=c("A","B","C","D","E","B","C","D","E",
"A","C","D","E","A","B","D","E","A","B","C","E","A","B","C","D",
"A","B","C","D","E","B","C","D","E","A","C","D",
"E","A","B","D","E","A","B","C","E","A","B","C","D")
#squares
squares=rep(1:2,25)
##blocked factors
#greek letters 
block=c(1,2,3,4,5,3,4,5,1,2,5,1,2,3,4,2,3,4,5,1,4,5,1,2,3,
1,2,3,4,5,3,4,5,1,2,5,1,2,3,4,2,3,4,5,1,4,5,1,2,3)
# rowns
rows=c(rep(1:5,5),rep(1:5,5))
#coluns
columns=c(rep(1:5, each=5),rep(1:5, each=5))
#variable 
response=c(-1,-8,-7,1,-3,-5,-1,13,6,5,-6,5,1,1,-5,-1,2,2,-2,4,-1,11,-4,-3,6,
-2,-9,-8,1,-2,-5,-1,9,6,5,-5,2,3,1,-7,-1,2,4,-1,2,-2,15,-5,-1,7)

# table
data=data.frame(treatment, squares, block, rows, columns, response)
r17=ea1(data, design=17)
r17

Analysis of variance in factorial and split plot

Description

Perform analysis of variance and other important complementary analyzes in factorial and split plot scheme, with balanced and unbalanced data.

Usage

ea2(data, design = 1, alpha = 0.05, cov = 4, list = FALSE, p.adjust=1, plot=2)

Arguments

data

data is a data.frame

see how the input data in the examples

design

1 = double factorial in completely randomized design

2 = double factorial in randomized block design

3 = double factorial in latin square design

4 = split plot in completely randomized design

5 = split plot in randomized block design

6 = split plot in latin square design

7 = triple factorial in completely randomized design

8 = triple factorial in randomized block design

9 = double factorial in split plot (completely randomized)

10 = double factorial in split plot (randomized in block)

11 = joint analysis of experiments with hierarchical blocks

12 = joint analysis of repetitions of latin squares (hierarchical rows)

13 = joint analysis of repetitions of latin squares (hierarchical rows and columns)

alpha

significance level for multiple comparisons

cov

for split plot designs

1 = Autoregressive

2 = Heterogenius Autoregressive

3 = Continuous Autoregressive Process

4 = Compound Symetry

5 = Unstructured

list

FALSE = a single response variable

TRUE = multivariable response

p.adjust

1="none"; 2="holm"; 3="hochberg"; 4="hommel"; 5="bonferroni"; 6="BH", 7="BY"; 8="fdr"; for more details see function "p.adjust"

plot

1 = box plot for residuals; 2 = standardized residuals vs sequence data; 3 = standardized residuals vs theoretical quantiles

Details

The response variable must be numeric. Other variables can be numeric or factors.

Value

Returns analysis of variance, means (adjusted means), multiple comparison test (tukey, snk, duncan, t and scott knott) and residual analysis.

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

SAMPAIO, I. B. M. Estatistica aplicada a experimentacao animal. 3nd Edition. Belo Horizonte: Editora FEPMVZ, Fundacao de Ensino e Pesquisa em Medicina Veterinaria e Zootecnia, 2010. 264p.

PIMENTEL-GOMES, F. and GARCIA C.H. Estatistica aplicada a experimentos agronomicos e florestais: exposicao com exemplos e orientacoes para uso de aplicativos. Editora Fealq, v.11, 2002. 309p.

RAMALHO, M. A. P.; FERREIRA, D. F. and OLIVEIRA, A. C. Experimentacao em Genetica e Melhoramento de Plantas. Editora UFLA, 2005, 322p.

See Also

ea1, ec

Examples

# double factorial

# completely randomized design
data(data5)
r1=ea2(data5, design=1) 
r1  

# randomized block design
# data(data6)
# r2=ea2(data6, design=2) 
# r2      
 
# names(r1)

# names(r2)

# triple factorial

# completely randomized design
# data(data9)
# r3=ea2(data9[,-4], design=7) 
# r3[1]  


# split plot

# completely randomized design
# data(data7)
# r4=ea2(data7, design=4)
# r4

# randomized block design
# data(data8)
# r5=ea2(data8, design=5)
# r5

# hierarchical blocks
# Ramalho et al. (2005)
# data(data18)
# data18
# r6=ea2(data18, design=11)
# r6

# hierarchical latin squares 
# Sampaio (2010)
# data(data19)
# data19
# r7=ea2(data19, design=12)
# r8=ea2(data19, design=13)

# hierarchical rows
# r7

# hierarchical rows and columns
# r8

#split.plot in latin square
        #data(data3)
        #d=rbind(data3,data3)
        #d=data3[,-4];d=data.frame(d,time=rep(1:2,each=16),response=rnorm(32,45,4))
# r9=ea2(d,design=6)
# r9

Easy contrast

Description

Performs contrasts of means

Usage

ec(mg1, mg2, sdg1, sdg2, df)

Arguments

mg1

Means of the group 1

mg2

Means of the group 2

sdg1

Standard error of the group 1

sdg2

Standard error of the group 2

df

Degree of freedom from error

Value

Returns t test for contrast

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2

Examples

# Kaps and Lamberson(2009, pg 254)

data(data1)

r<-ea1(data1, design=1)
r[2]

# first contrast
mg1=312;mg2=c(278,280); sdg1=7.7028;sdg2=c(7.7028,7.7028); df=12
ec(mg1,mg2,sdg1,sdg2,df)

# second contrast
mg1=280;mg2=278; sdg1=7.7028;sdg2=7.7028; df=12
ec(mg1,mg2,sdg1,sdg2,df)

Confidence intervals of contrasts

Description

Estimate of confidence intervals of the contrasts

Usage

ic(data, test=1, df=10, alpha=0.05)

Arguments

data

output object of ea1 or ea2 function (see examples)

test

Letters of the post-hoc test 1=Tukey 2=SNK 3=Duncan 4=t 5=Scott-Knott

df

degree of freedom of residuals in anova

alpha

significance level

Value

Returns confidence intervals of the contrasts

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2, box.plot, means.plot, means.plotfat, ic.plot, p.plot

Examples

#data3: Kaps and Lamberson (2009): page 347
#Description:
##Latin square design for test four different treatments on hay intake of fattening steers

data(data3)

r<-ea1(data3, design=3)


#plot
#means
means=r[[2]]
means
ic(means, test=1, df=6) # tukey

# alpha = 0.10
ic(r[[2]], test=1, df=6, alpha=0.10) 


# split plot
data('data7')
r<-ea2(data7,4)

#plot
ic(r[2], df=15)

#split.plot
ic(r[4], df=45)

Plot confidence intervals of contrasts

Description

Plot confidence intervals of contrasts

Usage

ic.plot(data,col="dark green", cex=0.5, xlab="constrats",
pch=19,family="Times", bg="white",...)

Arguments

data

output object of ic (see examples)

col

colours of lines

cex

size of points

xlab

title of x-axis

pch

type of points

family

font of plot

bg

background color

...

more plot parameters

Value

Plot confidence intervals of contrasts

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2, box.plot, means.plot, means.plotfat, ic.plot, p.plot

Examples

#data3: Kaps and Lamberson (2009): page 347
#Description:
##Latin square design for test four different treatments on hay intake of fattening steers

data(data3)

r<-ea1(data3, design=3)


#plot
#means
means=r[[2]]
means
ic(means, test=1, df=6) # tukey

#intervals
conf=ic(means, test=1, df=6)

#plot intervals
ic.plot(conf)

#more plot parameters
ic.plot(conf, las=2, bg="cornsilk");grid(10)

Plot Means

Description

Plot contrasts of means

Usage

m.plot(data,  s="sd",test="tukey", family="Times", bg="white",  cex.text=0.7, 
cex=0.5,bar.order=2, decreasing=TRUE, xlab="treatments", ylab="",pch=19, ...)

Arguments

data

output object of ea1 or ea2 function (see examples)

s

s="sd" (defalt) plot standard deviation s="sem" plot standard error of mean

test

Letters of the post-hoc test test="tukey" (default) test="snk" test="duncan" test="t" test="scott_knott"

family

font of plot

bg

background color

cex.text

font size in letters and means

cex

font size in points

bar.order

order of bar or means 1 = order of treatments names 2 = order of the means (default)

decreasing

decreasing bar order (TRUE or FALSE)

xlab

title of x-axis

ylab

title of y-axis

pch

type of points

...

more plot parameters

Value

Returns plots of means

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2, box.plot, means.plot, means.plotfat, ic, ic.plot, p.plot

Examples

#data3: Kaps and Lamberson (2009): page 347
#Description:
##Latin square design for test four different treatments on hay intake of fattening steers

data(data3)

r<-ea1(data3, design=3)


#plot
#means
means=r[[2]]
means
m.plot(means, col=gray.colors(4))

#direct
m.plot(r[[2]], col=gray.colors(4))

# more graphical parameters
m.plot(means, col=c(2,7,3,5), bg="white", las=1, cex.text=1,main="Tukey (0.05)", 
family="sans", bar.order=2, decreasing=FALSE);grid(10)

data('data7')
r<-ea2(data7,4)
m.plot(r[[4]], col=c(2,7,3,5), las=1, bg="cornsilk");grid(10)

par(mfrow=c(1,2))
m.plot(r[[8]][1], test="scott_knott",xlab="treatment 1",col=c(2,7,3,5), 
las=2, bg="cornsilk",bar.order=2, decreasing=FALSE);grid(10)
m.plot(r[[8]][2], test="scott_knott",xlab="treatment 2", col=c(2,7,3,5), 
las=2, bg="cornsilk", bar.order=2, decreasing=FALSE);grid(10)

Plot Means

Description

Plot contrasts of means

Usage

means.plot(data, plot=1, s=1,test=1, legend=TRUE, letters=TRUE,
family="Times", bg="white",cex.names=0.8, cex.text=0.7, cex.legend=1, 
bar.order=2, decreasing=TRUE, alpha=0.05,cex=0.5, pch=19,  ...)

Arguments

data

output object of ea1 function (see examples)

plot

type of plot 1 = bar plot (default) 2 = means plot 3 = confidence interval of the contrasts

s

s=1 (defalt) plot standard deviation s=2 plot standard error of mean

test

Letters of the post-hoc test 1=Tukey 2=SNK 3=Duncan 4=t 5=Scott-Knott

legend

TRUE = plot p-value of F test FALSE = not plot p-value

letters

TRUE = plot letters FALSE = not plot letters

family

font of plot

bg

background color

cex.names

font size in names of treatments (x-axis)

cex.text

font size in letters and means

cex.legend

font size in legend

bar.order

order of bar or means 1 = order of treatments names 2 = order of the means (default)

decreasing

decreasing bar order (TRUE or FALSE)

alpha

0.05 (default) is the alpha of confidence intervals

cex

size of points

pch

type of points

...

more plot parameters

Value

Returns plots and confidence intervals

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2

Examples

#data3: Kaps and Lamberson (2009): page 347
#Description:
##Latin square design for test four different treatments on hay intake of fattening steers

data(data3)

r<-ea1(data3, design=3)


#plot
means.plot(r, col=gray.colors(4))

# more graphical parameters
means.plot(r, col=c(2,7,3,5), bg="cornsilk", las=1, cex.names=2, 
sub="treatments", family="sans");grid(10)

# plot = 2
means.plot(r, plot=2, col="dark green", bg="gray", las=1, cex.names=2, 
sub="Treatments", family="Times", ylab="Hay intake")

# plot = 2 decreasing =FALSE
means.plot(r, plot=2, las=1, cex.names=2, col="red",lty=2,pch=20,cex=1.1,
sub="Treatments", family="Times", ylab="Hay intake", decreasing=FALSE, legend=FALSE);grid(10)

# plot=3 
means.plot(r, plot=3, las=1, cex.names=2, 
sub="Contrasts (Tukey 0.05)", family="Times", ylab="")

# plot=3  alpha=0.10
means.plot(ea1(data3, design=3), plot=3, las=2, cex.names=2, 
sub="Contrasts (Tukey 0.10)", family="Times", ylab="", alpha=0.10, bg="cornsilk");grid(10)

Plot Means (interactions)

Description

Plot contrasts of means

Usage

means.plotfat(data, plot=1, s=1,test=1, legend=TRUE, letters=TRUE,
family="Times", bg="white",  cex.names=0.8, cex.text=0.7,
 cex.legend=1, bar.order=1,decreasing=TRUE, ...)

Arguments

data

output object of ea2 function (see examples)

plot

type of plot 1 = bar plot factor 1(default) 2 = bar plot factor 2 3 = bar plot interactions (option 1) 4 = bar plot interactions (option 2) 5 = bar plot interactions (option 3) 6 = bar plot interactions (option 4)

s

s=1 (defalt) plot standard deviation s=2 plot standard error of mean

test

Letters of the post-hoc test 1=Tukey 2=SNK 3=Duncan 4=t 5=Scott-Knott

legend

TRUE = plot p-value of F test FALSE = not plot p-value

letters

TRUE = plot letters FALSE = not plot letters

family

font of plot

bg

background color

cex.names

font size in names of treatments (x-axis)

cex.text

font size in letters and means

cex.legend

font size in legend

bar.order

order of bar or means 1 = order of treatments names 2 = order of the means (default)

decreasing

decreasing bar order (TRUE or FALSE)

...

more plot parameters

Value

Returns bar plots

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2, means.plot, box.plot

Examples

#data3: Kaps and Lamberson (2009): page 347
#Description:
##Latin square design for test four different treatments on hay intake of fattening steers

data(data3)

r<-ea1(data3, design=3)


#plot
means.plot(r, col=gray.colors(4))

# more graphical parameters
means.plot(r, col=c(2,7,3,5), bg="cornsilk", las=1, cex.names=2, 
sub="treatments", family="sans");grid(10)

# plot = 2
means.plot(r, plot=2, col="dark green", bg="gray", las=1, cex.names=2, 
sub="Treatments", family="Times", ylab="Hay intake")

# plot = 2 decreasing =FALSE
means.plot(r, plot=2, las=1, cex.names=2, col="red",lty=2,pch=20,cex=1.1,
sub="Treatments", family="Times", ylab="Hay intake", decreasing=FALSE, legend=FALSE);grid(10)

# plot=3 
means.plot(r, plot=3, las=1, cex.names=2, 
sub="Contrasts (Tukey 0.05)", family="Times", ylab="")

# plot=3  alpha=0.10
means.plot(ea1(data3, design=3), plot=3, las=2, cex.names=2, 
sub="Contrasts (Tukey 0.10)", family="Times", ylab="", alpha=0.10, bg="cornsilk");grid(10)

Plot p values of the contrasts

Description

Plot p values of the contrasts

Usage

p.plot(data, ylab="", xlab="", col.lines="red", cex.axis=0.7, 
cex=0.9 , col.text="dark green",family="Times", bg="white",...)

Arguments

data

output object of ea1 or ea2 function (see examples)

ylab

title of y-axis

xlab

title of x-axis

col.lines

colours of the lines

cex.axis

font size in axis

cex

size of points

col.text

colours in letters and means

family

font of plot

bg

background color

...

more plot parameters

Value

Plot p values of the contrasts

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2, box.plot, means.plot, means.plotfat, ic, ic.plot, m.plot

Examples

#data3: Kaps and Lamberson (2009): page 347
#Description:
##Latin square design for test four different treatments on hay intake of fattening steers

data(data3)

r<-ea1(data3, design=3)


#plot
contrasts=r[[3]]
contrasts
p.plot(contrasts)

#direct
p.plot(r[3])

# more graphical parameters
p.plot(contrasts, bg="cornsilk", cex=1.5,cex.axis=1.5,
main="P-values of the tukey contrasts",family="sans");grid(10)

data('data7')
r<-ea2(data7,4)
p.plot(r[[5]], bg="cornsilk");grid(10)

par(mfrow=c(1,2))
p.plot(r[[9]][1], xlab="treatment 1", cex=0.5, bg="cornsilk");grid(10)
p.plot(r[[9]][2], xlab="treatment 2", cex=0.5, bg="cornsilk");grid(10)

Table of results in the ea1 function

Description

Summary of results in ea1 function

Usage

tab(data, test=1)

Arguments

data

output object of ea1 function (see examples)

test

Letters of the post-hoc test 1=Tukey 2=SNK 3=Duncan 4=t 5=Scott-Knott

Value

Summary of results in ea1 function

Author(s)

Emmanuel Arnhold <[email protected]>

References

KAPS, M. and LAMBERSON, W. R. Biostatistics for Animal Science: an introductory text. 2nd Edition. CABI Publishing, Wallingford, Oxfordshire, UK, 2009. 504p.

See Also

ea1,ea2, box.plot, means.plot, means.plotfat, ic.plot, p.plot

Examples

#data3: Kaps and Lamberson (2009): page 347
#Description:
##Latin square design for test four different treatments on hay intake of fattening steers

data(data3)

r<-ea1(data3, design=3)

tab(r)

### multiple variables

t<-c('a','a','a','b','b','b','c','c','c')
r1<-c(10,12,12.8,4,6,8,14,15,16)
r2<-c(102,105,106,125,123,124,99,95,96)
r3<-c(560,589,590,658,678,629,369,389,378)


d<-data.frame(t,r1,r2,r3)

results=ea1(d, design=1, list=TRUE)

# scottknott test
tab(results,test=5)