# Probability Vector Formatting Tool

### Description

The fuction is applied to a pair of probability vectors or to a pair of vector with counts in order to format them for adequate use at Klimontovich's S-theorem based analysis

### Usage

1 2 |

### Arguments

`distribution0` |
vector of counts / probability vector |

`distribution1` |
vector of counts / probability vector |

`outcomes0` |
optionally used vector of bins/cell numerical identifiers corresponding to counts contained in distribution0 vector |

`outcomes1` |
optionally used vector of bins/cell numerical identifiers corresponding to counts contained in distribution1 vector |

`tolerance` |
a number to set a level of accuracy at which distributions will be aligned with the default value |

### Details

At some applications a pair of probability vectors or vector of counts are not equal in size. At some applications a pair of probability vectors or vector of counts are not corresponded to the same intervals of outcomes or measured at not equidistant intervals. This makes Klimontovich's S-theorem based analysis not adequate or even not possible at all. The function tries to align vectors and convert them to equidistant ones with the level of accuracy specified by parameter of `tolerance`

. As a bonus it prints basic statistics summary for distributions alongside with technical plot

### Value

`new_scale ` |
new generated vector of bins/cell numerical identifiers corresponding to counts contained in vectors with counts, common for both distributions |

`f0 ` |
aligned and improved probability vector representing state0 of a system |

`f1 ` |
aligned and improved probability vector representing state1 of a system |

### Author(s)

Vitaly Efremov <vitaly.efremov@dcu.ie>

### See Also

`crit.stheorem`

,
`cxds.stheorem`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
#consider 2 arrays {h0, h1} representing counts for
#bins where bins are enumerated by corresponding x0 and x1 arrays:
x0 <- -c(10,9,8,7,6,5,4.01,3)
x1 <- c(2,3,4,5,6,7,8)*(1.01)
h0 <- c(0,0,3,4,0,0,0.2,1)
h1 <- c(2,2,2,6,6,0,1)
#align regardless bin identifiers:
b<-pvalign(distribution0=h0, distribution1=h1); b
#align using bin identifiers:
b<-pvalign(h0, h1, outcomes0=x0, outcomes1=x1, tolerance=0.02); b
b$f0; b$f1; b$new_scale
#set small tolerance and observe an error generated:
# b<-pvalign(h0, h1, x0, x1, tolerance=0.0001)
#example of 2-step data analysis with Klimontovich's S-theorem
# compare two bin counts:
h0<-c(1,1,1,1,1,1,1,1,1,1,1,1)
h1<-c(1,2,2,3,1,0,8,6)
# step a. Create probability vectors. It seems that s0 has lower level
# of orderliness (Shannon entropy is higher)
b<-pvalign(h0, h1); b
# step b. Compare with Klimontovich's S-theorem. Renormalized entropy shift
# is negligible compared to Shannon's. Evolution from state0 to state1 is possible
# but clearly with external entropy (or energy) outflow
crit.stheorem(b$f0,b$f1)
cxds.stheorem(b$f0,b$f1)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.