## My experience teaching Statistics at Stanford

This summer 2020, I had the opportunity to teach the class Introduction to Statistical Methods at Stanford.

Check out this video from the Summer 2020 lectures! Including a guest lecture by Rob Tibshirani.

This was my second experience as instructor (after STATS216V during Summer 2019), and it was thoroughly enjoyable. While my previous teaching experience at Stanford had primarily been as teaching assistant, I felt that designing and instructing the class from A to Z was much more rewarding and empowering. It was certainly more work, too.

The class happened entirely online, as has now become standard with the global pandemic.

To give an idea about the flavor of the class, I have made a video recording available here, including a guest lecture by my advisor Rob Tibshirani. I also asked my students to put together a blog post summarizing the final projects they undertook.

Here are my tips to instructors who might be worried about teaching a class entirely online:

• Be sure to clarify expectations and questions live during lecture. It will save you a lot of time and energy and help you avoid getting overwhelmed with emails from puzzled students.
• Have a reliable, user-friendly platform for all course announcements and materials. I designed and made heavy use of the course website, which was updated with new material almost daily. This let me drastically reduce e-mail usage, which I reserved to private questions such as OAE accommodations.
• Make lectures as interactive as possible. I made intensive use of Zoom polls and breakout rooms to let the students take an active part in the course. And I collected a lot of feedback from students every 3 weeks, and made sure students filled the feedback forms.

Acknowledgments: The course materials were built with help by Russel Poldrack and Kenneth Tay. They have evolved to a fairly solid and stable state. Some of it is still available on the course website.

## Visualizing your friends’ activity on Messenger

Sometimes I don’t like Facebook. For instance, I’ve never understood why they basically force you to display your active times on Messenger (to all your friends). This is typically the kind of sneaky behavior I wish never existed.
To show the entire world how easy it is for any of your friends to track your Messenger activity, I wrote a small Python script that calls Selenium, logs into my personal Messenger account every 10 minutes, and records the last active times of my friends. The data is stored locally in a JSON file. The full code is available on GitHub.

Disclaimer: Let’s be clear: I do not encourage personal use of this tool. I have decided to publish it for educational purposes only. Most of my friends and family are simply not aware of how much of their private information is being shared online without their knowledge. As such, the goal of this utility is certainly not to spy on your friends but to raise awareness about privacy concerns on Facebook.

I ran this script for one full week, then I analyzed the results. And I shared them with some of my friends who were interested in seeing their own logs. For instance, viewing her log helped my sister estimate how much time she spent on Messenger daily, and gave her fairly accurate information about when she went to sleep and woke up! It even make my little sister decide that she’d have to reduce the time she spends online on Messenger, which is a prowess in its own right.

Now let’s have a look at the anonymized log of one of my Facebook friends:

On this example, you can guess that the person goes to sleep around 11pm on weekdays, and she seems to have a habit of being active around 3am. She is generally active for 1-2 hours per day. This last estimate I built from the information I scraped every 10 minutes, so it should be taken with a grain of salt.

In this post I have shown how easy it is to track your friends’s online Messenger activity. Given that many people check Messenger just after waking up and just before going to bed, this should give direct access to their sleeping habits. I have no idea what Facebook is doing with this data, but I can only imagine…
I certainly am not the first person to think about this. In 2016, Danish software developer Søren Louv-Jansen built a similar tool (with a more elaborate graphical interface), and then published an article about it.

What can you do to prevent this? First, and this may seem like an obvious recommendation, but it helps to only have people who you really know as Facebook friends. Secondly, it turns out that there are ways to hide your activity, at least when you are using a computer (e.g. the Chrome extension Unseen ). For an iPhone user, following the steps here might work, but I have not been able to confirm them by myself. That being said, there may be ways to tweak your phone’s internet settings and block the Facebook URLs used to send the activity requests, but I’m not aware of any simple way to do this (and certainly not on an iPhone). The most effective solution may well be… to stop using Messenger altogether.

## A puzzle by Andrei Zelevinsky

While I was reading Tanya Khovanova‘s blog I came across this problem which Andrei Zelevinsky reportedly put in his list of important problems that undegraduate students should think of. The problem reads:

Consider a procedure: Given a polygon in a plane, the next polygon is formed by the centers of its edges. Prove that if we start with a polygon and perform the procedure infinitely many times, the resulting polygon will converge to a point.

I’d like to present one solution in the rest of this post.

One way to solve this problem is to use complex coordinates. Denote by $z_1,...z_n \in \mathbb{C}$ the points. One iteration of the process yields the points $(\frac{z_1+z_2}{2},\frac{z_2+z_3}{2},...,\frac{z_{n-1}+z_n}{2},\frac{z_n+z_1}{2})$. More generally, the $m$-th iteration yields the points $\Big( \sum_{l=1}^n a_{i,l}^{(m)} z_l \Big)_{1\leq i\leq n}$, where
$a_{i,l}^{(m)}= \frac{1}{2^m} {\displaystyle \sum_{\begin{array}{c} 0\leq k\leq m\\ i+k\equiv l[n] \end{array} }}\binom{m}{k}$.

Now we can prove that the $a_{_i,l}^{(m)}$ tend to $\frac{1}{n}$ as $m\to \infty$, independently of $i$ and $l$. To see this let us take the example of $i,l=0$, WLOG. A straightforward calculation using the $m$-th roots of unity gives $a_{0,0}^{(m)}=\frac{1}{2^m}\sum _{0 \leq k \leq n-1}(1+\omega ^k)^m= \frac{1}{K}{\displaystyle \sum_{k=0}^{n-1}}\cos^{m}\frac{k\pi}{n}e^{\frac{ik\pi m}{n}}$;

This means that the procedure converges to a unique point which is the barycenter of the $n$ original points, which concludes the proof.

In the next variation, instead of using the centers of edges to construct the next polygon, use the centers of gravity of $k$ consecutive vertices.