Linguistics PhD
In acceptability judgment experiments, participants make use of an acceptability scale (most commonly the 7-point Likert scale) in various ways; some people use 1 and 7 exclusively, while other people stick to 3 through 5. In order to normalize their scores, it is common to convert raw acceptability to z-scores (standard scores). In python, I will use the scipy
package to achieve this.
import pandas as pd
from scipy.stats import zscore
sample = pd.read_csv('./sampledata.csv')
sample.head(3)
Movement | Island_Type | Island | Distance | Item | Sentence | Subj_id | List | Score | |
---|---|---|---|---|---|---|---|---|---|
0 | WH | whe | non | sh | 1 | Who thinks that Paul stole the necklace? | 1 | 1 | 6 |
1 | WH | whe | non | sh | 2 | Who thinks that Matt chased the bus? | 1 | 1 | 2 |
2 | WH | whe | non | sh | 3 | Who thinks that Tom sold the television? | 1 | 1 | 3 |
sample['Z_score'] = sample.groupby('Subj_id').transform(lambda x : zscore(x,ddof=1))
sample['Score'][:5]
0 6
1 2
2 3
3 7
4 2
Name: Score, dtype: int64
sample['Z_score'][:5]
0 1.265785
1 -0.734468
2 -0.234405
3 1.765848
4 -0.734468
Name: Z_score, dtype: float64