d1char.d1nat: Probability Mass Function Calculator for Array of Characters

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/stheoreme.R

Description

Function d1char.d1nat is applied to a pair of vectors of characters or to a pair of 1d arrays of characters and generates then the pair of corresponding probability vectors by calling d1nat function

Usage

1
d1char.d1nat(farr0, farr1, reject = c(""))

Arguments

farr0

vector of characters

farr1

vector of characters

reject

vector of rejected characters (the characters excluded from original vectors for analysis)

Details

First, it assigns the identification number for each individual character met in original vectors. Then it works similarly to hist function but for the pair of samples with identification numbers as outcomes. It prints the decoding array (listing the identification numbers corresponded for each character) and, as a bonus, it prints basic statistics summary for distributions alongside with technical plot. It is recommended for use as a data preparation step before the following Klimontovich's S-theorem based analysis.

Value

f0

probability vector representing state0 of a system

f1

probability vector representing state1 of a system

Author(s)

Vitaly Efremov <vitaly.efremov@dcu.ie>

See Also

crit.stheorem, cxds.stheorem, d1nat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
s0<-c("?", "!", "1", "a", "b", "b", "s", "x", "y", "z", "z", "z")
s1<-c("1", "1", "2", "b", "b", "s", "s", "x", "y", "z", "z", "z", "z")
b<-d1char.d1nat(farr0=s0,farr1=s1); b

s0<-"three witches watch three swatch watches. which witch watch which swatch watch?"
s1<-"who discovered america five hundred years ago? a brave man! indeed he was! discovered!"
b<-d1char.d1nat(unlist(strsplit(s0,"")),unlist(strsplit(s1,"")), 
                reject=c("."," ","!","d","e")); b

#example of 2-step data analysis with Klimontovich's S-theorem
s0<-c("a","b",rep("c",9),rep("d",2),"e","f","g",rep("h",2),"i","j"); s0
s1<-c(rep("a",16), rep("c",35), rep("i",13)); s1

# step a. Create probability vectors. It seems that s0 has lower level
# of orderliness (Shannon entropy is higher)
b<-d1char.d1nat(s0,s1); b
# step b. Compare samples with Klimontovich's S-theorem. Renormalized entropy indicates 
# the opposite: s0 is more ordered and difference in Shannon 
# entropy values was due to just "thermodynamic noise"
crit.stheorem(b$f0,b$f1)
cxds.stheorem(b$f0,b$f1)

stheoreme documentation built on May 2, 2019, 9:33 a.m.