A package for SPSS methods
Project description
Psython
This package include SPSS related calculations done using python.
Installation
pip install psython
Importing
import psython as psy
Cronbach's alpha - with "if deleted"
This package is for calculating Cronbach's alpha of an entire dataset with a "if deleted" table for finding items that should be removed.
The package is using the pingouin package for the actuall calculation of Cronbach's alpha.
Usage
Here is an example of the SAQ DataFrame (q3r = q3 reversed):
q1 | q2 | q4 | q5 | q6 | q7 | q8 | q9 | q10 | q11 | ... | q15 | q16 | q17 | q18 | q19 | q20 | q21 | q22 | q23 | q3r | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2 | 1 | 2 | 2 | 2 | 3 | 1 | 1 | 2 | 1 | ... | 2 | 3 | 1 | 2 | 3 | 2 | 2 | 2 | 5 | 2 |
1 | 1 | 1 | 3 | 2 | 2 | 2 | 2 | 5 | 2 | 2 | ... | 4 | 3 | 2 | 2 | 3 | 4 | 4 | 4 | 2 | 2 |
2 | 2 | 3 | 2 | 4 | 1 | 2 | 2 | 2 | 2 | 3 | ... | 2 | 3 | 2 | 3 | 1 | 4 | 3 | 2 | 2 | 4 |
3 | 3 | 1 | 4 | 3 | 3 | 4 | 2 | 2 | 4 | 2 | ... | 3 | 3 | 2 | 4 | 2 | 4 | 4 | 4 | 3 | 5 |
4 | 2 | 1 | 2 | 2 | 3 | 3 | 2 | 4 | 2 | 2 | ... | 2 | 2 | 2 | 3 | 3 | 4 | 2 | 4 | 4 | 3 |
5 rows × 23 columns
psy.cronbach_alpha_scale_if_deleted(df)
Where df is the items dataframe (each item as a column) and the function will return two objects - the Cronbach's alpha of the entire DataFrame at position 0 and the table of the "if delete" items in position 1.
Item | Scale Mean if Item Deleted | Scale Variance if Item Deleted | Corrected Item-Total Correlation | Cronbach's Alpha if Item Deleted | |
---|---|---|---|---|---|
0 | q1 | 59.892260 | 90.121072 | 0.520928 | 0.791887 |
1 | q2 | 60.642940 | 101.063899 | -0.163158 | 0.819978 |
2 | q4 | 59.480358 | 87.967999 | 0.569241 | 0.788177 |
3 | q5 | 59.544146 | 89.303401 | 0.480579 | 0.792419 |
4 | q6 | 60.039284 | 87.605071 | 0.482416 | 0.791397 |
5 | q7 | 59.342668 | 85.655685 | 0.594245 | 0.785032 |
6 | q8 | 60.029560 | 89.900293 | 0.503704 | 0.792141 |
7 | q9 | 59.420070 | 100.881838 | -0.137191 | 0.828613 |
8 | q10 | 59.985609 | 92.232867 | 0.355784 | 0.798693 |
9 | q11 | 60.011280 | 88.790145 | 0.568318 | 0.789112 |
10 | q12 | 59.106962 | 88.451979 | 0.562942 | 0.788889 |
11 | q13 | 59.817192 | 87.839720 | 0.576902 | 0.787798 |
12 | q14 | 59.390121 | 87.491716 | 0.562476 | 0.787931 |
13 | q15 | 59.500194 | 88.766051 | 0.484296 | 0.791916 |
14 | q16 | 59.387009 | 88.329154 | 0.570772 | 0.788520 |
15 | q17 | 59.799689 | 88.441961 | 0.587849 | 0.788165 |
16 | q18 | 59.697783 | 85.993065 | 0.608925 | 0.784771 |
17 | q19 | 59.974329 | 104.442142 | -0.295795 | 0.832243 |
18 | q20 | 58.642163 | 91.699140 | 0.313782 | 0.800711 |
19 | q21 | 59.095683 | 87.678779 | 0.561128 | 0.788157 |
20 | q22 | 59.378452 | 101.109248 | -0.152704 | 0.823798 |
21 | q23 | 58.831972 | 98.820783 | -0.044039 | 0.818680 |
22 | q3r | 58.851809 | 89.021221 | 0.434762 | 0.794258 |
Reliability: Split-Half
result = psy.split_half_reliability(df)
Will return an array of values:
pearson
spearman_brown
a_croncha_1
a_croncha_2
table
print(result.table)
Will print the output in the familiar SPSS format.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file psython-0.0.15.tar.gz
.
File metadata
- Download URL: psython-0.0.15.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe75762293d32c866a56e7e36ca0d426022f095b5d97ec671dbba5693ecc6f13 |
|
MD5 | ab757b6abc7ec4d4d0c2054b12af11c4 |
|
BLAKE2b-256 | 623fec87ba0883671c853e4dd5ee8d6b9c1edf1cd058c3352620d1c3bc5422b5 |
File details
Details for the file psython-0.0.15-py3-none-any.whl
.
File metadata
- Download URL: psython-0.0.15-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d4fdfa2667ee394c465eaec4b32efe14468eb1ecd9161ceb82aacd76b5745c9 |
|
MD5 | 835999672f48b1b7d2dbc8f6784c2919 |
|
BLAKE2b-256 | 483051bb008da9a2959af8d959b52c1db9fe43cbba647cda7da403a8b149506f |