Description Usage Arguments Value Author(s) See Also Examples
View source: R/findSubsample.R
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.
1 | 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
dataname |
a |
niter |
the number of iterations. |
fun |
the objective function. |
stat |
the achieved statistic for the optimized subsample. |
criterion |
a |
subsample |
a numeric vector; the optimized subsample. |
labels |
a string containg the labels of the subsample values. |
Anderson Rodrigo da Silva <anderson.agro@hotmail.com>
1 2 3 4 5 6 7 8 9 | # Example 1
y <- rnorm(40, 5, 2)
findSubsample(x = y, size = 6)
# Example 2
f <- function(x) diff(range(x)) # max(x) - min(x)
findSubsample(x = y, size = 6, fun = f, minimize = FALSE, niter = 20000)
# End (not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.