Quick-start¶
The following gives the examples of utilzing this package through Python scripts. For the details, please refer to the Guide Chapter and Tutorials Chapter.
Calculate PK¶
A simple example might be like this:
from pk4adi.pk import calculate_pk
x = [ 0, 0, 0, 0, 0, 0]
y = [ 1, 1, 1, 1, 1, 2]
calculate_pk(x, y)
x = [0, 0, 0, 0, 0, 0, 1, 1, 2]
y = [1, 1, 1, 1, 1, 2, 3, 3, 4]
calculate_pk(x, y)
You will get the following output:
==============
PK calculation
==============
PK SE0 SE1 jack_ok PKj SEj
----- ----- ----- --------- ----- -----
0.500 0.000 0.000 False nan nan
==============
PK calculation
==============
PK SE0 SE1 jack_ok PKj SEj
----- ----- ----- --------- ----- -----
0.900 0.124 0.085 True 0.901 0.117
Compare results of PK¶
A simple example might be like this:
from pk4adi.pk import calculate_pk
from pk4adi.pkc import compare_pks
x1 = [ 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6 ]
y1 = [ 1, 1, 1, 1, 1, 2, 1, 1, 3, 3, 2, 2, 2, 2, 2, 1, 3, 3, 3, 3, 3, 3, 3, 3 ]
pk1 = calculate_pk(x_in = x1, y_in = y1 , auto_print = False)
x2 = [ 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6 ]
y2 = [ 1, 1, 2, 1, 1, 2, 1, 2, 3, 3, 2, 2, 1, 2, 2, 2, 3, 3, 3, 3, 2, 3, 3, 2 ]
pk2 = calculate_pk(x_in = x2, y_in = y2 , auto_print = False)
ans = compare_pks(pk1, pk2)
You will get the following output:
==============
PKs comparison
==============
=================
For Group (z-test)
=================
PKD SED ZD P value Comment
----- ----- ----- --------- ---------
0.068 0.101 0.669 0.504 P > 0.05
=================
For Pair (t-test)
=================
PKDJ SEDJ DF TD P value Comment
------ ------ ---- ----- --------- ---------
0.030 0.066 23 0.453 0.327 P > 0.05