# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python [conda env:DAND]
#     language: python
#     name: conda-env-DAND-py
# ---

# # Testing a Perception Phenomenon
# ## The Stroop Task
# ### By: <NAME>

# > In a Stroop task, participants are presented with a list of words, with each word displayed in a color of ink. The participant’s task is to say out loud the color of the ink in which the word is printed. The task has two conditions: a congruent words condition, and an incongruent words condition. In the congruent words condition, the words being displayed are color words whose names match the colors in which they are printed: for example RED, BLUE. In the incongruent words condition, the words displayed are color words whose names do not match the colors in which they are printed: for example PURPLE, ORANGE. In each case, we measure the time it takes to name the ink colors in equally-sized lists. Each participant will go through and record a time from each condition.

# # Questions for investigation

# ## 1. What is our independent variable? What is our dependent variable?

# * Independent: Color-to-Word congruency/incongruency
# * Dependent: Time it takes to measure ink colors

# ## 2. What is an appropriate set of hypotheses for this task? What kind of statistical test do you expect to perform? Justify your choices.

# Hypotheses:
# * $H_0: \mu_c = \mu_i $ : Color-to-Word incongruency has no effect on average time to measure ink colors 
# > The null hypothesis should be when there is no change in the means between the samples
# * $H_A: \mu_c <  \mu_i $ : Color-to-Word incongruency has increases average time to measure ink colors
# > The alternative hypothesis should be when the average between the samples is not the same.  In this case I choose to only test for whether the Color-to-Word incongruency increases the time to measure ink colors.  I'm not testing to see if it could also decrease the time it takes to measure colors since it seems unlikely that adding complexity to the task would increase performance.
#
# Expected Test type:
# * One-tailed dependent $t-test$ for paired samples
# > The expected test is dependent since it appears to be coming from a single sample of individuals. We're computing the t-value because we don't have a population to compare to.  As desribed under the alternative hypothesis section I'd expect a one-tail test since improved performance from increasing task complexity seems unlikely.

# ## 3. Report some descriptive statistics regarding this dataset. Include at least one measure of central tendency and at least one measure of variability.

# ### Measure of central tendency (sample means)
# $\bar x_c = 14.051125$
#
# $\bar x_i = 22.01591667$
#
# ### Measure of variability (sample standard deviations)
# $S_c = 3.56$
#
# $S_c = 4.80$
#
#
# > *see describe below for more statistics*

# ## 4. Provide one or two visualizations that show the distribution of the sample data. Write one or two sentences noting what you observe about the plot or plots.

# +
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns


# %matplotlib inline
# %pylab inline
# -

stroop_df = pd.read_csv('stroopdata.csv')

stroop_df

stroop_df.describe()

# +
stroop_plot = stroop_df.plot()

stroop_plot.set_ylabel("Time to identify color")
# -

# #### From looking at the graph above it appears that each test subject consistently performed worse when the colors were incongruent from the names of the words.

# ## 5. Now, perform the statistical test and report your results. What is your confidence level and your critical statistic value? Do you reject the null hypothesis or fail to reject it? Come to a conclusion in terms of the experiment task. Did the results match up with your expectations?

# ### Confidence Level:
# $\alpha = .05$
#
# $\bar x_c = 14.051125$
#
# $\bar x_i = 22.01591667$
#
# $S = 4.76239803$
#
#
# $n = 24$
#
# $point$ $estimate = -7.964791667$
#
# $Standard$ $error = $ 4.76239803
#
# $t-statistic = -8.020706944$
#
# $t-critical = -1.714$
#
# ### Reject or Fail to reject:
# > Because our calculated t-statistic of ~-8.02 is in the critical region we will reject the null hypothesis.
#
# ### Conclusion:
# > In conclusion, it seems that having incongruent colors with names of names of colors has a statistically measurable negative impact on time to identify color compared to having congruent colors.  The results lived up to my expections, as I expected increasing the complexity of the task would have a negative impact on performance.
#

# ### Resources used:
# Spreadsheet where values were calculated
# https://docs.google.com/spreadsheets/d/1QuG6C0MlVVryZt0lBJ0tY91vfvK0QC5Lzqs3HeODe4g/edit?usp=sharing
#
# MathJax Reference
# https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference
#

StarcoderdataJupyterScriptsDedupFiltered