Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added beer_per_student_linear_fit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

df = pd.read_csv("istherecorrelation.csv", sep=";", decimal=",")

beer_per_student = (df.iloc[:, 2] / df.iloc[:, 1])

x = df["Year"].to_numpy(dtype=float)
y = beer_per_student.to_numpy(dtype=float)

m, b = np.polyfit(x, y, 1)
y_hat = m * x + b

r2 = 1 - np.sum((y - y_hat)**2) / np.sum((y - y.mean())**2)

plt.figure(figsize=(8,5), dpi=150)
plt.plot(x, y, marker="o", label="Beer (hl) per 1000 WO students")
plt.plot(x, y_hat, linestyle="--", label=f"Linear fit (R²={r2:.3f})")
plt.xlabel("Year")
plt.ylabel("Hectoliters per 1000 students")
plt.title("Beer per 1000 WO Students (linear fit)")
plt.grid(True)
plt.legend()
plt.savefig("beer_per_student_linear_fit.png", dpi=300)
plt.show()
10 changes: 10 additions & 0 deletions solution_TimonJasarevic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
4. StudentID: 13432001

5.
-Fantastic yeasts and where to find them: the hidden diversity of dimorphic fungal pathogens.
-An analysis of the forces required to drag sheep over various surfaces.
-The neurocognitive effects of alcohol on adolescents and college students.

![Beer per 1,000 WO Students](beer_per_student_linear_fit.png)

The WO students are drinking less beer over the years. There is a linear correlation with 0.93 R squared.