# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# ## Digit Span Data

# +
import pandas as pd

# Read in data
df1 = pd.read_csv("https://raw.githubusercontent.com/ethanweed/ExPsyLing/master/datasets/DigitSpan_2019.csv")
df2 = pd.read_csv("https://raw.githubusercontent.com/ethanweed/ExPsyLing/master/datasets/DigitSpan_2021.csv")

# Make a new dataframe with the forward and backward data from 2010.
# Keep only speakers that only list Danish as their native language 
df1 = pd.DataFrame({'Forward': df1['Forward digit span'],
                   'Backward': df1['Backward digit span']}).where(df1['Native language 1=native 0=non-native'] == "Danish")

# Make a new column in df1 called "Year", and set all values to 2019
df1['Year'] = [2019]*df1.shape[0]

# Make a new dataframe with the forward and backward data from 2010.
df2 = pd.DataFrame({'Forward': df2['Forward'],
                   'Backward': df2['Backward']})

# Make a new column in df1 called "Year", and set all values to 2021
df2['Year'] = [2021]*df2.shape[0]

# Combine df1 and df2 in one dataframe, and drop all rows with missing data
df = pd.concat([df1, df2]).dropna()
# -

df.head()

df['Forward'].mean()

df['Forward'].median()

x = df.where(df['Year'] == 2019)['Forward']
x.mean()

y = df.where(df['Year'] == 2021)['Forward']
y.mean()

df['Forward'].corr(df['Backward'])

df['Forward'].rank().corr(df['Backward'].rank())

df.where(df['Backward'] > 1).dropna()['Forward'].rank().corr(df.where(df['Backward'] > 1).dropna()['Backward'].rank())

import numpy as np
np.quantile(df['Forward'], [0.25, .75])

df['Forward'].quantile([0.25, .75])

from scipy import stats
stats.iqr(df['Forward'])

# ## Fish vs. Facebook Data





# ## Stroop Test Data
#
# ## 

StarcoderdataJupyterScriptsDedupFiltered