Fellgernon Bit L. Collado-Torres's academic corner in the bit world
A couple weeks ago I was given the opportunity to teach a 1 hr 30 min slot of an introduction to
R course. In the past, I’ve taught lectures for similar courses, and I ended up asking myself what would be the best short topic to teach and how to teach it.
Best short topic
There are two ways to answer the first question, one boring and one more interesting. The boring answer is that the course instructor selected the topic. The interesting one goes like this. I have taken short
R courses before and taught others, and it’s always overwhelming for the students. You get to cover many concepts, get familiarized with
R’s syntax, and in the end without lots of practice it’s very challenging to retain much of the information. I think that students love it when they learn how to do something simple that could be the first building block for many of their projects. In parallel, I think that one of the coolest
R topics you can learn in an hour is how to create reproducible documents with
rmarkdown (Allaire, Cheng, Xie, McPherson, et al., 2015).
Learning how to use a single function,
render() in this case, is as simple as it gets. And using the RStudio Desktop is even simpler. Of course, it can easily get complicated. For example, on a new computer you need to install all the LaTeX dependencies if you want to create PDF files. That task can take some time and maybe scare away some new users. But PDF files are really a plus in this case since you can start creating HTML and Word documents. Other complications arise when a user is interested in more control over formatting the file, but like I said earlier, all you need is a simple building block and
rmarkdown is clearly one of them.
This is why the final answer to the first question was teaching how to use
rmarkdown to create reproducible reports (HTML, Word files) using
How to teach it
Teaching a short topic to a beginner’s audience is no easy feat. In the past I’ve made lectures that have the code for every single step and many links to resources where students can learn some details. That is, I’ve created the lectures in such a way that a student can later use them as reference and follow them without an instructor explaining them.
That’s a strategy that I think works on the long run. However, it makes the actual lecture boring and very limited in interactivity. At the JHSPH biostat computing club, other students have chosen to use a lot of images, funny to witty quotes, and asked listeners to voice their opinions. I’ve come to enjoy those presentations and I decided to create my lecture following that trend.
I started off with a series of questions about reproducible research and asked students to voice their opinions and to define a few key concepts. A couple were aware of the difference between reproducibility and replicability, but most were not. I also questioned them and presented them verbally with some famous cases, so they could realize that it’s a fairly complicated matter. Next I presented some answers and definitions from the Implementing Reproducible Research book.
Specifically talking about
R, I showed the students several documents I’ve created in the past and asked whether they thought that they could reproduce the results or not. Basically, I wanted to highlight that when using
R, you really need the session information if you want to reproduce something. Specially if the analysis involves packages under heavy development.
After having motivating the need for reproducible documents, I briefly showed what
rmarkdown is with some images from RStudio shown below.
That gave the students a general idea of how these documents look when you are writing them. But the most important part was showing them examples of how the resulting documents look like. That is, I showed them some complicated projects so they could imagine doing one themselves. The examples included some books, but given the audience I think that the one that motivated them most was Alyssa Frazee’s
polyester reproducible paper (check the source here). I also showed them some of the cool stuff you can create with HTML documents: basically adding interactive elements.
From there, we left the presentation and I demo’ed how to use RStudio to write
rmarkdown documents, the Markdown syntax, where to find help, etc.
By this point, I think the lecture was quite complete and the students were motivated. However, from my past experience, I’ve come to realize that students will easily forget a topic if they don’t practice doing it. That is why even before making the lecture I spent quite a bit of time designing two practice labs. Both labs involved creating a
The first lab included some cool illusion plots which involved a lot of
R code. The code wasn’t the point, but simply learning some of the basics such as what is a code chunk, some of Markdown’s syntax, specifying some code chunk options, adding the session information, and using inline
R code to show the date when the document was made. Ahh, and of course, uploading your HTML document to RPubs (see mine). I know that not everyone is a fan of RPubs, but I imagined that students would get super excited that they made something that they could then show their colleagues and friends. And some did!
Sadly, we didn’t have enough time for the second lab. I did explain to the students what it was about, but they didn’t have time to do it themselves. For this second document, I wanted the students to learn how to create a document reporting some results where all the numbers in the text are written by
R instead of copy-pasting them.
As you can see, I enjoyed thinking what to teach and specially how to teach a short topic to beginner
R students. Thanks to having one of the later sessions, I could teach them how to use
rmarkdown in a way that hopefully left them highly motivated to do it themselves. I hope that most of them will take that they learned in that module and others and apply them in their day to day work.
Citations made with
knitcitations (Boettiger, 2015).
My advisor recently asked me to fill a career planning document (he’ll blog about it at some point) that has lots of questions and is being very useful. Trying to fill answer all these questions has gotten me thinking about other important things for the future. Two of them being reasonable expectations for work hours and salary in a biostats/genomics academic career.
I find these questions hard to answer and even hard to talk about, and if you know me, I’m a person that asks lots of questions. I have also been advised against talking about these subjects during a first interview because it’s important to focus on the research environment. I agree that you should find a place to work that you like with problems that will keep you motivated, and with colleagues that make your daily life enjoyable (Hall, 2015).
However, I still want to have a reasonable idea about what to expect. Given that it’s hard to ask these questions, it’s also hard to blog about it. These questions are not really what others encourage you to talk about (Gould, 2015; Gould, 2014) but I think that I’m not the only one with these questions in mind and that others might benefit from this post. Well, I hope they will.
I didn’t ask myself these questions before doing a PhD. It felt natural that doing a PhD would open the door for more opportunities in academia than going to work after undergrad or a masters. Even for a career outside science which a bit more than half (53%) of UK science PhD students choose to follow (Gould, 2014), getting a PhD likely gives a strong boost to your career options. But when you start considering a postdoc, there is an opportunity cost (, 2015) associated to it because you could be earning more at a non-academic job. But how much are we talking about?
Picture from “The postdoc decision” (Gould, 2014).
Regardless of the opportunity cost of doing a postdoc, for a career in academia you will likely want to do a postdoc to get a chance at a tenure-track job, specially in fields like biology. For a career outside academia but still research related, I think that doing a postdoc could increase your chances at getting a better job. In any case, you have to consider all career options when doing a postdoc (, 2014).
Salary: what to expect
For a postdoc, the NIH sets training stipends which sets a baseline (, 2015). For example, 42k per year in 2014.
For later, ASA: Career Resources for Statisticians has information for biostatistics departments. For example, the median year 0 assistant professor in a biostatistics department made 102k (megan, 2014). From this survey data you can get an idea of the salary progression through your academic career.
Similarly, I find the Life Sciences Salary Survey (2013, 2014) informative. In the 2014 detailed pdf you can see that a male postdoc average pay was $46,372, $79,616 for an assistant professor, $107,868 for associate professors, and $158,059 for professors. That last figure is smaller than $169,900 which is the median salary for year 0 professors in biostatistics (megan, 2014). The 2014 Life Sciences survey also has average salaries by age. So you can make three different progressions of your career salary.
Why should you care?
There are probably many reasons why you should care about your salary given two or more equally good work opportunities. In my case, I wanted to get a rough idea if an academic career would be able to pay for my desired lifestyle and life goals. Let me explain this in more detail.
From looking at the retirement for doctoral scientists report (Foundation, 2015) retiring between 66 and 70 years old seems like a common scenario. Then from the life expectancy calculator (OACT, 2015), it seems that for someone like me the average life expectancy is 87 years and retiring from work at 67 years. That is, about 37 years of work and 20 years of retirement. Then, the average cost of a house is about 320k (McBride, 2014). If you get a house loan for 270k at 4% interest rate for 30 years and 1.25% property tax you would pay 190k in interest and 120k in tax (Unknown, 2015). Federal income tax is about 28% (, 2015) (I know it’s more complicated) with about 5% for state tax (, 2015). So about 33% of your income goes to paying taxes. The cost for having a car is about 10k a year (Larry Copeland, 2013) although you could probably save some money by getting a smaller car.
I think that I want to have children in the future, and if I do, I would like to afford their education. It seems that the cost of raising a child to age 18 is about 575k if you spend about 120k in private college (, 2015). Those numbers include the cost of adapting your house (but not interests in mortgage).
I also want to be able to travel quite a bit, and given that these are all US numbers, I would also like to go to Mexico frequently. Anyhow, setting about 5k a year for traveling is an ambitious goal. Alternatively, the 5k could help mitigate any unforeseen emergency, like a surgery.
I can use the numbers from all three academic career salary progressions to get an idea of how my life goals fit in and the impact they would have on my lifestyle. For the average salary for life sciences by age I’m using the numbers from 30 to 67 years old. For average salary for life sciences by career stage I’ll use 2 years for postdoc, 7 years for assistant professor, 8 for associate professor and the remaining 20 as a professor. For the progression for biostatistics departments in research universities I simply adapted the above numbers to the greater data resolution available.
Looking at my mint.com budget I see that I spend about 1370 a month on everything except rent. I like my current lifestyle and would like to keep it throughout my life, obviously adapting it to my needs.
Now, in the previous table only the life sciences tenure and biostats progressions can handle my life goals without sacrificing my life style if I had one child. Two children only seems feasible in the biostats salary progression. These numbers give a general idea, but it’s way more information than I had before.
Note that I’m assuming that your savings can keep up with inflation. Plus, I don’t have student loans thanks to receiving my education at UNAM-Mexico, but I know that this isn’t true for many US citizens. You could probably do a bit better than I projected if you invested and got a higher return than inflation, got promoted faster, moved to a country with a lower cost of living after saving some money, or had to borrow less money for buying the house. This last point could certainly be feasible if you managed to earn more money early in your career.
Work hours: what to expect
Answering this question has been much harder than the salary question. First, lets look outside of science. A recent news article (, 2015) says: “About 22 percent of Japanese work more than 49 hours a week, compared with 16 percent of Americans, 11 percent of the French and Germans, according to data compiled by the Japanese government.”
A different survey shows that 39 percent of full time employed US workers work beyond 49 hours per week with the average being 47 hours (@jenamcgregor, 2014). Broadly summarized government data shows lower averages (, 2015). Anyhow, I think that it’s likely that work hours for researchers are in the upper half. I’m also under the impression that most scientists work beyond the official working time (check wiki).
I also agree with the idea that work hours fluctuate, for example with weeks when grants are due reaching high peaks. Also, probably a lot of people haven’t tracked their hours (@DynamicEcology, 2014). In my case, using RescueTime I know that I have spent about 45-50 hours per week on my work computer recently (I only have the free version, so I can’t go back too far in time). Though I do get distracted at times and my “productivity pulse” is around 60 to 70.
I certainly don’t think that scientists should be expected to routinely work 60+ hours a week. There’s even a 1943 (wartime) paper arguing that “For men a working week in excess of 60 hours usually leads to no increase in production, and for women the hours should never exceed 54” (see the pdf). But teaching loads can certainly push to higher work loads as this particular story shows (, 2013).
At this point I’m thinking that 45-50 hours per week should be reasonable with a good work-life balance.
But then, “postdocs should expect to work longer-than-average hours” and “We put in the hours we do because it is highly competitive out there” (Gould, 2011).
On the positive side, it seems that research could be a 9-5 job and achieving it “requires good planning, effective teamwork and a supportive environment” (Gould, 2014). This ties in with some of my thoughts: I feel like it’s all about being efficient as you can be and indeed having a great work team. So yes, when looking for a job it is very important to find a job with the right research and support environment.
Why should you care?
I think that it’s important to know this information so you can have realistic expectations of your stress level and work-life balance. If you underestimate the work load, you’ll probably be uncomfortable to say the least.
I also think that it’s dangerous to ignore this question even when you are highly motivated by your work and easily lose track of time spent working. That is, I assume that many scientists are motivated by their work but I argue that they should still think about their life outside work.
Alternative way to count
Picture from the Sleep Foundation (, 2015).
Another way to take a look at this question is to see how would you like to spend your time outside work. Seems like a good recommendation is to sleep 8 hours per day. Spending about 4 hours per day with your family seems like a good goal (, 2015) although many people can’t (, 2015) despite “spending quality family time together is very important” (, 2015). If you exercise about 1 hour a day, take about 1 hour to get ready in the morning, spend 1 hour commuting, and 1 hour cooking/having dinner that leaves you with 8 hours per day for work. With school taking about 6 hours, this seems doable if your work allows you to work from home for 2 hours or so. Such a schedule would look something like this:
- Wake up at 6:30, exercise 1 hour
- Get ready: 1 hour
- Commute: 30 min. You get to work at 9 am.
- Work 6 hours until 3pm.
- Commute: 30 min
- Family time 2 hrs
- Dinner 1 hour
- Family time 2 hrs
- Work 2 more hours: 8:30 to 10:30pm
- Sleep 8 hours
Now that I think about it, it seems like my advisor is doing something along these lines. Well, he is likely sleeping much less.
Following this type of workday, you would have to work 5-10 hours on the weekend to get to 45-50 work hours per week. Seems doable and reasonable to me. Working beyond 50 hours a week would most likely mean that you’d have to sacrifice family and exercise time. That doesn’t seem healthy but I understand that it might be needed at times.
This is when ideas that at first might seem unreasonable start to make some sense. For example, James W. Vaupel suggested working 25 hours a week and retiring later in life so young people get more time with their kids (, 2015).
Learning what to expect in terms of salary and work hours for a biostats/genomics career in academia is challenging and time consuming. At best you depend on surveys which may be biased, information from commercial sites and blog posts. However, with salary progression tables you can get a broad idea of how realistic your life goals and lifestyle expectations are. Although it would be great to have more data and data from other countries. For example, I don’t have and haven’t looked for the salary progression data in Mexico: maybe salaries are lower but due to lower costs of living you might be better off there than in the US assuming that the research environment is as good or better. That is a question for another time.
I have found some answers which I hope will be useful later on. From the salary perspective, I find it motivating that this career could fund my goals and lifestyle, specially in a Biostatistics department from a research university. From the work hours perspective, at least I have some information to support my previously vague idea that 45-50 hours a week is reasonable. Whether that’s enough is yet to be seen. Specially with how competitive it can be to get an academic position and complete the progression to becoming a professor.
But even if tools like the PI predictor (, 2015) say that I have a 10% chance of becoming a PI (data up to nov 2014), I have encountered that all my life: 10% of LCG applicants who passed UNAM’s exam got into my undergrad, 10% of applicants got into my PhD program. So it’s old news and I just have to keep working to beat the odds.
Code for making the table:
Feel free to play around with
life_style() with numbers you think are appropriate for you.
Citations made with
knitcitations (Boettiger, 2015).
 Table B-2. Average weekly hours and overtime of all employees on private nonfarm payrolls by industry sector, seasonally adjusted . http://www.bls.gov/news.release/empsit.t18.htm. 2015. URL: http://www.bls.gov/news.release/empsit.t18.htm.
 Cost of Raising a Child Calculator. http://www.babycenter.com/cost-of-raising-child-calculator. 2015. URL: http://www.babycenter.com/cost-of-raising-child-calculator.
 Essay on the hours faculty members work each day @insidehighered. https://www.insidehighered.com:80/advice/2013/04/22/essay-hours-faculty-members-work-each-day. 2013. URL: https://www.insidehighered.com:80/advice/2013/04/22/essay-hours-faculty-members-work-each-day.
 How Much Sleep Do We Really Need? http://sleepfoundation.org/how-sleep-works/how-much-sleep-do-we-really-need. 2015. URL: http://sleepfoundation.org/how-sleep-works/how-much-sleep-do-we-really-need.
 News from The Associated Press. http://hosted.ap.org/dynamic/stories/A/AS_WORKAHOLIC_JAPAN. 2015. URL: http://hosted.ap.org/dynamic/stories/A/AS_WORKAHOLIC_JAPAN.
 NIH Postdoc Training Stipends. http://www.nationalpostdoc.org/policy/briefing-room/191-nih-stipend-freeze. 2015. URL: http://www.nationalpostdoc.org/policy/briefing-room/191-nih-stipend-freeze.
 Spending quality family time together is very important. http://msue.anr.msu.edu/news/spending_quality_family_time_together_is_very_important. 2015. URL: http://msue.anr.msu.edu/news/spending_quality_family_time_together_is_very_important.
 State taxes: Massachusetts | Bankrate.com . http://www.bankrate.com/finance/taxes/state-taxes-massachusetts.aspx. 2015. URL: http://www.bankrate.com/finance/taxes/state-taxes-massachusetts.aspx.
 There is life after academia. http://www.nature.com/news/there-is-life-after-academia-1.15808. 2014. URL: http://www.nature.com/news/there-is-life-after-academia-1.15808.
 We should only work 25 hours a week, argues professor. http://sciencenordic.com/we-should-only-work-25-hours-week-argues-professor. 2015. URL: http://sciencenordic.com/we-should-only-work-25-hours-week-argues-professor.
 Whether you're a working mom, stay at home mom, or if your child is a baby or in school - how much time do you typically spend with your child in a day? http://www.circleofmoms.com/question/how-much-time-do-you-spend-your-child-day-1701015. 2015. URL: http://www.circleofmoms.com/question/how-much-time-do-you-spend-your-child-day-1701015.
 @DynamicEcology. You do not need to work 80 hours a week to succeed in academia. https://dynamicecology.wordpress.com/2014/02/04/you-do-not-need-to-work-80-hours-a-week-to-succeed-in-academia/. 2014. URL: https://dynamicecology.wordpress.com/2014/02/04/you-do-not-need-to-work-80-hours-a-week-to-succeed-in-academia/.
 @jenamcgregor. The average work week is now 47 hours. http://www.washingtonpost.com/blogs/on-leadership/wp/2014/09/02/the-average-work-week-is-now-47-hours/. 2014. URL: http://www.washingtonpost.com/blogs/on-leadership/wp/2014/09/02/the-average-work-week-is-now-47-hours/.
 N. S. Foundation. nsf.gov - NCSES The End of Mandatory Retirement for Doctoral Scientists and Engineers in Postsecondary Institutions: Retirement Patterns 10 Years Later - US National Science Foundation (NSF). http://www.nsf.gov/statistics/infbrief/nsf11302/. 2015. URL: http://www.nsf.gov/statistics/infbrief/nsf11302/.
 J. Gould. Are long working hours inevitable for postdocs? : Naturejobs Blog. http://blogs.nature.com/naturejobs/2011/04/01/are-long-working-hours-inevitable-for-postdocs. 2011. URL: http://blogs.nature.com/naturejobs/2011/04/01/are-long-working-hours-inevitable-for-postdocs.
 J. Gould. Ask the expert: Can research ever be a 9-5 job? : Naturejobs Blog. http://blogs.nature.com/naturejobs/2014/12/18/ask-the-expert-can-research-ever-be-a-9-5-job. 2014. URL: http://blogs.nature.com/naturejobs/2014/12/18/ask-the-expert-can-research-ever-be-a-9-5-job.
 J. Gould. Science blogging : Naturejobs Blog. http://blogs.nature.com/naturejobs/2014/09/18/science-blogging. 2014. URL: http://blogs.nature.com/naturejobs/2014/09/18/science-blogging.
 J. Gould. Scientific blogging: Why it might just be good for your CV. http://blogs.nature.com/naturejobs/2015/01/30/scientific-blogging-why-it-might-just-be-good-for-your-cv. 2015. URL: http://blogs.nature.com/naturejobs/2015/01/30/scientific-blogging-why-it-might-just-be-good-for-your-cv.
 J. Gould. The postdoc decision : Naturejobs Blog. http://blogs.nature.com/naturejobs/2014/10/03/the-postdoc-decision. 2014. URL: http://blogs.nature.com/naturejobs/2014/10/03/the-postdoc-decision.
 A. Hall. The Key To Happiness At Work That Has Nothing To Do With Your Actual Job. http://www.huffingtonpost.com/2015/02/04/happiness-at-work_n_6613358.html. 2015. URL: http://www.huffingtonpost.com/2015/02/04/happiness-at-work_n_6613358.html?ncid=fcbklnkushpmg00000063.
 U. T. Larry Copeland. The cost of owning your car? \$\\textasciitilde9,000 a year. http://www.usatoday.com/story/news/nation/2013/04/16/aaa-car-ownership-costs/2070397/. 2013. URL: http://www.usatoday.com/story/news/nation/2013/04/16/aaa-car-ownership-costs/2070397/.
 B. McBride. Calculated Risk: New Home Prices: New Record for Average and Median in 2013. http://www.calculatedriskblog.com/2014/01/new-home-prices-new-record-for-average.html. 2014. URL: http://www.calculatedriskblog.com/2014/01/new-home-prices-new-record-for-average.html.
 megan. Academic Salary Survey | Amstat News. http://magazine.amstat.org/blog/2014/01/01/academic-salary-survey-2/. 2014. URL: http://magazine.amstat.org/blog/2014/01/01/academic-salary-survey-2/.
 OACT. Retirement \& Survivors Benefits: Life Expectancy Calculator. http://www.socialsecurity.gov/cgi-bin/longevity.cgi. 2015. URL: http://www.socialsecurity.gov/cgi-bin/longevity.cgi.