<jupyter_start><jupyter_text>Correlation - why thing go up when other thing go down?-used to check if two samples are related. They are often used for feature selection and multivariate analysis in data preprocessing and exploration.  Pearson's Correlation Coefficient- The goal of this test is to answer the question: `do two samples have a linear relationship?`        * To answer this question, we will take the following steps:1. Calculate the Pearson correlation coefficient, $r_x$$_y$2. Calculate the corresponding t-values3. Test whether the t-values are significant or not-Most common<jupyter_code>#imports
#data load
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from math import sqrt
from scipy import stats
from pydataset import data<jupyter_output><empty_output><jupyter_text>Pre-Set ValuesBefore we perform the test, we will choose some values for our confidence interval and, based on that value, our alpha.<jupyter_code>n = df.shape[0]     # number of observations
degf = n - 2        # degrees of freedom: the # of values in the final calculation of a statistic that are free to vary.
conf_interval = .95 # desired confidence interval
α = 1 - conf_interval<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.05460472697636512, 'fraction_numerical': 0.006519967400162999, 'mean_word_length': 4.819905213270142, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '323341', 'license': 'Apache-2.0', 'n_tokens_mistral': 337, 'n_tokens_neox': 320, 'n_words': 161, 'path': 'Correlation_Reference.ipynb', 'repo_name': 'brandonjbryant/data-science-notes', 'size': '1227'}