From ce17502029cccde1d87745a2b4abc74579e854cd Mon Sep 17 00:00:00 2001 From: Jan-Niclas Loosen Date: Thu, 30 Jan 2025 11:12:08 +0100 Subject: [PATCH] add llm chapter --- boa/analysis/aufgabe_02.py | 22 +++-- ...Java_Jan_2022_last_revision.boa.output.txt | 0 ...thon_Feb_2022_last_revision.boa.output.txt | 0 boa/analysis/test.py | 9 -- boa/mining/aufgabe_01_a.boa | 4 +- boa/mining/aufgabe_01_b.boa | 10 +- .../boa-job111838-output.txt} | 0 .../boa-job111839-output.txt} | 0 .../boa-job111840-output.txt} | 0 llm/.idea/.gitignore | 8 ++ llm/.idea/cohens-d.iml | 12 +++ .../inspectionProfiles/Project_Default.xml | 12 +++ .../inspectionProfiles/profiles_settings.xml | 6 ++ llm/.idea/misc.xml | 7 ++ llm/.idea/modules.xml | 8 ++ llm/.idea/vcs.xml | 6 ++ llm/cohens-output/chatgpt.txt | 74 +++++++++++++++ llm/cohens-output/claude.txt | 54 +++++++++++ llm/cohens-output/deepseek.txt | 58 ++++++++++++ llm/cohens-output/gemini.txt | 93 +++++++++++++++++++ llm/cohens-output/github_copilot.txt | 40 ++++++++ llm/cohens-output/perplexity.txt | 46 +++++++++ 22 files changed, 443 insertions(+), 26 deletions(-) rename boa/analysis/{data => boa-output}/try_Java_Jan_2022_last_revision.boa.output.txt (100%) rename boa/analysis/{data => boa-output}/try_Python_Feb_2022_last_revision.boa.output.txt (100%) delete mode 100644 boa/analysis/test.py rename boa/mining/{boa-job111439-output.txt => boa-output/boa-job111838-output.txt} (100%) rename boa/mining/{boa-job111005-output.txt => boa-output/boa-job111839-output.txt} (100%) rename boa/mining/{boa-job111006-output.txt => boa-output/boa-job111840-output.txt} (100%) create mode 100644 llm/.idea/.gitignore create mode 100644 llm/.idea/cohens-d.iml create mode 100644 llm/.idea/inspectionProfiles/Project_Default.xml create mode 100644 llm/.idea/inspectionProfiles/profiles_settings.xml create mode 100644 llm/.idea/misc.xml create mode 100644 llm/.idea/modules.xml create mode 100644 llm/.idea/vcs.xml create mode 100644 llm/cohens-output/chatgpt.txt create mode 100644 llm/cohens-output/claude.txt create mode 100644 llm/cohens-output/deepseek.txt create mode 100644 llm/cohens-output/gemini.txt create mode 100644 llm/cohens-output/github_copilot.txt create mode 100644 llm/cohens-output/perplexity.txt diff --git a/boa/analysis/aufgabe_02.py b/boa/analysis/aufgabe_02.py index 39d33e7..d6da1fa 100644 --- a/boa/analysis/aufgabe_02.py +++ b/boa/analysis/aufgabe_02.py @@ -8,11 +8,14 @@ import matplotlib.pyplot as plt import matplotlib matplotlib.use('TkAgg') -JAVA_INPUT = './data/try_Java_Jan_2022_last_revision.boa.output.txt' -PYTHON_INPUT = './data/try_Python_Feb_2022_last_revision.boa.output.txt' +# Input Pfade +JAVA_INPUT = './boa-output/try_Java_Jan_2022_last_revision.boa.output.txt' +PYTHON_INPUT = './boa-output/try_Python_Feb_2022_last_revision.boa.output.txt' -SHOW_PLOTS = False -SEED = 3 +# Konfiguration von read_sample +SEED = 1 +SHOW_PLOTS = True +SAMPLES = 1000 def read_sample(file_path, title='', sample_size=0, show=True): # filename kann auch ein URL sein: "https://..../example.csv" @@ -50,12 +53,11 @@ def cohen_d(x, y): # Stichprobengrößen der Gruppen size_x, size_y = len(x), len(y) - # Gepoolte Varianz und Standardabweichung - pool_var = ((size_x - 1) * var_x + (size_y - 1) * var_y) / (size_x + size_y - 2) - pool_var = math.sqrt(pool_var) + # Gepoolte Standardabweichung + pool_std = math.sqrt(((size_x - 1) * var_x + (size_y - 1) * var_y) / (size_x + size_y - 2)) # Cohen's d - d_val = mean_diff / pool_var + d_val = mean_diff / pool_std return d_val def find_barrier(x_sample_path, y_sample_path, alpha=0.1, lower_limit=2, upper_limit=10000): @@ -95,12 +97,12 @@ def main(): print('Statistische Berechnungen zu Häufigkeiten (Übung 5)') print('\nEinlesen der ersten Stichprobe (Python)') - python_sample = read_sample(PYTHON_INPUT, sample_size=1000, show=SHOW_PLOTS, title="Python") + python_sample = read_sample(PYTHON_INPUT, sample_size=SAMPLES, show=SHOW_PLOTS, title="Python") print('Mean:' + str(python_sample['Ratio'].mean())) print('Variance:' + str(python_sample['Ratio'].var())) print('\nEinlesen der zweiten Stichprobe (Java)') - java_sample = read_sample(JAVA_INPUT, sample_size=1000, show=SHOW_PLOTS, title="Java") + java_sample = read_sample(JAVA_INPUT, sample_size=SAMPLES, show=SHOW_PLOTS, title="Java") print('Mean:' + str(java_sample['Ratio'].mean())) print('Variance:' + str(java_sample['Ratio'].var())) diff --git a/boa/analysis/data/try_Java_Jan_2022_last_revision.boa.output.txt b/boa/analysis/boa-output/try_Java_Jan_2022_last_revision.boa.output.txt similarity index 100% rename from boa/analysis/data/try_Java_Jan_2022_last_revision.boa.output.txt rename to boa/analysis/boa-output/try_Java_Jan_2022_last_revision.boa.output.txt diff --git a/boa/analysis/data/try_Python_Feb_2022_last_revision.boa.output.txt b/boa/analysis/boa-output/try_Python_Feb_2022_last_revision.boa.output.txt similarity index 100% rename from boa/analysis/data/try_Python_Feb_2022_last_revision.boa.output.txt rename to boa/analysis/boa-output/try_Python_Feb_2022_last_revision.boa.output.txt diff --git a/boa/analysis/test.py b/boa/analysis/test.py deleted file mode 100644 index b0f07ce..0000000 --- a/boa/analysis/test.py +++ /dev/null @@ -1,9 +0,0 @@ -import random - -random.seed(1) -print(random.randint(0, 10)) -print(random.randint(0, 10)) -print(random.randint(0, 10)) -print(random.randint(0, 10)) -print(random.randint(0, 10)) -print(random.randint(0, 10)) \ No newline at end of file diff --git a/boa/mining/aufgabe_01_a.boa b/boa/mining/aufgabe_01_a.boa index 977700e..7ad80e9 100644 --- a/boa/mining/aufgabe_01_a.boa +++ b/boa/mining/aufgabe_01_a.boa @@ -1,5 +1,5 @@ -# Java-Job: 111005 -# Python-Job: 111006 +# Java-Job: 111839 +# Python-Job: 111840 # Includes all revisions p: Project = input; diff --git a/boa/mining/aufgabe_01_b.boa b/boa/mining/aufgabe_01_b.boa index 97e184f..ead66b7 100644 --- a/boa/mining/aufgabe_01_b.boa +++ b/boa/mining/aufgabe_01_b.boa @@ -1,5 +1,5 @@ -# Java-Job: 111694 -# Python-Job: 111439 +# Java-Job: Throws empty error on the "2022 Jan/Java" dataset. +# Python-Job: 111838 # Includes all revisions p: Project = input; @@ -12,7 +12,7 @@ cur_date: time; statement_counter := visitor { before node: Statement -> { - if (def(node.kind) and (node.kind == StatementKind.TRY or node.kind == StatementKind.WITH)) + if (node.kind == StatementKind.TRY or node.kind == StatementKind.WITH) relative_list[p.name][yearof(cur_date)] << 1; else relative_list[p.name][yearof(cur_date)] << 0; @@ -21,8 +21,8 @@ statement_counter := visitor { visit(p, visitor { before node: CodeRepository -> { - for (minus_year: int=22; minus_year >= 0; minus_year--) { - cur_date = addyear(T"Dec 31, 2022, 10:00:00 AM", -minus_year); + for (minus_year: int=19; minus_year >= 0; minus_year--) { + cur_date = addyear(T"Dec 31, 2019, 10:00:00 AM", -minus_year); snapshot := getsnapshot(node, cur_date); foreach (i: int; def(snapshot[i])) diff --git a/boa/mining/boa-job111439-output.txt b/boa/mining/boa-output/boa-job111838-output.txt similarity index 100% rename from boa/mining/boa-job111439-output.txt rename to boa/mining/boa-output/boa-job111838-output.txt diff --git a/boa/mining/boa-job111005-output.txt b/boa/mining/boa-output/boa-job111839-output.txt similarity index 100% rename from boa/mining/boa-job111005-output.txt rename to boa/mining/boa-output/boa-job111839-output.txt diff --git a/boa/mining/boa-job111006-output.txt b/boa/mining/boa-output/boa-job111840-output.txt similarity index 100% rename from boa/mining/boa-job111006-output.txt rename to boa/mining/boa-output/boa-job111840-output.txt diff --git a/llm/.idea/.gitignore b/llm/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/llm/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/llm/.idea/cohens-d.iml b/llm/.idea/cohens-d.iml new file mode 100644 index 0000000..d740938 --- /dev/null +++ b/llm/.idea/cohens-d.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/llm/.idea/inspectionProfiles/Project_Default.xml b/llm/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..06bb031 --- /dev/null +++ b/llm/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/llm/.idea/inspectionProfiles/profiles_settings.xml b/llm/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/llm/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/llm/.idea/misc.xml b/llm/.idea/misc.xml new file mode 100644 index 0000000..1d3ce46 --- /dev/null +++ b/llm/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/llm/.idea/modules.xml b/llm/.idea/modules.xml new file mode 100644 index 0000000..880abad --- /dev/null +++ b/llm/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/llm/.idea/vcs.xml b/llm/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/llm/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/llm/cohens-output/chatgpt.txt b/llm/cohens-output/chatgpt.txt new file mode 100644 index 0000000..1d3812b --- /dev/null +++ b/llm/cohens-output/chatgpt.txt @@ -0,0 +1,74 @@ +CHATGPT + +Cohen's \(d\) ist ein Effektstärkemaß, das die standardisierte Differenz zwischen zwei Mittelwerten angibt. Es wird häufig verwendet, um die Größe eines Effekts zu bewerten, insbesondere in statistischen Hypothesentests. + +Hier ist eine Anleitung zur Berechnung von Cohen's \(d\) in Python: + +--- + +### Formel für Cohen's \(d\): +\[ +d = \frac{M_1 - M_2}{SD_{\text{pooled}}} +\] +- \(M_1, M_2\): Mittelwerte der beiden Gruppen +- \(SD_{\text{pooled}} = \sqrt{\frac{(n_1 - 1) \cdot SD_1^2 + (n_2 - 1) \cdot SD_2^2}{n_1 + n_2 - 2}}\): Gepoolte Standardabweichung + - \(n_1, n_2\): Stichprobengrößen der beiden Gruppen + - \(SD_1, SD_2\): Standardabweichungen der beiden Gruppen + +--- + +### Python-Code: +Hier ein Beispiel, wie man Cohen's \(d\) berechnen kann: + +```python +import numpy as np + +def cohens_d(group1, group2): + # Mittelwerte der beiden Gruppen + mean1, mean2 = np.mean(group1), np.mean(group2) + + # Standardabweichungen der beiden Gruppen + std1, std2 = np.std(group1, ddof=1), np.std(group2, ddof=1) + + # Stichprobengrößen + n1, n2 = len(group1), len(group2) + + # Gepoolte Standardabweichung + pooled_std = np.sqrt(((n1 - 1) * std1**2 + (n2 - 1) * std2**2) / (n1 + n2 - 2)) + + # Cohen's d + d = (mean1 - mean2) / pooled_std + return d + +# Beispiel-Daten +gruppe1 = [2, 4, 6, 8, 10] +gruppe2 = [3, 5, 7, 9, 11] + +# Berechnung +ergebnis = cohens_d(gruppe1, gruppe2) +print(f"Cohen's d: {ergebnis}") +``` + +--- + +### Erläuterung: +1. **Daten vorbereiten**: Die beiden Gruppen können als Listen oder numpy-Arrays übergeben werden. +2. **Standardabweichung und Mittelwert berechnen**: Mit numpy's Funktionen (`np.mean` und `np.std`). +3. **Gepoolte Standardabweichung**: Eine gewichtete Mischung der Varianzen. +4. **Berechnung von \(d\)**: Differenz der Mittelwerte geteilt durch die gepoolte Standardabweichung. + +--- + +### Beispiel-Ausgabe: +Angenommen, die Gruppen sind: +- Gruppe 1: [2, 4, 6, 8, 10] +- Gruppe 2: [3, 5, 7, 9, 11] + +Die Ausgabe wäre: +``` +Cohen's d: -0.22360679774997896 +``` + +--- + +Falls du weitere Anpassungen oder Optimierungen benötigst, lass es mich wissen! \ No newline at end of file diff --git a/llm/cohens-output/claude.txt b/llm/cohens-output/claude.txt new file mode 100644 index 0000000..362a8b8 --- /dev/null +++ b/llm/cohens-output/claude.txt @@ -0,0 +1,54 @@ +CLAUDE + +Here's a Python function to calculate Cohen's d: + +```python +import numpy as np + +def cohens_d(group1, group2): + """ + Calculate Cohen's d effect size between two groups. + + Parameters: + group1 (array-like): First group of values + group2 (array-like): Second group of values + + Returns: + float: Cohen's d value + """ + # Convert to numpy arrays + group1 = np.array(group1) + group2 = np.array(group2) + + # Calculate means + mean1 = np.mean(group1) + mean2 = np.mean(group2) + + # Calculate pooled standard deviation + n1, n2 = len(group1), len(group2) + var1, var2 = np.var(group1, ddof=1), np.var(group2, ddof=1) + + pooled_sd = np.sqrt(((n1 - 1) * var1 + (n2 - 1) * var2) / (n1 + n2 - 2)) + + # Calculate Cohen's d + d = (mean2 - mean1) / pooled_sd + + return d + +# Example usage +# group1 = [1, 2, 3, 4, 5] +# group2 = [3, 4, 5, 6, 7] +# effect_size = cohens_d(group1, group2) + +``` + +Key points: +- Uses pooled standard deviation +- Works with numpy arrays +- Handles different group sizes +- Returns effect size magnitude and direction + +Interpretation: +- |d| < 0.2: Small effect +- 0.2 ≤ |d| < 0.5: Medium effect +- |d| ≥ 0.5: Large effect \ No newline at end of file diff --git a/llm/cohens-output/deepseek.txt b/llm/cohens-output/deepseek.txt new file mode 100644 index 0000000..e9e742e --- /dev/null +++ b/llm/cohens-output/deepseek.txt @@ -0,0 +1,58 @@ +DEEPSEEK + +Cohen's d ist ein Maß für die Effektstärke und wird häufig verwendet, um die standardisierte Differenz zwischen zwei Mittelwerten zu berechnen. Um Cohen's d in Python zu berechnen, kannst du die folgende Formel verwenden: + +\[ d = \frac{\bar{X}_1 - \bar{X}_2}{s} \] + +wobei: +- \(\bar{X}_1\) und \(\bar{X}_2\) die Mittelwerte der beiden Gruppen sind, +- \(s\) die gepoolte Standardabweichung ist. + +Die gepoolte Standardabweichung \(s\) wird wie folgt berechnet: + +\[ s = \sqrt{\frac{(n_1 - 1) \cdot s_1^2 + (n_2 - 1) \cdot s_2^2}{n_1 + n_2 - 2}} \] + +wobei: +- \(n_1\) und \(n_2\) die Stichprobengrößen der beiden Gruppen sind, +- \(s_1^2\) und \(s_2^2\) die Varianzen der beiden Gruppen sind. + +Hier ist ein Beispiel, wie du Cohen's d in Python berechnen kannst: + +```python +import numpy as np + +def cohens_d(group1, group2): + # Mittelwerte berechnen + mean1, mean2 = np.mean(group1), np.mean(group2) + + # Varianzen berechnen + var1, var2 = np.var(group1, ddof=1), np.var(group2, ddof=1) + + # Stichprobengrößen + n1, n2 = len(group1), len(group2) + + # Gepoolte Standardabweichung berechnen + pooled_std = np.sqrt(((n1 - 1) * var1 + (n2 - 1) * var2) / (n1 + n2 - 2)) + + # Cohen's d berechnen + d = (mean1 - mean2) / pooled_std + + return d + +# Beispiel-Daten +group1 = [1, 2, 3, 4, 5] +group2 = [2, 3, 4, 5, 6] + +# Cohen's d berechnen +d = cohens_d(group1, group2) +print(f"Cohen's d: {d}") +``` + +In diesem Beispiel wird die Funktion `cohens_d` verwendet, um Cohen's d für zwei Gruppen von Daten zu berechnen. Die Funktion berechnet die Mittelwerte, Varianzen und die gepoolte Standardabweichung und gibt dann Cohen's d zurück. + +### Interpretation von Cohen's d: +- **d ≈ 0.2**: Kleiner Effekt +- **d ≈ 0.5**: Mittlerer Effekt +- **d ≈ 0.8**: Großer Effekt + +Diese Werte sind Richtlinien und können je nach Kontext variieren. \ No newline at end of file diff --git a/llm/cohens-output/gemini.txt b/llm/cohens-output/gemini.txt new file mode 100644 index 0000000..df0de17 --- /dev/null +++ b/llm/cohens-output/gemini.txt @@ -0,0 +1,93 @@ +GEMINI + +## Berechnung von Cohen's d in Python: Eine Schritt-für-Schritt-Anleitung + +**Cohen's d** ist ein Maß für die Effektstärke, das häufig in der Statistik verwendet wird, um die Größe eines Unterschieds zwischen zwei Gruppen zu quantifizieren. In Python können wir diese Berechnung recht einfach mit Hilfe von Bibliotheken wie NumPy und SciPy durchführen. + +### 1. Installation der notwendigen Bibliotheken +Falls du NumPy und SciPy noch nicht installiert hast, kannst du dies über pip tun: + +```bash +pip install numpy scipy +``` + +### 2. Importieren der Bibliotheken +```python +import numpy as np +from scipy import stats +``` + +### 3. Berechnen von Cohen's d +Die Formel für Cohen's d lautet: + +``` +d = (M1 - M2) / s_pooled +``` + +wobei: +* M1 und M2 die Mittelwerte der beiden Gruppen sind +* s_pooled die gepoolte Standardabweichung ist + +Hier ist eine Python-Funktion, die Cohen's d berechnet: + +```python +def cohen_d(x, y): + """Calculates Cohen's d for independent samples. + + Args: + x: The first sample. + y: The second sample. + + Returns: + Cohen's d. + """ + + nx = len(x) + ny = len(y) + dof = nx + ny - 2 + + # Calculate the pooled standard deviation + sx = np.std(x, ddof=1) + sy = np.std(y, ddof=1) + s_pooled = np.sqrt(((nx-1)*sx**2 + (ny-1)*sy**2) / dof) + + # Calculate Cohen's d + d = (np.mean(x) - np.mean(y)) / s_pooled + + return d +``` + +### 4. Beispiel +```python +# Erstelle zwei Beispiel-Datensätze +group1 = [1, 2, 3, 4, 5] +group2 = [6, 7, 8, 9, 10] + +# Berechne Cohen's d +d = cohen_d(group1, group2) +print("Cohen's d:", d) +``` + +**Interpretation von Cohen's d:** +* |d| < 0.2: Sehr kleiner Effekt +* 0.2 ≤ |d| < 0.5: Kleiner bis mittlerer Effekt +* 0.5 ≤ |d| < 0.8: Mittlerer bis großer Effekt +* |d| ≥ 0.8: Sehr großer Effekt + +**Wichtiger Hinweis:** +* **Unabhängige Stichproben:** Die obige Funktion ist für unabhängige Stichproben konzipiert. Für abhängige Stichproben (z.B. bei wiederholten Messungen) gibt es eine leicht abgewandelte Formel. +* **Normalverteilung:** Cohen's d setzt normalerweise eine annähernd normale Verteilung der Daten voraus. +* **Ausreißer:** Ausreißer können die Berechnung von Cohen's d stark beeinflussen. Es ist ratsam, die Daten vor der Berechnung auf Ausreißer zu überprüfen. + +**Zusätzliche Funktionen in Bibliotheken:** +Einige Python-Bibliotheken wie `pingouin` bieten bereits eingebaute Funktionen für die Berechnung von Effektstärken wie Cohen's d an und können zusätzliche Statistiken berechnen. + +**Weitere Überlegungen:** +* **Effektgröße:** Cohen's d ist nur eine von vielen Effektstärken. Die Wahl der geeigneten Effektstärke hängt von der Forschungsfrage und den Daten ab. +* **Konfidenzintervalle:** Es ist oft hilfreich, ein Konfidenzintervall für Cohen's d zu berechnen, um die Unsicherheit der Schätzung zu quantifizieren. + +**Zusammenfassung:** + +Mit dieser Anleitung und dem bereitgestellten Python-Code kannst du Cohen's d effektiv berechnen und interpretieren. Denk daran, die Voraussetzungen für die Anwendung von Cohen's d zu überprüfen und gegebenenfalls Anpassungen vorzunehmen. + +**Möchtest du noch mehr über Cohen's d oder andere Effektstärken erfahren?** diff --git a/llm/cohens-output/github_copilot.txt b/llm/cohens-output/github_copilot.txt new file mode 100644 index 0000000..70d0888 --- /dev/null +++ b/llm/cohens-output/github_copilot.txt @@ -0,0 +1,40 @@ +GITHUB COPILOT + +Cohen's d ist ein Maß für die Effektstärke, das den Unterschied zwischen zwei Mittelwerten in Standardabweichungseinheiten angibt. Hier ist ein Beispiel, wie man Cohen's d in Python berechnen kann: + +```python +import numpy as np + +def cohen_d(x, y): + # Berechnung der Mittelwerte der beiden Gruppen + mean_x = np.mean(x) + mean_y = np.mean(y) + + # Berechnung der Standardabweichungen der beiden Gruppen + std_x = np.std(x, ddof=1) + std_y = np.std(y, ddof=1) + + # Berechnung der gepoolten Standardabweichung + pooled_std = np.sqrt(((len(x) - 1) * std_x**2 + (len(y) - 1) * std_y**2) / (len(x) + len(y) - 2)) + + # Berechnung von Cohen's d + d = (mean_x - mean_y) / pooled_std + + return d + +# Beispielwerte für zwei Gruppen +group1 = [2.3, 3.1, 4.2, 5.0, 3.8] +group2 = [3.5, 4.1, 5.2, 6.0, 4.8] + +# Berechnung von Cohen's d +d_value = cohen_d(group1, group2) +print(f"Cohen's d: {d_value:.2f}") +``` + +In diesem Beispiel: + +1. Berechnen wir die Mittelwerte und Standardabweichungen der beiden Gruppen. +2. Berechnen wir die gepoolte Standardabweichung, die eine gewichtete Kombination der Standardabweichungen der beiden Gruppen ist. +3. Berechnen wir Cohen's d, indem wir die Differenz der Mittelwerte durch die gepoolte Standardabweichung teilen. + +Wenn Sie dies ausführen, erhalten Sie den Wert von Cohen's d, der die Effektstärke zwischen den beiden Gruppen angibt. \ No newline at end of file diff --git a/llm/cohens-output/perplexity.txt b/llm/cohens-output/perplexity.txt new file mode 100644 index 0000000..bfd870c --- /dev/null +++ b/llm/cohens-output/perplexity.txt @@ -0,0 +1,46 @@ +PERPLEXITY + +Um Cohen's d in Python zu berechnen, können Sie die folgende Funktion verwenden: + +```python +import numpy as np + +def cohens_d(group1, group2): + # Berechnung der Mittelwerte der beiden Gruppen + mean1, mean2 = np.mean(group1), np.mean(group2) + + # Berechnung der gepoolten Standardabweichung + n1, n2 = len(group1), len(group2) + std1, std2 = np.std(group1, ddof=1), np.std(group2, ddof=1) + pooled_std = np.sqrt(((n1 - 1) * std1**2 + (n2 - 1) * std2**2) / (n1 + n2 - 2)) + + # Berechnung von Cohen's d + d = (mean1 - mean2) / pooled_std + return d +``` + +Diese Funktion nimmt zwei Gruppen als Eingabe und gibt den berechneten Cohen's d-Wert zurück[3]. Sie können die Funktion wie folgt verwenden: + +```python +# Beispieldaten für zwei Gruppen +group1 = np.array([5, 7, 9, 11, 13]) +group2 = np.array([6, 8, 10, 12, 14]) + +# Berechnung von Cohen's d +effect_size = cohens_d(group1, group2) +print("Cohen's d:", effect_size) +``` + +Die Interpretation von Cohen's d ist wie folgt: +- Kleiner Effekt: Cohen's d ≈ 0,2 +- Mittlerer Effekt: Cohen's d ≈ 0,5 +- Großer Effekt: Cohen's d ≈ 0,8[1] + +Beachten Sie, dass diese Schwellenwerte als Richtwerte dienen und je nach Forschungsbereich variieren können[1]. + +Citations: +[1] https://martin-grellmann.de/cohens-d-eine-einfuehrung-in-die-effektstaerke-und-rechner +[2] https://novustat.com/statistik-blog/cohens-d-effektstaerke-berechnen.html +[3] https://www.askpython.com/python/examples/cohens-d-python +[4] https://statistikguru.de/rechner/cohens-d-gepaarter-t-test.html +[5] https://statistikguru.de/rechner/cohens-d.html \ No newline at end of file