findSubsample.Rd
It allows one to find an optimized (minimized or maximized) numeric subsample according to a statistic of interest. For example, it might be of interest to determine a subsample whose standard deviation is the lowest among all of those obtained from all possible subsamples of the same size.
findSubsample(x, size, fun = sd, minimize = TRUE, niter = 10000)
x | a numeric vector. |
---|---|
size | an integer; the size of the subsample. |
fun | an object of class |
minimize | logical; if TRUE (default) |
niter | an integer indicating the number of iterations, i.e., the number of subsamples to be selected
(without replacement) from the original sample, |
A list of
a character
.
the number of iterations.
the objective function.
the achieved statistic for the optimized subsample.
a character
indicating the type of optimization.
a numeric vector; the optimized subsample.
a string containg the labels of the subsample values.
Anderson Rodrigo da Silva <anderson.agro@hotmail.com>
#> #> Finding an Optimized Subsample #> #> Data: y #> Iterations: 10000 #> Objective function: sd = 0.4062577 ( minimized ) #> Subsample: #> 30 32 40 33 16 14 #> 5.740864 5.202569 6.211756 5.078155 5.478129 5.485777# Example 2 f <- function(x) diff(range(x)) # max(x) - min(x) findSubsample(x = y, size = 6, fun = f, minimize = FALSE, niter = 20000)#> #> Finding an Optimized Subsample #> #> Data: y #> Iterations: 20000 #> Objective function: f = 11.20151 ( maximized ) #> Subsample: #> 31 10 13 35 5 27 #> 4.034646 5.969443 7.888373 -2.419699 8.630062 8.781806# End (not run)