This function removes small sample states by reassigning
points in those state to nearby states.
This can become necessary when in an iterative algorithm
(like mixed_LICORS) the weights start
moving away from e.g. state j. At some point the
effective sample size of state j (sum of column
mathbf{W}_j) is so small that state-conditional
estimates (mean, variance, kernel density estimate, etc.)
can not be obtained accurately anymore. Then it is good
to remove state j and reassign its samples to other
(close) states.
Usage
remove_small_sample_states(weight.matrix, min)
Arguments
weight.matrix
N \times K weight matrix
min
minimum effective sample size to stay in the
weight matrix
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LICORS)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LICORS/remove_small_sample_states.Rd_%03d_medium.png", width=480, height=480)
> ### Name: remove_small_sample_states
> ### Title: Reassign low sample states to close states
> ### Aliases: remove_small_sample_states
> ### Keywords: manip method
>
> ### ** Examples
>
> set.seed(10)
> WW <- matrix(c(rexp(1000, 1/10), runif(1000)), ncol = 5, byrow = FALSE)
> WW <- normalize(WW)
> colSums(WW)
[1] 150.26275 155.78926 71.75018 10.89582 11.30197
> remove_small_sample_states(WW, 20)
>
>
>
>
>
> dev.off()
null device
1
>