Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Was Ist Korrelation? | Kovarianz und Korrelation
Grundlagen der Wahrscheinlichkeitstheorie
course content

Kursinhalt

Grundlagen der Wahrscheinlichkeitstheorie

Grundlagen der Wahrscheinlichkeitstheorie

1. Grundlagen der Wahrscheinlichkeitstheorie
2. Wahrscheinlichkeit Komplexer Ereignisse
3. Häufig Verwendete Diskrete Verteilungen
4. Häufig Verwendete Kontinuierliche Verteilungen
5. Kovarianz und Korrelation

book
Was Ist Korrelation?

Korrelation ist ein statistisches Maß, das die Beziehung zwischen zwei Variablen quantifiziert. Es wird als skalierte Kovariation bestimmt und aufgrund dieser Skalierung können wir die Stärke der Abhängigkeiten zusätzlich zu ihrer Richtung ermitteln.
Die Korrelation liegt im Bereich von -1 bis 1, wobei:

  1. Wenn die Korrelation +1 beträgt, haben die Werte eine perfekte positive lineare Beziehung. Wenn eine Variable zunimmt, nimmt die andere proportional zu;
  2. Wenn die Korrelation -1 beträgt, haben die Werte eine perfekte negative lineare Beziehung. Wenn eine Variable zunimmt, nimmt die andere proportional ab;
  3. Wenn der Korrelationskoeffizient nahe 0 liegt, besteht keine lineare Beziehung zwischen den Variablen.

Um die Korrelation zu berechnen, können wir die gleichen Schritte wie bei der Berechnung der Kovarianz anwenden und np.corrcoef(x, y)[0, 1] verwenden.

123456789101112131415161718192021222324252627
import matplotlib.pyplot as plt import numpy as np # Create a figure with three subplots fig, axes = plt.subplots(1, 3) fig.set_size_inches(10, 5) # Positive linear dependence x = np.random.rand(100) * 10 # Generate random x values y = x + np.random.randn(100) # Generate y values with added noise axes[0].scatter(x, y) # Scatter plot of x and y axes[0].set_title('Correlation is '+ str(round(np.corrcoef(x, y)[0, 1], 3) )) # Set title with correlation coefficient # Negative linear dependence x = np.random.rand(100) * 10 # Generate random x values y = -x + np.random.randn(100) # Generate y values with added noise axes[1].scatter(x, y) # Scatter plot of x and y axes[1].set_title('Correlation is '+ str(round(np.corrcoef(x, y)[0, 1], 3) )) # Set title with correlation coefficient # Independent np.random.seed(0) # Set random seed for reproducibility x = np.random.rand(200) # Generate random x values y = np.random.rand(200) # Generate random y values axes[2].scatter(x, y) # Scatter plot of x and y axes[2].set_title('Correlation is '+ str(round(np.corrcoef(x, y)[0, 1], 3) )) # Set title with correlation coefficient plt.show() # Display the plot
copy

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 5. Kapitel 2
We're sorry to hear that something went wrong. What happened?
some-alt