Press "Enter" to skip to content

Erik Marsja

R books for Psychologists

R is a free and open-source statistical programming environment. Being open-source and free it has a large and helpful online community (for instance, see StackOverflow).  When I went from carrying out analysis in SPSS to do them in R, I searched for good books targeted to Psychologists.   The following 4 R books are useful and good for Psychologists that want to learn R.
The first book, Discovering Statistics Using R, may be a really good start if you are an undergraduate and have no experience of programming or statistics. The next two books are from intermediate to advanced level. The last book is, at the moment,  free and is also a great introduction to statistics.

Papaja – APA manuscripts made easy

Do you also find it time-consuming to make your manuscripts follow American Psychological Associations (APA) guidelines? Have you searched the internet for a good .docx/.doc APA template? After reading this post, you might not have to search any more. Papaja is an r-package that makes your manuscript conform to APA guidelines! In this post I am briefly going to describe the package and what I think of it.

Some good Python Blogs and Resources

In this post you will find some really good Python Blogs and Resources. Most of these really helped me when moving from proprietary software to free and Open Source software (e.g., PsychoPy written in Python).  The links are divided into two categories: general and research. In the ‘general’ category you will find good Python resources that might be more general and introducing. That is, more helpful for general problems and you might want to start here. In the ‘research’ category there are links to good Python resources that are more specific to use in research (e.g., PsychoPy and data analysis). The links in the ‘research’ category mainly contains links to Python blogs.

Python apps and libraries for creating experiments

In this post, I will describe the existing free Python applications and libraries for creating experiments.  So far, I have only used PsychoPy but I plan to test most of them. At least the ones that seem to still be maintained. All applications and libraries are open-source which makes it possible to download the source code and add your own stuff to it.

Reverse Scoring using R Statistical Environment

This post is my first on R and it will describe a method on how to reverse scores using R.

Reverse scoring in R

Many instruments (i.e., questionnaires) contain items are phrased so that a strong agreement indicates something negative (e.g., “When there is music in the room I find it hard to concentrate on reading”). These items need to be reversed so that the data will be correct later for statistical analysis.

For more information on reverse scoring, please see my earlier post: Reverse scoring in Python.  Since I was more  familiar with Python  compared to R, and I had no a clue on how to do this in SPSS, I wrote a Python script. The Python script used a function that used Pandas DataFrame and it reversed the scores nice and quickly.

Questionnaire data to be reversed

Free & Useful Software – PsychoPy

PsychoPy

This post will describe why I prefer using PsychoPy before other software. When I started getting involved in research (i.e., when doing my Bachelor’s and Masters theses) I used the software that was accessible for me. That is, some of the most commonly used software at the department I was studying at. After starting my Ph.D. studies I got more and more annoyed with one of the software we used to build experimental tasks  in (i.e., E-prime).

First, I was not familiar with the scripting language (called ‘e-basic’) that was needed, for instance use, to solve pseudo-randomization, and for sending signals to a specially built device I was going to use in my experiments. Second, I prefer to use Linux systems and e-prime is limited to Windows. In fact, e-prime seemed to be working best Windows Vista or earlier but our lab computers were, and are, running Windows 7 (might have changed since back then). Some time into my Ph.D. studies I found PsychoPy which is written in Python, a programming language that I did know, and it seemed like a good alternative to e-prime, and other similar software, to create experiments in.

Another Python script for randomization with constraints

Here you will find a Python function for randomization with constrains. This was written, specifically, for a psychological experiment (a shifting/task-switching task) I was planning to conduct. For this experiment, I needed a list of stimuli names that were quasi-randomized.  Fifty percent of the items in the list are followed by a stimulus in the same colour and the remaining 50 % are followed by a stimulus in a different colour.

Python script

Collecting data with Scrapy

This rather long (counting the Python code) tutorial assumes that you are interested in scraping data off the web using Scrapy. It might also be limited to Linux.

Scrapy can be installed using pip:

pip install scrapy

To create a new Scrapy project open up a terminal and create a directory where you will store your Scrapy projects and change do that directory and run this (change ‘psysci’ to whatever your project will be named):


scrapy startproject psysci

 

Item

We start with the Item class and create an object to store our scraped data in. In my example I scrape the article title, type of article, the articles abstract, when the article was received and when it got accepted for publication, which year it was publicized (and month) and the articles keywords.