Icon

k_​001_​r_​bimodality

use R package 'modes' to detect bimodality, calculate coefficients and create a chart

use R package 'modes' to detect bimodality, calculate coefficients and create a chart

You could use that in KNIME and see if you can use the statistics that are provided by this package to make a decision. It also creates a plot where you can visually inspect if there is a Bi-Modal distribution. You might adapt that to test for further distributions.

Please note I am not an expert in these statistics, just built them into a workflow :slight_smile:. The description 9 for the package for example states that for the:

bimodality_coefficient - "The bimodality coefficient has a range of zero to one (that is: [0,1]) where a value greater than “5/9” suggests bimodality. "

So with 0.774 being larger than 0.556 the statistic here would indicate that the distribution is bimodal. And the visual inspection seems to support that.

I was toying around with creating a variable to bring the description into the graphic but gave up for now. You might include that ins some future graphic you might create.

https://cran.r-project.org/web/packages/modes/modes.pdf https://forum.knime.com/t/identify-bi-modal-distribution/13269/3?u=mlauber71 binom1 <- c(rnorm(21,0,1),rnorm(21,5,1))knime.out <- as.data.frame(binom1) use R package 'modes' to detect bimodality, calculate coefficients and create a chartbimodality_coefficient - "The bimodality coefficient has a range of zero to one (that is: [0,1]) where a value greater than “5/9” [0.556] suggests bimodality."(https://cran.r-project.org/web/packages/modes/modes.pdf) library(modes)# fig=FALSE no plot will be drawnvar_bimodality_amplitude <- bimodality_amplitude(knime.in$binom1, fig=FALSE)var_bimodality_coefficient <- bimodality_coefficient(knime.in$binom1, finite = TRUE)knime.out <- as.data.frame(cbind(var_bimodality_amplitude , var_bimodality_coefficient)) create databimodality_amplitude(knime.in$binom1,fig=TRUE)binom1.pngdescription as variablecould be used for further graphicsresult.xlsx R Source (Table) R View (Workspace) Table to R R Snippet Image Writer (Port) Image To Table Renderer to Image Table To Image Java EditVariable (simple) Math Formula(Multi Column) Number To String Table Rowto Variable Excel SheetAppender (XLS) https://cran.r-project.org/web/packages/modes/modes.pdf https://forum.knime.com/t/identify-bi-modal-distribution/13269/3?u=mlauber71 binom1 <- c(rnorm(21,0,1),rnorm(21,5,1))knime.out <- as.data.frame(binom1) use R package 'modes' to detect bimodality, calculate coefficients and create a chartbimodality_coefficient - "The bimodality coefficient has a range of zero to one (that is: [0,1]) where a value greater than “5/9” [0.556] suggests bimodality."(https://cran.r-project.org/web/packages/modes/modes.pdf) library(modes)# fig=FALSE no plot will be drawnvar_bimodality_amplitude <- bimodality_amplitude(knime.in$binom1, fig=FALSE)var_bimodality_coefficient <- bimodality_coefficient(knime.in$binom1, finite = TRUE)knime.out <- as.data.frame(cbind(var_bimodality_amplitude , var_bimodality_coefficient)) create databimodality_amplitude(knime.in$binom1,fig=TRUE)binom1.pngdescription as variablecould be used for further graphicsresult.xlsxR Source (Table) R View (Workspace) Table to R R Snippet Image Writer (Port) Image To Table Renderer to Image Table To Image Java EditVariable (simple) Math Formula(Multi Column) Number To String Table Rowto Variable Excel SheetAppender (XLS)

Nodes

Extensions

  • No modules found

Links