knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
    fig.width = 12, 
    message = FALSE,
    warning = FALSE,
    tidy.opts = list(
        keep.blank.line = TRUE,
        width.cutoff = 150
        ),

    options(width = 150),
    eval = TRUE
)
library(FractCurve)

1. Introduction.

fract_curve() function in FractCurve package can be used for various purpose. Deciding the number of clusters in an exploratory data analyses is one of them. In this vignette, an explanation of the algorithm for utilizing fract_curve() function in this purpose is presented. Also, a result from simulation study is shown. The analysis can be conducted from the fract_curve_clust() function, which is a wrapper function of fract_curve(), in this package. If you have not read the vignette on fract_curve(), you can invoke from this package by using vignette("FractCurve", "FractCurve").

2. A result from simulation.

Suppose that you you have a dataset with the size of 50, the features of 32 variables. There are 8 subgroups in the population from which the data was sampled, and the characteristics of the subgroups are represented by the 32 features. This situation is simulated by the R code below:

for(i in 1:10){
mat_i <- matrix(
  c(
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1), 
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1), 
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1),
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1), 
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1), 
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1),
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1),
    rnorm(200,rnbinom(n = 1, size = 10, mu = 5)-1,1)
    ),
  ncol = 50
  )
if(i==1){mat <- mat_i}else{mat <- rbind(mat,mat_i)}
}

heatmap(mat)

Using fract_curve_clust() function, that is a wrapper function of fract_curve(), the number of subgroups in the population can be detected as below.

res.fract_curve_clust <- fract_curve_clust(
  df.features = as.data.frame(mat),
  method.dist.row = "manhattan", method.dist.col = "manhattan",
  method.hclust.row = "ward", method.hclust.col = "ward",
  dir.output = NULL,
  get.df_of_IYs=FALSE,
  fn.plot_pdf =NULL,
  fn.df_of_IYs = NULL,
  fisher_test = FALSE
  )

3. The algorithm.

we are seeking.

4 The two conditions to be met for the algorithm to work.

As explained in the previous section, .



mrmtshmp/FractCurve documentation built on Feb. 5, 2020, 1:13 p.m.