Description Usage Arguments Value See Also Examples
Stratified sampling by clusters or types
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
x |
A vector represents the cluster or type, only support numeric value now. |
num |
The number of sampling. Default as |
replace |
The way of sampling. See |
order.value |
The vector used for ordering. Default is |
... |
Parameters of function |
log10 |
Whether to log10-trans the |
n_group |
Number of group to be devided. Default is 3. |
Result of Sampling_via_cluster
is the index of sampled
items from the input x
.
Other Algorithm assessment:
Assessment_via_cluster()
,
Getting_Asses_results()
,
Score_algorithms_interval()
,
Score_algorithms_sort()
,
Scoring_system()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | library(FCMm)
x = round(runif(100, 1, 10))
table(x)
w_sampled = Sampling_via_cluster(x, 20)
table(x[w_sampled])
set.seed(1)
N <- 100
x <- stats::rlnorm(N)
ind1 <- Sampling_by_sort(x, N/2)
ind2 <- sample.int(length(x), N/2)
library(ggplot2)
ggplot() +
geom_density(aes(x = x, color = "Total")) +
geom_density(aes(x = x[ind1], color = "ind1"), alpha = 0.8) +
geom_density(aes(x = x[ind2], color = "ind2"), alpha = 0.6) +
scale_x_log10()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.