Programming languages for Psychology

This forum made possible through the generous support of SDN members, donors, and sponsors. Thank you.

cheeze

Full Member
10+ Year Member
Joined
Dec 6, 2009
Messages
90
Reaction score
0
Hi, I'm looking to learn a programming language in my spare time. Any recommendations? I've never learned programming before in my life. So what is a good language to start with that comes handy in research labs/graduate school?

Members don't see this ad.
 
"good to start with" and "comes in handy" are rarely one in the same. What are your interests? This will likely play a major role in what you may need to know.

Stats syntax is about the extent of what 95% of people do (actually, many just point & click and don't even know syntax), but if you don't have a solid stats background I'm not sure how much sense it makes to try and learn syntax. SPSS syntax is super-duper ridiculously easy so might be a good way to start. R is by far the more powerful software and what I would generally recommend, but that will be even tougher to pick up without a stats background. I'm still a novice at it and keep meaning to learn more but finding the time to sit down and actually do so is another matter. SAS is somewhere in the middle, but also a good choice.

If we are talking actual programming (something VERY few psychologists actually do), Visual Basic is a good starter language. I've used it sporadically since I started grad school when I needed to write a simple app for data collection or other random purposes.

If you plan on doing psychophysiology, I would definitely learn Matlab. Actually, either way I think its a great skill to have - it can do everything that stats software can do (albeit not nearly as easily in many cases) and a million other things as well. Certain types of analyses basically require matlab since the syntax has already been developed and trying to write it again would be quite the endeavor on its own, not to mention I suspect some of those analyses would take 5x longer to run in most other software. That doesn't sound like a big deal when you are talking 1 seconds vs. 5 seconds for that correlation matrix to pop up after you hit OK, but when we are talking 5 hours vs. 25 hours that some things require it makes a big difference since power outages, the computer locking, etc. can all cause you to have to start over.

If I had to pick one, I'd say R if you know stats well, Matlab if you don't since you can focus on using it for other purposes. Either way, once you learn the first one branching into other languages will be far, far, far easier.
 
Ollie's recommendations are very good, and I wanted to add that finding good resources to learn a language is as important as choosing the language. For me, just learning how programming worked was the most difficult part; once I learned that in one language (matlab for me), switching to others was just a matter of figuring out the different commands and variety in syntax.

I've been (slowly) learning Python, because I wanted to learn a language that was free to use (major downside of matlab...), and it seemed to be a good mix of easy to use and versatile. There also is a lot of material online for it- MIT posts a lot of their computer programming courses for free on their website, and they use Python for their intro classes. I also looked through this thread- http://lifehacker.com/#!375789/best-first-programming-language-to-learn to pick, although there may be more helpful articles out in the internets.
 
Members don't see this ad :)
Hi, I'm looking to learn a programming language in my spare time. Any recommendations? I've never learned programming before in my life. So what is a good language to start with that comes handy in research labs/graduate school?

I'm not sure what will come in handy in a lab, but once you learn a language it becomes much easier to learn other ones.

I know several languages since my undergraduate degree was computer science. I'm not sure what would be useful in a research lab though. I certainly think that learning an object oriented language is conceptually useful, as it teaches you to operationalize what you are trying to program into discrete variables, a skill that is very useful in research.

Java is fairly self-contained and can be used on several operating systems. Lisp is a recursive language, but is very popular for artificial intelligence (along with Prolog). C++ is pervasive (along with its Microsoft derivative C#).

I would say Java is the most versatile, because you can run the program on any system and the graphical user interface is already a part of the programming package. If you wanted to create a suite of software that carries out some type of proprietary IQ testing, or perhaps some type of proprietary personality testing, then you could easily do so with Java and then set it up to run on any operating system. Some of the languages being discussed are purely scripting languages that run within a parent program with limited functionality, thus they will not allow you that level of product development.
 
Last edited:
Good point RE: cost. Though keep in mind, even though it isn't used much in psychology, pretty much every student in math, engineering, computer science, etc. will be using it nonstop. Accordingly, if you are still affiliated with a university, many will offer it at a discounted price - I got a fully loaded version complete with all the packages (signal processing, etc.) for $75 if memory serves. Not too shabby, given retail price would likely have been upwards of $1000 with all the extra bells and whistles, and well worth the investment.

I also forgot to mention this, but HTML is another option. Its not real programming, but the basics are extremely easy to learn and it might help you get started. Might come in handy to be able to build the website for your lab.
 
Good suggestions all-around... I didn't think many people learned something unless forced. Keep in mind you might spend all this time learning something like Matlab, then come to find in a new lab that either A) you didn't even learn what you needed to thus needing to learn more or B) the lab uses something like Superlab, ePrime etc etc...

Also, depending on your orientation, different fundamental operating system languages will be of a necessity. Before I could recommend to anyone a language I would have to recommend the person learn Unix, be familiar with handling the shell, etc... particularly if you were to work with fMRI, PET etc, you will be hard pressed to find a lab that does not use an in house program running on a Unix-based platform...

IFF you have that knowledge, THEN I would say move on to the fundamentals... do you know what arrays are? Can you setup a database from a shell, etc etc... believe it or not a lot of these things are very important to programmers before dealing with whatever language they want to use.

THEN, move on to the "easier" languages, especially languages that have GUIs to help you design, people on here have suggested good languages to start... Visual basic (technically now Visual Studio something something) is OK but personally is utterly useless unless you also will be using EPrime (since EPrime uses EBasic, a variation of Visual Basic)... if for some strange reason you program with a non-Unix platform, then I would say C++, but Imhard pressed to figure out why you would ever, ever need to use that in psychology. I find also that Java and Python, albeit more fun languages, are far less likely to ever be used in a psych or psych-related lab... utter waste of time in many cases.

My personal preference here is to agree with Matlab, but IF you learn Matlab, you also need to familiarize yourself with coding-based math programs i.e., R, SAS, LISREL,Maple etc etc because all of these will be far more valuable in the mean time.

Word of advice, don't set out to do something that might never be used, learn the basics that will be necessary in any lab, psych or not.

AJ

I'm not sure what will come in handy in a lab, but once you learn a language it becomes much easier to learn other ones.

I know several languages since my undergraduate degree was computer science. I'm not sure what would be useful in a research lab though. I certainly think that learning an object oriented language is conceptually useful, as it teaches you to operationalize what you are trying to program into discrete variables, a skill that is very useful in research.

Java is fairly self-contained and can be used on several operating systems. Lisp is a recursive language, but is very popular for artificial intelligence (along with Prolog). C++ is pervasive (along with its Microsoft derivative C#).

I would say Java is the most versatile, because you can run the program on any system and the graphical user interface is already a part of the programming package. If you wanted to create a suite of software that carries out some type of proprietary IQ testing, or perhaps some type of proprietary personality testing, then you could easily do so with Java and then set it up to run on any operating system. Some of the languages being discussed are purely scripting languages that run within a parent program with limited functionality, thus they will not allow you that level of product development.
 
agree... python is fun, but sloppy... I agree with the person saying java will have the greatest long-term value...

I also 100% agree with learning basics... its utterly amazing how much easier things are once you learn basics... This is why I suggest learning the ins and outs of Unix first...

AJ

Ollie's recommendations are very good, and I wanted to add that finding good resources to learn a language is as important as choosing the language. For me, just learning how programming worked was the most difficult part; once I learned that in one language (matlab for me), switching to others was just a matter of figuring out the different commands and variety in syntax.

I've been (slowly) learning Python, because I wanted to learn a language that was free to use (major downside of matlab...), and it seemed to be a good mix of easy to use and versatile. There also is a lot of material online for it- MIT posts a lot of their computer programming courses for free on their website, and they use Python for their intro classes. I also looked through this thread- http://lifehacker.com/#!375789/best-first-programming-language-to-learn to pick, although there may be more helpful articles out in the internets.
 
LOVE AJ's comment.
I confess, I'm a total nerd. Lucky for me, I've been told I'm a closet nerd, so you dont find out what a nerd I am until it comes to computer/psych stuff.
Python's great. Whatever.
What has helped me a ton is using Linux for the last 5 years. No lie, I think about how to operate differently on a computer. I think about scripting things I want to be done, and that's because the system lends itself to that. Now, 6 classes away from being done with stats courses forever, and its likely that my next goal is to learn SAS syntax much better (only 1 semester exposure to it with regression). I use R some (and it has front end GUI's if you want to use those) but I feel like there are two types of programming we're talking about, combined together.

-Stats programming: using syntax for R, PAWS (SPSS), or SAS
-General programming: traditional languages: python, java, C++, etc.

As for what to learn/focus on, I think it comes down to what you want your career goals to be. If you're in a lab that already uses some language, dont reinvent the wheel; learn that language. If you're doing this for you, to work on datasets to help you in the future, my (totally biased nerd preference) would be learning some stats programming. It might even help you conceptualize stats differently than others in your cohort and could end up making you more efficient at writing results sections!

I know that even when I use SPSS (PASW) I look at the output to help me get a handle on pages of printed out results before I start scouring the pages. But, like I've mentioned several times, I'm a biased nerd. :)
 
Top