Last data update: 2014.03.03

R: bwprun_mixglasso
bwprun_mixglassoR Documentation

bwprun_mixglasso

Description

Mixglasso with backward pruning

Usage

bwprun_mixglasso(x, n.comp.min = 1, n.comp.max, lambda = sqrt(2 * nrow(x) *
  log(ncol(x)))/2, pen = "glasso.parcor", selection.crit = "mmdl",
  term = 10^{     -3 }, min.compsize = 5, init = "kmeans.hc",
  my.cl = NULL, modelname.hc = "VVV", nstart.kmeans = 1,
  iter.max.kmeans = 10, reinit.out = FALSE, reinit.in = FALSE,
  mer = TRUE, del = TRUE, ...)

Arguments

x

Input data matrix

n.comp.min

Minimum number of components. Take n.comp.min=1 !

n.comp.max

Maximum number of components

lambda

Regularization parameter. Default=sqrt(2*n*log(p))/2

pen

Determines form of penalty: glasso.parcor (default), glasso.invcov, glasso.invcor

selection.crit

Selection criterion. Default='mmdl'

term

Termination criterion of EM algorithm. Default=10^-3

min.compsize

Stop EM if any(compsize)<min.compsize; Default=5

init

Initialization. Method used for initialization init='cl.init','r.means','random','kmeans','kmeans.hc','hc'. Default='kmeans.hc'

my.cl

Initial cluster assignments; need to be provided if init='cl.init' (otherwise this param is ignored). Default=NULL

modelname.hc

Model class used in hc. Default="VVV"

nstart.kmeans

Number of random starts in kmeans; default=1

iter.max.kmeans

Maximal number of iteration in kmeans; default=10

reinit.out

Re-initialization if compsize<min.compsize (at the start of algorithm) ?

reinit.in

Re-initialization if compsize<min.compsize (at the bwprun-loop level of algorithm) ?

mer

Merge closest comps for initialization

del

Delete smallest comp for initialization

...

Other arguments. See mixglasso_init

Details

This function runs mixglasso with various number of mixture components: It starts with a too large number of components and iterates towards solutions with smaller number of components by initializing using previous solutions.

Value

list consisting of

selcrit

Selcrit for all models with number of components between n.comp.min and n.comp.max

res.init

Initialization for all components

comp.name

List of names of components. Indicates which states where merged/deleted during backward pruning

re.init.in

Logical vector indicating whether re-initialization was performed or not

fit.mixgl.selcrit

Results for model with optimal number of components. List see mixglasso_init

Author(s)

n.stadler

Examples

##generate data
set.seed(1)
n <- 1000
n.comp <- 3
p <- 10

# Create different mean vectors
Mu <- matrix(0,p,n.comp)

nonzero.mean <- split(sample(1:p),rep(1:n.comp,length=p))
for(k in 1:n.comp){
  Mu[nonzero.mean[[k]],k] <- -2/sqrt(ceiling(p/n.comp))
}

sim <- sim_mix_networks(n, p, n.comp, Mu=Mu)

##run mixglasso

fit <-  bwprun_mixglasso(sim$data,n.comp=1,n.comp.max=5,selection.crit='bic')
plot(fit$selcrit,ylab='bic',xlab='Num.Comps',type='b')

Results


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(nethet)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/nethet/bwprun_mixglasso.Rd_%03d_medium.png", width=480, height=480)
> ### Name: bwprun_mixglasso
> ### Title: bwprun_mixglasso
> ### Aliases: bwprun_mixglasso
> 
> ### ** Examples
> 
> ##generate data
> set.seed(1)
> n <- 1000
> n.comp <- 3
> p <- 10
> 
> # Create different mean vectors
> Mu <- matrix(0,p,n.comp)
> 
> nonzero.mean <- split(sample(1:p),rep(1:n.comp,length=p))
> for(k in 1:n.comp){
+   Mu[nonzero.mean[[k]],k] <- -2/sqrt(ceiling(p/n.comp))
+ }
> 
> sim <- sim_mix_networks(n, p, n.comp, Mu=Mu)
> 
> ##run mixglasso
> 
> fit <-  bwprun_mixglasso(sim$data,n.comp=1,n.comp.max=5,selection.crit='bic')
Kmax= 5 
bwprun: nr comps 5 
        merge or delete? delete comp  4 

bwprun: nr comps 4 
        merge or delete? delete comp  1 

bwprun: nr comps 3 
        merge or delete? merge comps  5 3 

bwprun: nr comps 2 
        merge or delete? merge comps  5+3 2 

bwprun: nr comps 1 
> plot(fit$selcrit,ylab='bic',xlab='Num.Comps',type='b')
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>