Sunday, August 24, 2014

Emailing Professors for Research Opportunities: Dos and Dont's

I received an email from a high school senior today, enquiring if I was looking for a research assistant. It was very well worded and polite, but clearly a form letter. Since it's the summer, and I have a bit of time on my hands, I thought I would reply to him with a few tips on how to better write these emails (I have accumulated quite a bit of experience over the years :p).

I won't post his original email, but here's what I said:

1. Don't send emails using bcc. Professors receive many such emails a day and have to choose which to respond to. The less yours feels like a mass email, the more likely you'll receive a response. 

2. Address the recipient appropriately (most grad students would be ok with a first name, but mr [last name] might be safer; Dr. [last name] for post-docs and Professor [last name] for faculty.

3. State clearly in the first paragraph your current education level. Vacancies are different for high school freshmen, seniors, undergrads and college grads. The recipient shouldn't have to figure it out themselves from your resume.

4. You need to be a little more specific about your research interests. It's good to have broad interests, especially when you are in high school, but you need to elaborate. Listing fields (i.e. "psychology, sociology, neuroscience, and medicine") actually tells the recipient very little about what you are interested in, and as such, difficult for him/her to figure out whether you would be a good fit for the lab. 

5. 
Specifically, I am interested in the subject of your research and would love to further investigate my passion for it. 

This sounds a little insincere if you had not demonstrated some knowledge that you know what the recipient's research is about. Show that you've done some homework and did not send the same email to a 100 .edu addresses. So comment intelligently on the recipient's research focus, and how his/her work fits with your own research interest.

I hope he doesn't take it the wrong way! Just thought these tips would give him a better chance in his search!

Thursday, July 10, 2014

Within-Subject Error Bars

Psychologists and neuroscientists often plot error bars to show the variability in their obtained results. Very often, the error bar shows the standard error of the mean, or SEM. A quick rule of thumb when looking at graphs is to check whether the error bars between conditions overlap - if they do, you can conclude that the the means are NOT significantly different at p < 0.05. Note that the converse is not true, that is, non-overlapping error bars ≠ significant difference. The means have to be approximately 3SEM apart (assuming the two means have similar SEMs).

This rule, however, only applies to between-subject designs. What about within-subject (i.e. repeated measures) designs? Error bars would be too large as they take into account both between-subject and within-subject variance (variability in the paired difference between the different conditions in the same subject). In my opinion, plotting between-subject SEM for within-subject tests (e.g. paired t-tests) is meaningless, because conflating between-subject and within-subject variance makes the error bars uninterpretable.

A solution was first proposed by Loftus and Masson (1994). Briefly, it involves running a repeated measures anova, and taking the mean squared error (MSE) from the appropriate (repeated-measures) ANOVA analysis (i.e. the denominator from the appropriate F-test). SEMwithin can then be calculated by taking the square root of MS divided by N. This procedure works because a repeated-measures ANOVA removes between-subject variance first, so the MSE captures only within-subject variability.

If all you want to know is how to plot within-subject error bars, you can stop reading here. If you would like a more nuanced discussion, read on.

**************************

The Loftus and Masson method, however, yields a single SEM value for all conditions. The implicit assumption is that the variance between the pairwise difference between conditions is constant (i.e. sphericity assumption). Of course, this assumption can be tested and corrected (e.g., Greenhouse-Geisser or Huynd-Feldt). But wouldn't it be nice if we could just tell from the error bars (i.e. the same way we can tell if the homogeneity of variance is violated from the error bars of a between-subject design)? This prompted Cousineau (2005) to propose a different solution, which involves "normalizing" data from all subjects such that the between-subject variance is removed. This is done by subtracting, for each condition and subject (i.e. each "cell"), the subject average across conditions, and then adding the grand average of all cells. Hence all subjects will have the same average, but the within-subject effects are preserved. The SEM can then be calculated as per normal, and each condition will have it's own error bar. Cousineau, unfortunately, did not take into account the fact that normalization (in particular, adding the grand average of all cells) induces positive correlations between the cells, so the error bars are a little too small compared to those calculated by the Loftus and Masson method. This discrepancy was identified by Morey (2005) who proposed a simple solution of multiplying the Cousineau variance (note: NOT SEM) by M/(M-1), where M = number of conditions, before calculating error bars**.

Ahh... but the story is not over yet. I just found out that Franz and Loftus (2012) published a recent study challenging the normalization method. They argue that the normalization method does not actually allow for the checking of the sphericity assumption and even though the method produces different error bars for each condition, any difference in the error bars will not not interpretable. Specifically, sphericity requires inspecting all pairwise differences between conditions, and the only way to do it visually, is to plot all the pairwise differences, and see if the variance of those pairwise differences are similar. Franz and Loftus argue that these pairwise differences should be plotted next to the plot of means for visual inspection.

My thoughts? I have to say, I still recommend Loftus and Masson + appropriate test for sphericity. It isn't THAT difficult to compute - an actual charge by detractors of the method. I mean, it's not computationally intractable or anything - just run the ANOVA >.<. That said, I wouldn't write off a paper which uses Morey (2005). For the purpose of "eye-balling" significance... those error bars do the trick as well. And the condition-specific variance reflected in those error bars is still information (though I need to think a little harder about what it might be good for). At the end of the day, I see error bars as visual aids*. Authors ought to be clear and honest about how the error bars were obtained. Readers, however, should always defer to the results of the appropriate statistical test to evaluate findings.

*On that note, I don't really think plotting the variability of the pairwise differences is all that useful. If there are say, 6 conditions... you'll need to plot 15 pairwise differences... and that's not really all that helpful for visualization, which defeats the purpose of graphing in the first place.

** Previous version of this posts states that the correction is M/(M-1). Thanks to Eric Garr for pointing out the mistake :)

Thursday, May 29, 2014

Setting up my new laptop

I recently bought a new laptop, nothing fancy - just another MB Pro. My general resistance to change (and yes, I know it's a character flaw) compelled me to buy something that would require minimal time to get used to. At the same time, I do like to start afresh, so I rarely transfer settings/preferences from my old computer to the new one, which means that for the preferences that I do like to keep, I'll have to reconfigure them again.

Unfortunately, I have forgotten how I made those changes in the first place (especially the small ones), and had to figure them out one-by-one. So I thought I would start a post with the steps I took to set up this laptop, and I'll have something to refer to for the next

Let's start with Google Chrome

1. I was rather annoyed when they took google scholar away from the google page (this was about what, 3 years ago now?), because it meant a few extra clicks needed to search for a paper. I know it's not THAT much time, but hey, minimize all transaction cost right ;). Fortunately, Chrome allows you to search from different search engines from the "omnibar" (seriously, the address bar is a much more intuitive name). This is how you do it:

Chrome > Settings > Search > Manage Search Engines
Add:
First Column - Google Scholar (or name of any other search engine)
Second Column - Easy to type shorcut (I use "s")
Third Column - http://scholar.google.com/scholar?hl=en&q=%s

The next time you want to do a google scholar search, all you need to do is to type the shortcut in the address bar, and there you go, google scholar in your address bar!

2. Default font in blogger
Blogging in Times feels so formal, which discourages me from blogging. I've changed the default font on blogger to Arial, just so I don't have to change it everytime. This is a chrome setting, and not a blogger setting. To change it, go to

Chrome > Settings > show advanced settings > Web Content > Customize Font > Standard font

Changing the standard font here will change the default font in blogger.

3. Syncing Zotero with Dropbox
Zotero is a citation management application. It's the one I use, no special reason, since I think the major ones are all pretty similar. That said, I do have a soft spot for zotero because it's open source and not owned by a certain publishing giant.

I am hoping to make any computer a working computer, so I'm slowly migrating everything to cloud servers. It would be nice if I had all my papers in one place accessible from anywhere/even offline. To do this with zotero, simply create a zotero folder in dropbox, and change the appropriate settings in zotero for all computers.

Zotero > Preferences > Advances > Data Directory > Custom > (path to dropbox zotero folder)

Wednesday, May 14, 2014

Model-based fMRI

Standard fMRI analysis uses GLMs, so most fMRI analyses are technically "model-based". But that's not what I am going to write about today. Instead, I will be talking about model-based fMRI where one combines computational models of cognition with fMRI to find neural correlates of different cognitive processes. I only hope to give an introduction to the topic. For a more detailed treatment, one can turn to the following two resources:

Daw, Nathaniel D. "Trial-by-trial data analysis using computational models."Decision making, affect, and learning: Attention and performance XXIII 23 (2011): 3-38

and 

O'Doherty, John P., Alan Hampton, and Hackjin Kim. "Model‐Based fMRI and Its Application to Reward Learning and Decision Making." Annals of the New York Academy of Sciences 1104.1 (2007): 35-53.

What is model-based fMRI?
For many years, psychologists have built computational models to study human cognition. These models describe cognitive processes in terms of algorithms (variables and operations). They are then fit to behavioral data collected from real human participants to assess if the cognitive processes posited by the model are indeed descriptive of participants' mental operations. 

Model-based fMRI is an extension of the computational modeling of cognition. Instead of fitting to behavioral data, the computational models are fitted to fMRI data time-series. Finding neural activity that encodes the cognitive variables assumed by the model would provide additional validity of the models, and provide insight into how the cognitive operations assumed in the model might be implemented in the brain.

Why do model-based fMRI?
As I see it, there are two main advantages:
1. Computational models will allow you to track the trial-by-trial dynamics of cognitive/neural processes, so you can see them unfold over time. Both event-related trial-averaging and block designs lose this level of granularity.

2. Model-based fMRI allows you to study how a cognitive process is implemented in the brain, and not just where it is occurring. While localization of function is important, I do think that most neuroscientists would agree that we would prefer if we could understand brain function at the mechanistic level.

A recipe for  standard model-based fMRI
This is taken from O'Doherty et al. (2007), which I recommend to anyone who is interested in using model-based fMRI for their studies.
  1. Fit computational model to participants' behavioral data to obtain optimal model parameters that maximize the "fit" between model and data.
  2. Using the best-fitting model and model parameters, generate a time-series for the cognitive variable of interest (e.g. value of chosen stimulus, prediction errors, confidence etc etc.). This time series can be thought of as the experimenter's best estimate of what the participant is "thinking" at each time point.
  3. Convolve time-series with the hemodynamic response function. The resulting time-series can be thought of what the BOLD activity of a brain area encoding the cognitive variable of interest would look like, given the experimenter's best estimate of the variable.
  4. Regress time-series with fMRI data to find voxels that correlate with cognitive variables of interest
I'd be happy to talk about the method. Leave a comment or drop me an email.