anova1way {stats4teaching} | R Documentation |
One-Way ANOVA
Description
anova1way
is used to generate multivariate data in order to compute analysis of variance with 1 factor. It provides balanced and unbalanced ANOVA (as long as homogeneity of variances is satisfied. In other case it is provided Welch test).
Usage
anova1way(k = 3,n , mean = 0, sigma = 1,
coefvar = NULL, method = c("Tukey", "LSD", "Dunnett", "Bonferroni", "Scheffe"),
conf.level = 0.95, dec = 2)
Arguments
k |
number of levels. By default k = 3. |
n |
size of samples. |
mean |
vector of means. |
sigma |
vector of standard deviations. |
coefvar |
an optional vector of coefficients of variation. |
method |
post-hoc method applied. There are five possible choices: " |
conf.level |
confidence level of the interval. |
dec |
number of decimals for observations. |
Details
If mean
or sigma
are not specified it is assumed the default values of 0
and 1
.
If coefvar
(= sigma
/mean
) is specified, function omits sigma
.
Number of samples is choosen by k
(by default k = 3). Therefore, if the others parameters (n
, mean
, sigma
, coefvar
) have not same length, function rep
will be used. Pay attention if vectors dont have same length.
Moreover, not only gives samples for each level, but also the ANOVA table and post-hoc test (in case of significance). By default conf.level
= 0.95 and Tukey method is used. If the homogeneity of variances is not verified (using Bartlett test), the Welch test is performed.
Value
List containing the following components:
-
Data
: a data frame containing the samples created. -
Anova
: anova fitted model. -
Significance
: significance of the factor. -
Size.effect
: size effect of the factor. -
Test Post-Hoc
: test Post-Hoc.
Examples
anova1way(k=4,n=c(40,31,50),mean=c(55,52,48,59),coefvar=c(0.12,0.15,0.13),conf.level = 0.99)
anova1way(k=3,n=15,mean=c(10,15,20),sigma =c(1,1.25,1.1),method ="B")