creategroups.Rd
A function to create homogeneous groups of named objects according to an objective function evaluated at a covariate. It can be useful to design experiments which contain a fixed covariate factor.
creategroups(x, ngroups, sizes, fun = mean, tol = 0.01, maxit = 200)
x | a numeric vector of a covariate at which to evaluate the objective function. |
---|---|
ngroups | the number of groups to create. |
sizes | a numeric vector of length equal to |
fun | the objective function, i.e., to create groups with similar |
tol | the tolerance level to define the groups as homogenenous; see details. |
maxit | the maximum number of iterations; default is 200. |
creategroups
uses a tol
value to evaluate the following statistic:
\(h = \sum_{j}^{ngroups} abs( t_{j+1} - t_j ) / ngroups\), where \(t_j = fun(group_j)\).
If \(h \leq tol\), the groups are considered homogeneous.
A list of
a character indicating the name of the covariate.
a character indicating the name of the objective function.
a numeric vector containing the values evaluated by func
on each group.
the number of iteration require to achieve convergence.
a list containing the labels of the objects in each group.
a list of named vectors containing the values for the groups
Anderson Rodrigo da Silva <anderson.agro@hotmail.com>
#> #> Creating homogeneous groups #> ------------------------------------------------------------------ #> Covariate: x #> #> Groups: #> $`1` #> [1] "b" "c" "d" "e" "h" #> #> $`2` #> [1] "a" "f" "g" "i" "j" #> #> Objective function (equality of): mean #> 1 2 #> 0.9626447 0.9608447 #> #> Number of iterations to convergence: 7#> #> Creating homogeneous groups #> ------------------------------------------------------------------ #> Covariate: x #> #> Groups: #> $`1` #> [1] "a" "f" "g" #> #> $`2` #> [1] "d" "e" "h" "j" #> #> $`3` #> [1] "b" "c" "i" #> #> Objective function (equality of): mean #> 1 2 3 #> 1.0090613 0.9575708 0.9199934 #> #> Number of iterations to convergence: 16# End (not run)