diff --git a/Plot_Assingment.py b/Plot_Assingment.py new file mode 100644 index 0000000..3ff09b5 --- /dev/null +++ b/Plot_Assingment.py @@ -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)) + diff --git a/plot.png b/plot.png new file mode 100644 index 0000000..0ee06c5 Binary files /dev/null and b/plot.png differ diff --git "a/signment solution\357\200\272 Markdown file, plot, and script\357\200\242" "b/signment solution\357\200\272 Markdown file, plot, and script\357\200\242" new file mode 100644 index 0000000..6038728 --- /dev/null +++ "b/signment solution\357\200\272 Markdown file, plot, and script\357\200\242" @@ -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 +user.email=ks.thakoerdin@gmail.com diff --git a/solution_16494105.md b/solution_16494105.md new file mode 100644 index 0000000..e398321 --- /dev/null +++ b/solution_16494105.md @@ -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 \ No newline at end of file