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
49 changes: 49 additions & 0 deletions Plot_Assingment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import pandas as pd
import matplotlib.pyplot as plt

# Load CSV
df = pd.read_csv("istherecorrelation.csv", sep=';')

# Extract data
years = df.iloc[:, 0].astype(int)
wo = df.iloc[:, 1].str.replace(',', '.').astype(float)
nl = df.iloc[:, 2].astype(float)

wo_lag1 = wo.shift(1)
nl_lag1 = nl.shift(1)

# Create dual-axis plot
fig, ax1 = plt.subplots(figsize=(10,6), dpi=300)
# Left axis: WO
ax1.plot(years, wo, marker='o', color='blue', alpha=0.5, label='WO [x1000]')
ax1.set_xlabel("Year")
ax1.set_ylabel("WO [x1000]", color='blue')
ax1.tick_params(axis='y', labelcolor='blue')
ax1.set_ylim(wo.min()*0.95, wo.max()*1.05)

# Right axis: NL Beer consumption
ax2 = ax1.twinx()
ax2.plot(years, nl, marker='s', color='green', alpha=0.5, label='NL Beer consumption [x1000 hl]')
ax2.set_ylabel("NL Beer consumption [x1000 hl]", color='green')
ax2.tick_params(axis='y', labelcolor='green')
ax2.set_ylim(nl.min()*0.95, nl.max()*1.05)

# Add Legend
lines_1, labels_1 = ax1.get_legend_handles_labels()
lines_2, labels_2 = ax2.get_legend_handles_labels()
ax1.legend(lines_1 + lines_2, labels_1 + labels_2, loc='upper left')


plt.title("WO and NL Beer Consumption over Time ")
plt.xticks(years, rotation=45)
plt.grid(True)
plt.tight_layout()

# Save plot
plt.savefig("plot.png", dpi=300)
plt.show()

print("Correlation WO vs NL same year:", wo.corr(nl))
print("Correlation WO vs NL previous year:", wo.corr(nl_lag1))
print("Correlation NL vs WO previous year:", nl.corr(wo_lag1))

Binary file added plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions signment solution Markdown file, plot, and script
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/etc/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
gui.recentrepo=C:/Users/kstha/Desktop
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
submodule.active=.
remote.origin.url=https://github.com/KsThakoerdin/CS_Assignment.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.main.remote=origin
branch.main.merge=refs/heads/main
user.name=Kevin Thakoerdin
[email protected]
19 changes: 19 additions & 0 deletions solution_16494105.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CS Toolbox Assingment

**Name :** Kevin Thakoerdin

**Student ID :** 16494105

## Papers:

1. MCC Van Dyke et al., 2019
2. JT Harvey, Applied Ergonomics, 2002
3. DW Ziegler et al., 200

## Plot

![My plot](plot.png)

## Analysis

The computed correlation between WO and NL Beer consumption measures a linear association. However, by visual inspection, the NL Beer consumption series does not follow a linear trend: it remains roughly steady until 2014 and then rises sharply, almost exponentially. In contrast, the WO student population increases steadily over the entire period. This suggests that a simple linear regression would not fit NL Beer consumption well, and the high correlation mainly reflects the late increase rather than a consistent relationship throughout. Therefore, while correlation gives a first indication of association, it does not fully capture the temporal dynamics of the data