17 Commits

7 changed files with 232 additions and 239 deletions

View File

@@ -1,6 +1,6 @@
# KIT Library Hydration Study # KIT Library Hydration Study
Latex sources for a paper on the behavior of students at the KIT library with Latex sources for a paper on the behaviour of students at the KIT library with
regard to their water bottle refilling habits. regard to their water bottle refilling habits.
## Build ## Build
@@ -17,7 +17,7 @@ $ make
```bash ```bash
$ docker build -f Dockerfile . -t bib-paper $ docker build -f Dockerfile . -t bib-paper
``` ```
2. Build examples 2. Build document
```bash ```bash
$ docker run --rm -v $PWD:$PWD -w $PWD -u `id -u`:`id -g` bib-paper make $ docker run --rm -v $PWD:$PWD -w $PWD -u `id -u`:`id -g` bib-paper make
``` ```

View File

@@ -214,7 +214,7 @@ TLDR: Investigation of the efficacy of two cognitive behavior modification proce
} }
@article{schuman_effort_1985, @article{schuman_effort_1985,
title = {Effort and {Reward}: {The} {Assumption} that {College} {Grades} {Are} {Affected} by {Quantity} of {Study}*}, title = {Effort and {Reward}: {The} {Assumption} that {College} {Grades} {Are} {Affected} by {Quantity} of {Study}},
volume = {63}, volume = {63},
shorttitle = {Effort and {Reward}}, shorttitle = {Effort and {Reward}},
abstract = {The relation between college grades and self-reported amount of effort was examined in four major and several minor investigations of undergraduates in a large state university. Grades were operationalized mainly by using grade point average (GPA), though in one investigation grades in a particular course were the focus. Effort was measured in several different ways, ranging from student estimates of typical study over the term to reports of study on specific days. Despite evidence that these self-reports provide meaningful estimates of actual studying, there is at best only a very small relation between amount of studying and grades, as compared to the considerably stronger and more monotonic relations between grades and both aptitude measures and self-reported class attendance. The plausible assumption that college grades reflect student effort to an important extent does not receive much support from these investigations. This raises a larger question about the extent to which rewards are linked to effort in other areas of life—a connection often assumed but seldom investigated.}, abstract = {The relation between college grades and self-reported amount of effort was examined in four major and several minor investigations of undergraduates in a large state university. Grades were operationalized mainly by using grade point average (GPA), though in one investigation grades in a particular course were the focus. Effort was measured in several different ways, ranging from student estimates of typical study over the term to reports of study on specific days. Despite evidence that these self-reports provide meaningful estimates of actual studying, there is at best only a very small relation between amount of studying and grades, as compared to the considerably stronger and more monotonic relations between grades and both aptitude measures and self-reported class attendance. The plausible assumption that college grades reflect student effort to an important extent does not receive much support from these investigations. This raises a larger question about the extent to which rewards are linked to effort in other areas of life—a connection often assumed but seldom investigated.},

325
paper.tex
View File

@@ -1,56 +1,44 @@
\documentclass[journal]{IEEEtran} \documentclass[a4paper, journal]{IEEEtran}
\usepackage[left=1.57cm,right=1.57cm,top=1.8cm,bottom=1.57cm]{geometry}
\usepackage{amsmath,amsfonts} \usepackage{amsmath,amsfonts}
\usepackage{siunitx}
\usepackage{mleftright}
\usepackage{float} \usepackage{float}
\usepackage{titlesec} \usepackage{titlesec}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{siunitx}
\usepackage[normalem]{ulem}
\usepackage{dsfont}
\usepackage{mleftright}
\usepackage{bbm}
\usepackage[ \usepackage[
backend=biber, backend=biber,
style=ieee, style=ieee,
sorting=nty, sorting=nty,
]{biblatex} ]{biblatex}
\usepackage{tikz}
\usetikzlibrary{spy, arrows.meta,arrows}
\usepackage{pgfplots} \usepackage{pgfplots}
\pgfplotsset{compat=newest} \pgfplotsset{compat=newest}
\usepgfplotslibrary{statistics} \usepgfplotslibrary{statistics}
\usepackage{pgfplotstable}
\usepackage{filecontents}
\hyphenation{op-tical net-works semi-conduc-tor IEEE-Xplore}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Template modifications % Template modifications
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
\titlespacing*{\section} \titlespacing*{\section}{0mm}{3mm}{1mm}
{0mm}{3mm}{1mm}
\makeatletter \makeatletter
\def\@maketitle{% \def\@maketitle{%
\newpage \newpage
\null \null
\vspace*{-4mm} \vspace*{-3mm}
\begin{center}% \begin{center}%
{\Huge \linespread{0.9}\selectfont \@title \par}% {\Huge \linespread{0.9}\selectfont \@title \par}%
{\large {\large \lineskip .5em%
\lineskip .5em%
\begin{tabular}[t]{c}% \begin{tabular}[t]{c}%
\@author \@author
\end{tabular}\par}% \end{tabular}
\par}%
\end{center}% \end{center}%
\vspace*{-8mm} \vspace*{-3mm}
} }
\makeatother \makeatother
@@ -104,17 +92,17 @@
\begin{document} \begin{document}
\title{\vspace{-3mm}The Effect of the Choice of Hydration Strategy on \title{The Effect of the Choice of Hydration Strategy on
Average Academic Average Academic
Performance} Performance}
\author{Some concerned fellow students% \author{Some concerned fellow students%
\thanks{The authors would like to thank their hard-working peers as well as \thanks{The authors would like to thank their hard-working peers as
the staff of the KIT library for their unknowing - but vital - well as the staff of the KIT library for their unknowing - but vital
participation.}} - participation.}}
\markboth{Journal of the Association of KIT Bibliophiles}{The \markboth{Journal of the Association of KIT Bibliophiles}{The Effect
Effect of the Choice of Hydration Strategy on Average Academic Performance} of the Choice of Hydration Strategy on Average Academic Performance}
\maketitle \maketitle
@@ -124,13 +112,13 @@ Effect of the Choice of Hydration Strategy on Average Academic Performance}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% \vspace*{-10mm}
\begin{abstract} \begin{abstract}
We evaluate the \todo{\ldots} and project that by using the right button of We evaluate the relationship between hydration strategy and
the water dispenser to fill up their water bottles, students can potentially academic performance and project that by using the right button
gain up to \todo{5 minutes} of study time a day, which is equivalent to of the water dispenser to fill up their water bottles, students
raising their grades by up to \todo{0.01} points. can potentially gain up to \SI{4.14}{\second} of study time per
refill, which amounts to raising their grades by up to
$0.0003$ points.
\end{abstract} \end{abstract}
\begin{IEEEkeywords} \begin{IEEEkeywords}
@@ -143,45 +131,40 @@ Effect of the Choice of Hydration Strategy on Average Academic Performance}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
\vspace*{-5mm}
%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction} \section{Introduction}
\IEEEPARstart{T}{he} concepts of hydration and study have always been tightly % TODO: "The right strategy" pun?
interwoven. As an example, an investigation was once conducted by Bell Labs
into the productivity of their employees that found that ``workers with the \IEEEPARstart{T}{he} concepts of hydration and study have always been
most patents often shared lunch or breakfast with a Bell Labs electrical tightly interwoven. As an example, an investigation was once
engineer named Harry Nyquist'' \cite{gertner_idea_2012}, and we presume that conducted by Bell Labs into the productivity of their employees, that
they also paired their food with something to drink. We can see that found that ``workers with the most patents often shared lunch or
intellectual achievement and fluid consumption are related even for the most breakfast with a Bell Labs electrical engineer named Harry Nyquist''
\cite{gertner_idea_2012}, and we presume that they also paired their
food with something to drink. We can see that intellectual
achievement and fluid consumption are related even for the most
prestigious research institutions. prestigious research institutions.
In this work, we quantify this relationship in the context of studying at the In this work, we quantify this relationship in the context of
KIT library and subsequently develop a novel and broadly applicable strategy studying at the KIT library and subsequently develop a novel and
to leverage it to improve the academic performance of KIT students. broadly applicable strategy to leverage it to improve the academic
performance of KIT students.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Experimental Setup} \section{Experimental Setup}
Over a period of one week, we monitored the usage of the water dispenser Over a period of one week, we monitored the use of the water
on the ground floor of the KIT library at random times during the day. dispenser on the ground floor of the KIT library at random times
The experiment comprised two parts, a system measurement to determine the during the day. The experiment comprised two parts: a system
flowrate of the water dispenser, and a behavioral measurement, i.e., a recording measurement to determine the flowrate of the water dispenser, and a
of the choice of hydration strategy of the participants: $S_\text{L}$ denotes behavioural measurement, i.e., a record of participants' chosen
pressing the left button of the water dispenser, $S_\text{R}$ the right one, hydration strategies: $S_\text{L}$ denotes pressing the left
and $S_\text{B}$ pressing both buttons. button of the water dispenser, $S_\text{R}$ the right one, and
$S_\text{B}$ pressing both buttons.
For the system measurement $10$ datapoints were recorded for each strategy, For the system measurement $10$ datapoints were recorded for each
for the behavioral measurement $113$ in total. strategy, for the behavioural measurement $113$ in total.
% As is always the case with measurements, care must be taken not to alter
% quantities by measuring them. To this end, we made sure only to take system
% measurements in the absence of participants and to only record data on the
% behaviour of participants discreetly.
% TODO: Describe the actual measurement setup? (e.g., filling up a 0.7l bottle
% and timing with a standard smartphone timer)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Experimental Results} \section{Experimental Results}
@@ -189,7 +172,7 @@ for the behavioral measurement $113$ in total.
\begin{figure}[H] \begin{figure}[H]
\centering \centering
\vspace*{-4mm} \vspace*{-2mm}
\begin{tikzpicture} \begin{tikzpicture}
\begin{axis}[ \begin{axis}[
width=0.8\columnwidth, width=0.8\columnwidth,
@@ -215,7 +198,7 @@ for the behavioral measurement $113$ in total.
\end{axis} \end{axis}
\end{tikzpicture} \end{tikzpicture}
\vspace*{-3mm} \vspace*{-2mm}
\caption{Flow rate of the water dispenser depending on the \caption{Flow rate of the water dispenser depending on the
hydration strategy.} hydration strategy.}
@@ -224,16 +207,13 @@ for the behavioral measurement $113$ in total.
\end{figure} \end{figure}
Fig. \ref{fig:System} shows the results of the system measurement. Fig. \ref{fig:System} shows the results of the system measurement.
We observe that $S_\text{L}$ is the slowest strategy, while $S_\text{R}$ To investigate the difference in flowrate between strategies, we used
and $S_\text{B}$ are similar. Due to the small sample size and the a Mann Whitney U test, because of its nonparametric nature.
unknown distribution, the test we chose to verify this observation is a Mann We found that $S _\text{L}$ was slower than
Whitney U test. We found that $S _\text{L}$ is faster than $S_\text{R}$ with a $S_\text{R}$ with a significance of $p < 0.01$, while no
significance of $p < 0.0001$, while no significant statement could be made statistically significant difference was found between $S_\text{R}$ and
about $S_\text{R}$ and $S_\text{B}$. $S_\text{B}$. The results of the behavioural measurement are shown in
Fig. \ref{fig:Behavior} shows the results of the behavioral measurement. Fig. \ref{fig:Behavior}.
% During this part of the experiment, we also measured the time each participant
% needed to fill up their bottle. Using the measured flowrates we calculated
% the mean refill volume to be $\SI{673.92}{\milli\liter}$.
\begin{figure}[H] \begin{figure}[H]
\centering \centering
@@ -261,115 +241,58 @@ Fig. \ref{fig:Behavior} shows the results of the behavioral measurement.
\end{axis} \end{axis}
\end{tikzpicture} \end{tikzpicture}
\vspace*{-3mm} \vspace*{-2mm}
\caption{Distribution of the choice of hydration strategy.} \caption{Distribution of the choice of hydration strategy.}
\label{fig:Behavior} \label{fig:Behavior}
\vspace*{-1mm}
\end{figure} \end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Modelling} \section{Modelling the grade improvement}
We can consider the water dispenser and students as comprising a queueing We can consider the water dispenser and students as comprising a
system, specifically an M/G/1 queue \cite{stewart_probability_2009}. queueing system, specifically an M/G/1 queue
The expected response time, i.e., the time spent waiting as well as \cite{stewart_probability_2009}. The expected response time, i.e.,
the time dispensing water, is \cite[Section 14.3]{stewart_probability_2009}% the time spent waiting as well as the time dispensing water, is
\cite[Section 14.3]{stewart_probability_2009}%
%
\begin{align*} \begin{align*}
W = E\mleft\{ S \mright\} + \frac{\lambda E\mleft\{ S^2 W = E\mleft\{ S \mright\} + \frac{\lambda \cdot E\mleft\{ S^2
\mright\}}{2\mleft( 1-\rho \mright)} \mright\}}{2\mleft( 1-\rho \mright)}
,% ,%
\end{align*}% \end{align*}%
where $S$ denotes the service time (i.e., the time spent refilling a bottle), %
$\lambda$ the mean arrival time, and $\rho = \lambda \cdot E\mleft\{ where $S$ denotes the service time (i.e., the time spent refilling a
S \mright\}$ the system utilization. Using our bottle), $\lambda$ the mean arrival rate, and $\rho = \lambda \cdot
experimental data we can approximate all parameters and obtain E\mleft\{ S \mright\}$ the system utilisation. Using our experimental
\todo{$W \approx \SI{4}{\second}$}. The difference to always using data we can approximate all parameters and obtain $W \approx
the fastest strategy can be calculated as \todo{$\SI{5}{\second}$}. \SI{23.3}{\second}$. The difference to always using the fastest
% We examine the effects of the choice of hydration strategy. To strategy amounts to $\SI{4.14}{\second}$.
% this end, we start by estimating the potential time savings possible by always
% choosing the fastest strategy:%
% %
% % We can model the time needed for one person to refill their
% bottle as a random
% % variable (RV) $T_1 = V/R$ and the time saved by choosing the
% fastest strategy
% % as $\Delta T_1 = T_1 - V/\max r$, where $V$ and $R$ are RVs representing the
% % bottle volume and flowrate. The potential time saving for the
% last person in a
% % queue of $N$ people is thus $\Delta T_N = N\cdot\Delta T_1$. We
% can then model
% % the total time savings as $\Delta T_\text{tot} = \sum_{n=1}^{N} \Delta T_n$,
% % where N is an RV describing the queue length. Assuming the
% independence of all
% % RVs we can compute the mean total time savings as
% %
% \begin{gather*}
% T_1 = V/R, \hspace{3mm} \Delta T_1 = T_1 - V/\max R,
% \hspace{3mm} \Delta T_n = n \cdot \Delta T_1 \\
% \Delta T_\text{tot} = \sum_{n=1}^{N} \Delta T_\text{n} =
% \sum_{n=1}^{N} n \cdot \Delta T_1 = \Delta T_1 \frac{N\mleft( N+1
% \mright)}{2} \\
% \Delta t := E\mleft\{ \Delta T_\text{tot} \mright\} = E\mleft\{
% \Delta T_1 \mright\} \cdot \mleft[ E\mleft\{ N^2 \mright\} +
% E\mleft\{ N \mright\} \mright]/2
% ,%
% \end{gather*}
% %
% where $V$ and $R$ are random variables (RVs) representing the volume of a
% bottle and the flowrate, $\Delta T_n$ describes the time the last of $n$
% people saves, $\Delta T_\text{tot}$ the total time savings and $N$ the length
% of the queue. It is plausible to assume independence of $R,V$ and $N$.
% Using our experimental measurements we estimate $\todo{\Delta t =
% \SI{20}{\second}}$
Strangely, it is the consensus of current research that there is only Strangely, it is the consensus of current research that there is only
a weak relationship between academic performance and invested time a weak relationship between academic performance and hours studied
\cite{plant_why_2005}. Using the highest determined correlation we \cite{plant_why_2005}. Observing Figure 1 in
could find, \todo{$\rho = 0.18$ \cite{schuman_effort_1985}}, we \cite[p. 950]{schuman_effort_1985} and performing a linear regression,
estimate an upper bound on the possible grade gain of \todo{0.001}. we quantified the grade gain per additional hour studied as
$\SI{0.054}{points/hour}$. Using an estimate of 5 refills per day, we
thus predict a possible gain of up to $0.0003$ points.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Discussion and Conclusion} \section{Discussion and Conclusion}
Further research is needed to consolidate and expand on the results Further research is needed, particularly on the modelling of the
of this paper, e.g., by expanding on the modelling of the arrival arrival process and the relationship between the response time and
process or further investigating the relationship between the study the grade gain. Nevertheless, we believe this work serves as a solid
time and the resulting grade for the target demographic. first step on the path towards achieving optimal study behaviour.
Nevertheless, we believe this study serves as a solid first step
towards the optimization of the study behaviour of KIT students and
thus the betterment of society in general.
% Many attempts have been made in the literature to relate
% the time spent studying to academic achievement - see, e.g.
% \cite{schuman_effort_1985, zulauf_use_1999, michaels_academic_1989,
% dickinson_effect_1990}.
% The overwhelming consensus is that there is a significant relationship,
% though it is a weak one.
%
%Many of the studies were only performed over
% a period of one week or even day, so we believe care should be taken when
% generlizing these results. Nevertheless, the overwhelming consensus in the
% literature is that a significant relationship exists, though it is a weak one.
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Conclusion}
In this study, we investigated how the choice of hydration strategy In this study, we investigated how the choice of hydration strategy
affects the average academic performance. We found that always affects average academic performance. We found that always choosing
choosing to press the right button leads to an average time gain of to press the right button leads to an average time gain of
\todo{\SI{10}{\second}} \todo{per day}, which translates into a grade \SI{4.14}{\second} per refill, which translates into a grade
improvement of $\todo{0.001}$ levels. We thus propose a novel and improvement of up to $0.0003$ points. We thus propose a novel and
broadly applicable strategy to boost the average academic performance broadly applicable strategy to boost the average academic performance
of KIT students: always pressing the right button. of KIT students: always using the right button.
% Further research is needed to develop a better model of how the choice of
% hydration strategy is related to academic performance. We
% suspect that there is a compounding effect that leads to $S_\text{L}$ being an
% even worse choice of hydration strategy: When the queue is long, students are
% less likely to refill their empty water bottles, leading to reduced mental
% ability. Nevertheless, we believe that with this work we have laid a solid
% foundation and hope that our results will find widespread acceptance among the
% local student population.
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -379,75 +302,5 @@ of KIT students: always pressing the right button.
\printbibliography \printbibliography
% \appendix
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Derivation of Service Time}
% \label{sec:Derivation of Service Time}
%
%
% We want to compute the response time of our queueing system, i.e.,
% \cite[Section 14.3]{stewart_probability_2009}
% \begin{align*}
% W = E\mleft\{ S \mright\} + \frac{\lambda E\mleft\{ S^2
% \mright\}}{2\mleft( 1-\rho \mright)}
% .%
% \end{align*}%
% We start by modelling the service time and subsequently calculate $\lambda$
% and $\rho$.
%
% Let $S, V$ and $R$ be random variables denoting the service time,
% refill volume
% and refill rate, respectively. Assuming that $V$ and $R$ are independent, we
% have
% \begin{gather*}
% S = \frac{V}{R} \hspace{5mm} \text{and} \hspace{5mm}
% P_R(r) = \left\{\begin{array}{rl}
% P(S_\text{L}), & r = r_{S_\text{L}} \\
% 1-P(S_\text{L}), & r = r_{S_\text{R}}
% \end{array}\right.
% \end{gather*}%
% \begin{align*}
% E\mleft\{ S^2 \mright\} &= E\mleft\{ V^2 \mright\}E\mleft\{ 1 /
% R^2 \mright\} \\
% & = E\mleft\{ V^2 \mright\} \mleft(
% P(S_\text{L})\frac{1}{r^2_{S_\text{L}}} + \mleft( 1 - P(S_\text{L})
% \mright)\frac{1}{r^2_{S_\text{R}}} \mright)
% .%
% \end{align*}
% We now use our experimental data (having calculated $v_n, n\in [1:N]$ from the
% measured fill times and flow rates) to compute
% \begin{align*}
% \left.
% \begin{array}{r}
% E\mleft\{ V^2 \mright\} \approx \frac{1}{N+1}
% \sum_{n=1}^{N} v_n^2 = \todo{15}\\
% P(S_\text{L}) \approx \frac{\text{\# times $S_\text{L}$ was
% chosen}}{N} = \todo{123} \\
% r^2_{S_\text{L}} \approx \todo{125} \\
% r^2_{S_\text{R}} \approx \todo{250}
% \end{array}
% \right\} \Rightarrow
% \left\{
% \begin{array}{l}
% E\mleft\{ S \mright\} \approx \todo{678} \\
% E\mleft\{ S^2 \mright\} \approx \todo{123}
% \end{array}
% \right.
% .%
% \end{align*}
%
% $\lambda$ is the mean arrival time.
%
% \todo{
% \textbf{TODOs:}
% \begin{itemize}
% \item Complete text describing / obtaining $\rho$ and $\lambda$
% \item Move model derivation to method section
% \item Move calculations with model to results section
% \item Add grade gain derivation
% \item Idea: Make the whole thing 2 pages and print on A3
% \end{itemize}
% }
\end{document} \end{document}

View File

@@ -0,0 +1,88 @@
import pandas as pd
import numpy as np
filename_participants = "res/full_participant_measurement.csv"
filename_left = "res/flowrate_left.csv"
filename_right = "res/flowrate_right.csv"
filename_both = "res/flowrate_both.csv"
arrival_rate = 1 / 36.66 # Measured
def get_response_time_and_utilization(S, arrival_rate):
df = pd.read_csv(filename_participants)
E_S = S.mean()
E_S2 = (S**2).mean()
utilization = arrival_rate * E_S
W = E_S + (arrival_rate * E_S2) / 2*(1 - utilization)
return W, utilization
def print_response_time():
df = pd.read_csv(filename_participants)
S = df["time"]
W, rho = get_response_time_and_utilization(S, arrival_rate)
print(f"//")
print(f"// Response time")
print(f"// ")
print(f" E{{S}} = {S.mean():.3f} s")
print(f"1/lambda = {1/arrival_rate:.3f} s")
print(f" rho = {rho:.3f}")
print(f" W = {W:.3f} s")
def print_best_achievable_response_time():
# Get mean flowrates
df_left = pd.read_csv(filename_left)
df_right = pd.read_csv(filename_right)
df_both = pd.read_csv(filename_both)
flowrate_left = np.mean(np.array(df_left["flowrate"]))
flowrate_right = np.mean(np.array(df_right["flowrate"]))
flowrate_both = np.mean(np.array(df_both["flowrate"]))
# Convert service times to what they would be with the best strategy
df_part = pd.read_csv(filename_participants)
times_left = np.array(df_part[df_part["button"] == "left"]["time"])
times_right = np.array(df_part[df_part["button"] == "right"]["time"])
times_both = np.array(df_part[df_part["button"] == "both"]["time"])
sizes_left = times_left * flowrate_left
sizes_right = times_right * flowrate_right
sizes_both = times_both * flowrate_both
sizes = np.concatenate([sizes_left, sizes_right, sizes_both])
S = sizes / flowrate_right
# Calculate response time
W, rho = get_response_time_and_utilization(S, arrival_rate)
print(f"//")
print(f"// Best possible response time")
print(f"// ")
print(f" E{{S}} = {S.mean():.3f} s")
print(f"1/lambda = {1/arrival_rate:.3f} s")
print(f" rho = {rho:.3f}")
print(f" W = {W:.3f} s")
def main():
print_response_time()
print_best_achievable_response_time()
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,51 @@
import matplotlib.pyplot as plt
from scipy import stats
import numpy as np
import argparse
def main():
"""
[1] H. Schuman, E. Walsh, C. Olson, and B. Etheridge, “Effort and Reward:
The Assumption that College Grades Are Affected by Quantity of Study*,”
Social Forces, vol. 63, no. 4, pp. 945966, June 1985.
"""
# [1, p. 950]
hours_studied = np.array([1, 2.5, 3.5, 4.5, 5.5, 6.5])
gpa = np.array([2.94, 2.91, 2.97, 2.86, 3.25, 3.18])
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument("--plot", action="store_true")
args = parser.parse_args()
# Compute Spearman rank order correlation
corr, p = stats.spearmanr(hours_studied, gpa)
print("======== Spearman rank order correlation ========")
print(f"Correlation: {corr}")
print(f"p-value: {p}")
# Perform linear regression
slope, intercept, r, p, std_err = stats.linregress(hours_studied, gpa)
print("======== Linear regression ========")
print(f"slope: {slope:.8f} points/hour = {slope / (60 * 60):.8f} points/second")
# Printing the p-value here doesn't make much sense, because we don't know
# whether the assumptions for the test are satisfied
if args.plot:
plt.plot(hours_studied, gpa, label="Plot from publication")
plt.plot(hours_studied, slope * hours_studied + intercept, label="Best fit")
plt.xlabel("Hours studied")
plt.ylabel("GPA")
plt.legend()
plt.show()
if __name__ == "__main__":
main()

1
tex-fmt.toml Normal file
View File

@@ -0,0 +1 @@
tabsize = 4