Visualizing Blood Pressure Data

At the risk of getting TMI with you, I’m being treated for high blood pressure. As a result, I track my blood pressure with an app called BP Watch. This allows me to print logs of my blood pressure to give to my doctor. He’s been finding it helpful in seeing whether my combination of medications and exercise is keeping my blood pressure within healthy limits.

Six months ago or so, I started adding my weight to my logs. I only weigh myself once a week. I’ve been up and down, but mostly up in weight. This fact and the existence of my blood pressure data made me curious — did my heavier times correspond to higher blood pressure? While I caution against drawing any significant conclusions from a sample of one, my personal data suggest no.

WHAT I DID

I imported my data into Excel 2013. I eliminated all the columns except: Date, Systolic, Diastolic and Weight. I didn’t really need the date column for my charts, but I left it in to document the date range the data was collected.

Then I added two worksheets – to one I added the Weight and Systolic columns, the other I added the Weight and Diastolic columns. Then in each work sheet I highlighted my two columns and clicked on “recommended charts” under the “insert” tab and accepted the scatter chart.

After that, I adjusted the vertical axis (Blood Pressure) so that it was near the bottom of my measured range instead of zero. I did this to better define the varying pressure at various weights. For Systolic, I started the vertical access at 80 and for Diastolic, used 50.

During my six months I gained roughly 14 pounds. My guess was that my measurements at the high-end of my weight ought to be noticeably higher than at the low-end of my weight. Here’s what I actually found:

Blood Pressure Chart

Systolic blood pressure plotted against weight.

 

Blood Pressure Chart

Diastolic pressure plotted against weight

 

WHAT I THINK I’M SEEING

Using the goals of 12o for Systolic BP and 80 for Diastolic BP, I think I see that while my blood pressure is mostly under control, there is room for improvement.

It appears that for any given weight in the range that I’ve been in for the past six months, I can have a range of blood pressure. Further, there is no obvious trend line pointing towards higher blood pressure at higher weights.

WHY I COULD BE MISTAKEN ABOUT THE LACK OF A RELATIONSHIP BETWEEN WEIGHT AND BLOOD PRESSURE

While this data suggest to me that there is no real relationship between blood pressure and weight, there are a number of reasons why I might be being fooled:

  1. I’m looking at the data the wrong way. Maybe if I was more sophisticated in data analysis, I’d find a trend that’s escaping me.
  2. Maybe I haven’t collected data long enough. Perhaps it takes longer for higher blood pressure to take hold at higher weights.
  3. Maybe I haven’t gained enough weight for the rise in blood pressure to emerge from the noise of variations. This is NOT an idea I plan to consciously test.
  4. Maybe my medications are swamping any effect I might get from weight gain.

If I had gathered data from hundreds of people over a wide range of weights, I’d have more confidence in either accepting or rejecting the lack of relationship that I found from a sample of one.

OTHER POTENTIAL WAYS TO LOOK AT THIS DATA

As I was mostly through this blog post, it occurred to me that it would be very helpful to run a histogram of my blood pressure numbers. While this would not shed any new light on the relationship between weight and blood pressure, it could give information on whether my blood pressure was as much under control as I think it is.

Excel does not do histograms out of the box, but I do know how to do histograms in Python and I might try to run some this weekend.

Getting back to the weight vs BP relationship, it might be helpful to calculate average blood pressures at each measured weight, then plot the average. There’s also a correlations tool in Python that I don’t fully understand but could learn more about.

WANT TO DO YOUR OWN ANALYSIS? 

If you’d like to run my data through your own analysis tools, download bpandweightdata. Or download and analyze your own data if you’re collecting it. Does Fitbit do exports?

Posted in Uncategorized | 1 Comment

Craftsman’s Approach to Tool Selection / Deep Work

I recently finished the book:

Newport, Cal. 2016. Deep work. Find in a Library

There’s a lot I could say about this book and how it has potential to help people develop, but I think my coworker has already done a good job of explaining how that can work.

I’d like to use this blog post to highlight a domain-neutral framework for choosing one’s tools that Cal Newport offers on page 191 of Deep Work. He calls it “The craftsman’s approach to choosing tools”:

Identify the core factors that determine success and happiness in your professional and personal life. Adopt a tool only if its positive effects on those factors substantially outweigh its negative impacts.

While I’m still at work identifying all of those core factors, I realized that two of them were: 1) Staying present to my family and friends when I’m with them and 2) Staying on task when I start something.

I starting thinking about the times where I’ve been at gatherings and I’ve gotten bored and started browsing Facebook in a corner instead of listening to what’s being said. I’ve also thought about many times when I’ve started to use my phone to look up a specific thing, use it as a calculator or message someone – only to notice unread notifications on Facebook or Twitter. I look those up and forget what I was going to do.

There’s been usefulness to having Facebook and Twitter on my phone – especially when I want to post a quick picture or see what a particular person has been up to. But using the Craftsman’s approach above, I realized that this utility was being swamped by the negative effects of social withdrawal and distraction when trying to use my phone as a tool. So off my phone they went. I still have the accounts for now, though I really need to do more of an analysis on Twitter.

I don’t see the Craftsman’s approach as a Luddite one. Any tool whose pluses outweigh their minuses in terms of contributing to your goals ought to be adopted. But I find it a welcome corrective to the idea if we find any usefulness in a new thing at all, we’re committed to using it.

Posted in me, Uncategorized | Leave a comment

Python and Data Science: Update

It’s been a month since I finished my edX class and I wanted to provide a quick(ish) update. Since I completed the course I’ve:

  1. Installed the Anaconda python package on my laptop. It includes a very nice editor called Spyder
  2. Worked at cleaning up my data spreadsheet of library data
  3. Realized that rather than hard coding specific columns to analyze, I ultimately want to be able to have a menu driven program where a user could ask to data items of their choice analyzed

The last item means I have more work to do with loops and working with headers from my spreadsheet. To get this work done, I am tacking back to learning more Python programming, this time from a book:

Matthes, Eric. 2016. Python crash course: a hands-on, project-based introduction to programming. Find in a Library

This book is in two parts. Part 1 is a general overview of Python, clearly explained with lots of hands on examples. Part 2 is devoted to using knowledge gained in part 1 in three different programming projects. Fortunately for me, the second project is all about data visualization, which is my primary interest in learning Python to begin with.

I’ve only been working with this book for a few days and I’ve worked through the first three chapters. Actually chapters two and three because chapter one was a step by step to getting your own programming environment which I already had. Chapters two and three were mostly review for me, but showed me a few new things about print() and working with lists. The hands-on examples gave me good practice. The author is really encouraging about getting you to play with your code — something missing from the edX course, useful as it was.

I’m looking forward to working on chapter four because it will cover using loops with lists. While I’ll be ultimately working with arrays and panda data structures, I expect some of this material to be relevant.

While the other Part 2 projects look fun, I will likely only do the data visualization project at this time.

I’ll try to write more once I get into the data visualization project in this book. I just wanted to let you know that despite a pretty busy life and the fluid political situation in this country, I’m still working on lifelong learning and hope you’ll find some time as well.

 

Posted in lifelong learning | Tagged | Leave a comment

What Do I Know? (External Blog): Data Journalism In The Alternative Fact Era

Data Journalism seems to be a hot topic these days as large data bases are increasingly becoming available.  For me the issue is figuring out how to download them, clean them up, and then play with them to find interesting patterns.   That’s what I’m hoping to get out of the class.

Source: What Do I Know?: Data Journalism In The Alternative Fact Era

 

Quick post from another Alaskan who is in a different course on data science, this one seeming to be specific to journalism. His full post gives some examples of how data was used in his city’s government and a speculation of what data journalism might be able to accomplish.

As far as my own efforts, I need to put a blog post together. The short version is I found a development environment, had a false start due to space names in rows and now I have working (if very simple) code. More later.

Posted in Uncategorized | Leave a comment

Review: Intergalactic Empires ‹ Planetary Defense Command ‹ Reader — WordPress.com

Link: Review: Intergalactic Empires ‹ Planetary Defense Command ‹ Reader — WordPress.com

If your duties cover readers advisory, or you just like science fiction, Planetary Defense Command is a good blog to follow. The post I am linking to above is a set of short reviews of vintage science fiction books involving galactic empires. The post also links to what I think is a good series on using a galactic empire as a story setting.

The blogger at Planetary Defense Command seems pretty knowledgeable about science fiction. Give him a try.

Posted in Book Reviews | Leave a comment

Microsoft: DAT208x Introduction to Python for Data Science – COMPLETED

Today I completed the self paced EdX class Microsoft: DAT208x Introduction to Python for Data Science. My last push included Module 6, the intriguingly titled “Control flow and Pandas” followed by an accidental completion of the final exam. More about that later. I finished the audit track of the course with 91%. I could have purchased a Verified Certificate from EdX for $49.00, but I haven’t seen the EdX certificate used much in the job market. I know what I learned and that’s enough for now.

Enough of housekeeping and celebration. Let’s talk about Module 6, “Control flow and Pandas” Control flow was a presentation on Booleans (which most librarians really ought to know in their sleep) and if-then statements. The syntax for if then is a bit different in Python than in other programming languages that I’ve been exposed to, but still familiar.

 

Pandas turns out to stand for Python Data Analysis. It is a set of tools that allow you to work on arrays that have different data types. It lets you import files – either on your computer or by URL. Once important, you can specific rows and columns by name. It seemed very handy, though I need to read up on it some more and especially practice using it.

After I completed Module 6, I thought I’d take a look at what the final exam looked like. I might be wrong, but when I entered the final exam I seemed to be put into a “this is your one chance to take the final – you have four hours total to complete the problems” page. I didn’t immediate see a graceful way out, so I basically took the final cold.  It was a mix of question types and you had four minutes to answer a given question before you moved on to the next. A couple stumped me outright, but I was able to provide some kind of answer for all but a few and I wound up with an 82% on the final. Not fantastic, but pretty good for taking it cold. Averaged with my quizzes and practice labs I wound up with 91%, so I’m not looking for a retake.

While the course did try to sell you a $29/mo subscription to Datacamp at the end of Every. Single. Exercise, I still recommend this course to others. It’s a great way to get your feet wet both in python and the beginnings of data analysis.

My next step, that I hope to take tomorrow, is to download and install Python, Numpy, Matplotlib and Pandas on my laptop. I’ll also bookmark documentation. Then have a look at a public dataset, probably library related and see what I can do with it.

In the longer term, I should do some reading up on data science. I’ve had a number of reading recommendations from people, so it’s just a matter of picking something up and working through it.

Posted in lifelong learning | Tagged , | Leave a comment

Microsoft: DAT208x Introduction to Python for Data Science: Module 5 Matplotlib

Today I completed Module 5 of the self paced EdX class Microsoft: DAT208x Introduction to Python for Data Science – Matplotlib.

As you might guess from the title of this module, it was all about plotting data. I learned how to do line plots, scatter plots and how to graph three variables at once. The material looked at population trends and the correlation between life expectancy and per capita GDP.

The lessons covered different types of plots, how to customize the axes and some material on histograms, which was presented as a good early step in customizing your data. The commands were basic, but powerful. Again, Excel has similar functionality but I can see where it might be easier to customize a plot in Python. To get a sense of the full range of plots that matplotlib can do, check out their gallery.

One key piece I don’t yet have is how to access external files. I assume I can figure this out from the documentation if it isn’t presented as a lesson, but until I have that piece, it will be hard to do analysis on the public library stats and other data sets I might be interested in. But I’m intrigued to try.

I found this module to be easier than the previous two. Probably because I’m decent in producing charts in Excel and am familiar with the basics of plotting.

I also had another reminder that I need more education in data in addition to programming tools. There was one exercise where we were instructed to plot one variable on a logarithmic scale to make the trend show up better. It did, but I’m not sure why or under what conditions you’d want to use a  logarithmic scale.

The final module has an intriguing title: Control Flow and Pandas. I’m guessing it’s not about pandas munching sticks of data.

 

Posted in lifelong learning | Tagged , | Leave a comment