<jupyter_start><jupyter_text>Analyzing the Stroop Effect Perform the analysis in the space below. Remember to follow [the instructions](https://docs.google.com/document/d/1-OkpZLjG_kX9J6LIQ5IltsqMzVWjh36QpnP2RYpVdPU/pub?embedded=True) and review the [project rubric](https://review.udacity.com/!/rubrics/71/view) before submitting. Once you've completed the analysis and write up, download this file as a PDF or HTML file and submit in the next section.(1) What is the independent variable? What is the dependent variable? We could define the ***independent variable as the condition of the words***, that is to say if the words are congruent or incongruent.To illustrate the condition, we could say that the word 'red' with a red ink is congruent, and conversely the word 'red' with a yellow ink is incongruent.The ***dependent variable is the time*** it takes to name the 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. *** What is an appropriate set of hypotheses for this task?*** $μ_{incongruent}$: incongruent population mean$μ_{congruent}$: congruent population mean$H_0$: null hypothesis$H_1$: alternative hypothesis**Null hypothesis**$H_0: μ_{incongruent} - μ_{congruent} = 0$The null hypothesis says there is no significant difference in the population average reponse time whatever the condition of the word is.**Alternative hypothesis**$H_1:  μ_{incongruent} - μ_{congruent} ≠ 0$The alternative hypothesis says there is a significant difference, positive or negative, in the population average reponse time.**Type one error = 5%** *** What kind of statistical test do you expect to perform? ***We choose to do a ***paired t-test*** for the following reasons:- Small sample data - One independent, categorical variable that has two levels/groups.- One continuous dependent variable.- The variances of two normal distributions are not know- The two samples are from the same group of participants- The congruent and incongruent observation are dependent.More on t-test : https://statistics.laerd.com/statistical-guides/independent-t-test-statistical-guide.phphttps://www.investopedia.com/terms/t/t-test.asphttp://www.psychology.emory.edu/clinical/bliwise/Tutorials/TOM/meanstests/assump.htm (3) Report some descriptive statistics regarding this dataset. Include at least one measure of central tendency and at least one measure of variability. The name of the data file is 'stroopdata.csv'.<jupyter_code># create a data frame 
df = pd.read_csv('stroopdata.csv')
df.head()
# report descriptive statistics 
df.describe()<jupyter_output><empty_output><jupyter_text>(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.<jupyter_code># Boxplot
plt.title('Box Plot : display of the distribution')
plt.xlabel('Condition')
plt.ylabel('Time')
df.boxplot()
# Histogram 
df.hist(figsize=(10,10),bins=15, range = (7,35))
plt.xlabel('Time')
plt.ylabel('Frequency')
plt.show()<jupyter_output><empty_output><jupyter_text>We can observe on the box plot and the histograms that the test withcongruent words have a median lower than the incongruent one, and we see that this relation is true for all the quartile.This suggest that for the studied population that it is a difference in the average time to name the color ink. (5) Now, perform the statistical test and report the results. What is the 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?<jupyter_code># sample size 
N = df.shape[0]
# degrees of freedom
freedom = N-1
# create a dataframe with the congruent test
df_c = df['Congruent']
# create a dataframe with the incongruent test
df_i = df['Incongruent']
# t-test 
ttest = stats.ttest_rel(df_c,df_i)
# t-critical
t_critical = stats.t.ppf(q = 0.975, df=freedom)

print(ttest)
print(t_critical)<jupyter_output>Ttest_relResult(statistic=-8.020706944109957, pvalue=4.1030005857111781e-08)
2.06865761042
{'fraction_non_alphanumeric': 0.08409199808337327, 'fraction_numerical': 0.019885002395783422, 'mean_word_length': 5.452859350850077, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '233131', 'license': 'MIT', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1175, 'n_words': 506, 'path': 'p4_perceptual_phenomenon/perceptual_phenomenon.ipynb', 'repo_name': 'pierreconreaux/data_analyst_nd', 'size': '4174'}