• Markov Migraine

    subtitle: This is what I think about during my 20-mile commute (plus traffic)

    I had been thinking of my headaches as modeled by a fairly simple Markov chain. There would be the headache state and the not-headache state. The transition probabilities would be such that they described my experience: Once I get a headache, I tend to have them every day for several days in a row. But when I get out of the headache state, I can have a lot of headache-free days in a row. Now that I’ve been taking the amazing (off label) medication, I can go two weeks without a headache.

    Markov model

    But over the past few days I’ve come to think that the model isn’t perfect. I’d been in the headache state for roughly 10 days, which is the sort of thing that causes me to think about my headaches a lot more. I had seven days with headaches during that 10-day span, but even on the three days without headaches, I really felt like I was still in the headache state (even though I didn’t have a headache). My model didn’t take into account that the probability of having a headache would be yet another variable to include in the model.

    So then I was thinking each state would also have a headache probability. So I would have a two-state model, a stepping rule (roll the dice every day), and a headache parameter for each state.

    An aside here: For years I’ve been questioning the cause and effect of my migraine “triggers.” That is going to inform the next iteration of my model. For a really long time I knew that if I saw an intense source of light—the sun glinting off the chrome trim of a car—that I would get a headache. But then I later came to realize that I could see the same car under the same conditions, but sometimes that reflected sun beam would not be quite so bright or quite so painful. I’ve come to believe that when my brain is in a migrainous state, then the way that I perceive bright reflections is different. Does the bright light help bring on the headache faster? Maybe. But I think that the brightness in my perception is driven by a migraine process that is already at work. Likewise, I think that strong smells bother me more when I’m in a migrainous state; it’s not necessarily the smells bringing on the migraine.

    I’m rethinking my model entirely. Why have two discrete states that each have a probability attached to them? Why not have one state with a headache probability parameter and then define the rules that affect that parameter. (Aside: it’s not like any of these models are going to be useful for anything other than giving me a system or framework to think about my headaches. None of my neurologists care about my construction of a headache time series analysis).

    So now I am back to a more sophisticated version of my very old model that assumed that every migraine trigger had a fixed number of points and that if your score exceeded a certain number, then you would get a headache. The current model has a continuous parameter. I think that the value of the amazing new (off label) medicine is that it makes it harder for the headache parameter to increase. If I’m in a non-headache state, then I’m much less likely to have headaches. I see this in my data with much longer streaks of headache-free days. I don’t have a good sense of what it could do in terms of lowering the parameter. When the parameter is high, I think that I can get caught in feedback loops.

    I guess this will give me a new collection of journal articles to read.


  • My High School Yearbook Helps me Recognize my Failures Due to My Fixed Mindset

    1. What do I write? A rather idiosyncratic blog with a niche audience. Specifications that frequently don’t get implemented quite as I expect them to. Some academic papers that nobody reads. My fixed mindset has led me to believe that my writing will never reach a large audience. My lab partner from ninth grade biology class (assigned seats, alphabetical by last name)? She writes episodes of television shows. I personally identify as a poorly socialized mathematician; I have no chance of being held up as an example of what someone might aspire to be. Her wedding announcement was in the New York Times.

    2. Does fixed mindset also hold me back in sports? I’ve really been trying to go to the gym a few times a week, but I keep making excuses. I don’t really believe that I can achieve my goals. I’ve decided that my best chance to become successful at anything athletic is to rely on my family’s good genes and hope that I can find an activity where I can find some minimal success in the “over 90” division. On the other hand, one of my high school classmates competed in the 2000 Summer Olympics. I think that he came in fourth at the shot put.

    3. When it comes to programming, I can write examples that are used in tutorials. I can put together a proof of concept that will never get used in production. Let’s face it, I’m never going to write a killer app. One of my classmates from my eleventh grade physics class was a co-founder of MyFitnessPal. He and his brother sold their company for approximately infinity dollars.

    Also worthy of mention (not in my grade): The younger brother of one of my classmates works in the film industry. The inventor of the Roomba graduated four years ahead of me. One of the co-founders of AirBnB was in my cousin’s grade. Decades before I was born, Ron Rivest (the “R” in “RSA encryption) graduated from my high school.


  • Minor Successes

    Yet another list post.

    1. Wrote a simple query to get at the information that I wanted, but indirectly, using a proxy for one of the variables that was too hard for me to isolate. I convinced Paul to write the “right” query to get at the real information. Mis-match between the two results gives me something to think about.

    2. Delegated a task that led to a colleague discovering that there is a real problem to be investigated in the software that links the things that I mostly deal with to the things that he mostly deals with. #winning

    3. Ended up not bothering to talk about regular expressions during the part of the R-Ladies meeting where I could have talked about regular expressions. I did not believe that I had anything useful to say about regular expressions in the time available to me.

    4. I am up way too late, and I am convinced that this makes it less likely for me to leave the headache state in my Markov model of migraine. Headache wasn’t bad enough to take any medication, and I’m not having any weird auras, so I could live with it. But I liked things better when I was in the non-headache state and I was convinced that the miraculous medication fixed everything.


  • Monday Mixed Messages

    1. Slept an hour longer than usual this morning!

    2. Woke up with a migraine.

    3. The triptan worked today! (Much better than the one that only took the edge off yesterday’s headache.)

    4. Even with the medicine working, I wouldn’t have been able to put together the level of concentration necessary to debug the trickiest part of my code.

    5. Dealt with almost everything in my inbox. Put out some fires relating to interpersonal issues that some of our students are facing. Taught another student how to look at the history of a wiki page (including viewing which changes were done by which users). Started to implement a new policy/workflow that I’ve been speccing out for the past few weeks. Wrote a really nice question to be used in an email screen of job candidates for yet another one of our open positions. (WE ARE HIRING.)

    6. Was so caught up in all of these issues that I ended up staying an extra half hour at work because I lost track of the time.

    7. The smart cat is going to help me put together a few slides about string manipulations and regular exrpessions so that I can talk about them tomorrow. I will ignore her feline bias against str_c() since even she agrees that having to include sep="" in her favorite function is silly.

    8. The other cat is still not eating very much. Even though yesterday we bought her the supermarket cat food equivalent to Doritos.

    9. Found a parking spot on the wrong side of the street so I will need to move my car before 7am tomorrow.


  • One Down, Three to Go

    So many people I know are having babies these days. I’m in the process of making four baby quilts. Today I trimmed the edges, made some single fold bias binding, and then bound one of the quilts. Now all I need to do to finish it is to trim the loose threads and to fix any other small issues that I find.

    red quilt

    Of the other three, one of them matches with some pre-made binding that I already have, so that should be quick to finish. I need to make binding for the remaining two.

    (In addition to these four baby quilts that are in various stages of “almost done,” I also have two queen sized quilts that are in progress.)


  • Saturday Failures

    1. Chores.

    2. Keeping the cats out of the bedroom.

    3. Writing that Simpson’s Paradox problem that I threatened to write.

    4. Learning the material that I’m supposed to be presenting on Tuesday.

    5. Eating real food instead of junk food.

    6. Not feeling guilty about not working on weekends (old habits die hard).


  • Veronica Mars and Woodshop

    One of my Facebook friends made a post this morning asking for general advice on teaching a statistics course for graduate students in a program that is unlikely to lead them into research-based careers. (I’m fuzzing the details a bit for his privacy.)

    One of the nice things about creating an all-new course from scratch is that you get to use the Veronica Mars/Woodshop principle when creating the course. Have you seen the first season of Veronica Mars? There was an overarching mystery for the whole season, solving the murder of her friend Lily Kane. Each episode also had its own small mystery to solve. And did you take woodshop in middle school? When I took woodshop, we spent the entire quarter working on a project. We learned how to use the band saw so that we could do the first rough cut of the base for our project. Our pieces wouldn’t fit together until we learned how to square a board. We had to learn how to use the jigsaw to make detailed cuts. Likewise, the belt sander and the drill press were all necessary for completing our projects. In both these cases, each part (episode or tool) has its own intrinsic worth, but it is an essential part of the whole. When you’re not building off of an existing curriculum, you have so much more freedom to apply the Veronica Mars/Woodshop principle.

    Part of the discussion on the Facebook post led to the idea of finding examples of graduate theses in this field that used data and statistics nicely and using those (with permission) as key examples in the class. Making the content relevent to the students is also a great curricular design principle.

    So far my ideas haven’t had that much to do with statistics.

    In other design principles, I would rather the students have a deep understanding of a few things than know the names of a lot of statistical tests. I want them to be confident enough in what they do know that they can recognize how it feels different to know something than it does to not know something and to feel comfortable asking questions when they don’t know something. Also how to ask a good question.

    I’d want them to be comfortable with the idea of quantity and uncertainty. I’d have them answer some questions without numbers about “which group did better” or “which is more likely” or “would you call these collections of numbers roughly the same” before they used formulas to answer the more specific versions.

    Anscombe’s quartet. The datasaurus. Simpson’s paradox.

    They really need to understand the concept of slope if they are going to do anything at all with linear regression. Lots of students pass algebra without understanding slope. I’ve met some math teachers who don’t understand slope. If you ask me what the most important concept is in algebra class, I will tell you that it is slope.

    I’m sure my friend can figure out which statistical tests to teach. I have a hunch about what the top three would be, but that would just be a guess. I’ll wait for him to check the actual literature in their field and make a data-driven decision.


subscribe via RSS