Homework 2.3 [SOLO]: Microtubule catastrophe and ECDFs (30 pts)
In a future lesson, you will learn about emprical cumulative distribution functions, or ECDFs. These are useful ways to visualize how measured data are distributed. An ECDF evaluated at point x is defined as
ECDF(x) = fraction of data points ≤ x.
The ECDF is defined on the entire real number line, with \(\mathrm{ECDF}(x\to-\infty) = 0\) and \(\mathrm{ECDF}(x\to\infty) = 1\). However, the ECDF is often plotted as discrete points, \(\{(x_i, y_i)\}\), where for point \(i\), \(x_i\) is the value of the measured quantity and \(y_i\) is \(\mathrm{ECDF}(x_i)\). For example, if I have a set of measured data with values (1.1, –6.7, 2.3, 9.8, 2.3), the points on the ECDF plot are
x |
y |
---|---|
–6.7 |
0.2 |
1.1 |
0.4 |
2.3 |
0.6 |
2.3 |
0.8 |
9.8 |
1.0 |
In this problem, you will use you newly acquired skills using Numpy and Bokeh to compute ECDFs from a real data set and plot them.
Gardner, Zanic, and coworkers investigated the dynamics of microtubule catastrophe, the switching of a microtubule from a growing to a shrinking state. In particular, they were interested in the time between the start of growth of a microtubule and the catastrophe event. They monitored microtubules by using tubulin (the monomer that comprises a microtubule) that was labeled with a fluorescent marker. As a control to make sure that fluorescent labels and exposure to laser light did not affect the microtubule dynamics, they performed a similar experiment using differential interference contrast (DIC) microscopy. They measured the time until catastrophe with labeled and unlabeled tubulin.
We will look at the data used to generate Fig. 2a of their paper. In the end, you will generate a plot similar to that figure.
a) Write a function with the call signature ecdfvals(data)
, which takes a one-dimensional Numpy array (or Pandas Series
; the same construction of your function will work for both) of data and returns the x
and y
values for plotting the ECDF in the “dots” style, as in Fig. 2a of the Gardner, Zanic, et al. paper. As a reminder,
ECDF(x) = fraction of data points ≤ x.
When you write this function, you may only use base Python and the standard library, in addition to Numpy and Pandas.
b) Use the ecdfvals()
function that you wrote to plot the ECDFs shown in Fig. 2a of the Gardner, Zanic, et al. paper. By looking this plot, do you think that the fluorescent labeling makes a difference in the onset of catastrophe? (We will do a more careful statistical inference later in the course, but for now, does it pass the eye test? Eye tests are an important part of EDA.) You can access the data set here:
https://s3.amazonaws.com/bebi103.caltech.edu/data/gardner_time_to_catastrophe_dic_tidy.csv