Wednesday, 24 December 2014

Current Research - Undergraduate Supervision

This year, I'm fortunate enough to be supervising a number of interesting projects. A few of these can be completed entirely online. I'm sure my students would be grateful if you have a few spare minutes to take part. Finally, if you chose to leave your email address at the end, we can keep you notified of the results!

[CLOSED]
Perceptions towards everyday temporal experiences

Crime Anxiety

Where's the worst place to position a tattoo?

Attitudes towards video games

Exploring attitudes towards older adults

The Social Network



















Thursday, 16 October 2014

A universal skill-set for all psychologists?

A short list of skills for all psychologists aiming to become independent scientists. Compiled quickly following a brief discussion with a colleague.....last edited (16/10/2014)

Input

Original Thinking
Web Development
Critical Thinking


Processing

Sharing data with others
RStudio (R)

Output

Talking
Writing
Dealing with Rejection (getting back on the horse)
Developing detailed strands of work that are simultaneously placed into a wider context

Misc

Cloud Outliner
Mendeley (or any referencing software)


Wednesday, 30 July 2014

Students Still Love Facebook

Earlier this year, my undergraduate research group surveyed a group of students in an attempt to find out how they spend their time online. They were also interested in how online social interaction might interact with personality.

While personality didn't appear to predict how students use the internet, our sample was remarkably consistent when it came to documenting their typical behaviour online.

Like many things in life, culture and groups dictate what becomes popular. Back in 2004, Myspace dominated but as the graph below shows, in 2014, Facebook still rules with Twitter in hot pursuit.


Wednesday, 16 July 2014

Word Clouds with Processing and R

I've previously relied on wordle.net to produce 'word clouds'. These clouds give greater prominence to words that appear more frequently in a source text. However, it is also possible to produce similar, highly customisable word clouds in Processing and R.




Processing relies on the excellent WordCram library. This is straightforward to install and can take any text file or website and produce a word cloud. The source code below demonstrates the variety of presentation options that are available. While the WordCram extension allows for some nice visual tricks, the text file has to be free of any undesirable additional variables or words that may need be excluded before creating a word cloud.

In other words, Processing doesn't allow for any advanced text mining techniques e.g. you might want to remove all numbers or specific words form a file before producing a word cloud. R becomes more useful in this instance. Combining the tm (text mining) and wordcloud packages* makes for a comprehensive set of tools however, I've found importing text files via the tm package particularly annoying. However, once data is in memory the rest of the code is fairly straightforward (see below).


Processing Code

import processing.pdf.*;
import wordcram.*;

PFont georgia = createFont("Georgia", 1);
PFont Courier = createFont("Courier New", 1);
PFont georgiaItalic = createFont("Georgia Italic", 1);
PFont minyaNouvelle = createFont("../MINYN___.TTF", 1);

size(800, 450);
\\size(800, 450, PDF, "int.pdf");

background(255);

/* You can control what font(s) your words are drawn in,
 * what color(s) they're drawn in, and what angle(s)
 * they're drawn at.
 * - Use any Processing colors
 * - Angles are in radians
 * - Use any Processing PFonts, or use a font name
 *
 * WordCram has some convenient methods for some common
 * uses.
 */

new WordCram(this)
  .fromTextFile("int.txt")
  
  //-----------
  // Coloring words
  //.withColor(#9B9478)
  .withColors(#FF0000, #00CC00, #0000FF)
  //.withColor(color(0, 20, 150, 150)) // alpha works, too
  // #785c75, #7D956C, #8A9467, #816F6C, #9D855E, #939464,#9B9478
  // But this won't work the way you expect it to:
  //.withColors(255, 0, 0) // Not red - invisible!
  // See the FAQ for the details, if you're curious:
  // http://goo.gl/dJrwB (WordCram FAQ at GoogleCode)
  
  //-----------
  // Words at Angles
  //.angledAt(radians(30))
  //.angledAt(radians(30), radians(-60))
  
  // Two-thirds of the words will be at 30 degrees, the rest at -60.
  //.angledAt(radians(30), radians(30), radians(-60))
  
  .angledBetween(-PI/8, PI/8)
  //.angledBetween(0, TWO_PI)
  
  // Much bigger: not all words will fit, and it'll take 
  // longer to place them. Be patient!
  .sizedByWeight(20, 50)
  
  
  //---------
  // Fonts
  .withFont("Courier")
  //.withFont("Georgia")
  //.withFont(georgia)
  //.withFont(georgiaItalic)
  //.withFont(minyaNouvelle)
  //.withFonts("Georgia", "Minya Nouvelle")
  //.withFonts(georgia, minyaNouvelle)
  
  //---------
  // Padding
  .withWordPadding(2)
  
  .drawAll();2



R Code

## Word clouds
library(tm)
library(wordcloud)

f2f  <-Corpus(DirSource("textf2f"), readerControl = list(language="lat")) #specifies the exact folder containing text file(s)for analysis with tm.
inspect(f2f)

#remove whitespace
f2f <- tm_map(f2f, stripWhitespace)

# remove punctuation
f2f<- tm_map(f2f, removePunctuation)

# remove numbers
f2f <- tm_map(f2f, removeNumbers)


# remove stopwords
f2f<- tm_map(f2f, removeWords, stopwords('english'))


wordcloud(f2f, scale=c(8,.3),min.freq=2,max.words=100, random.order=T, 

                       rot.per=.15, colors="red", vfont=c("sans serif","plain"))



*See here for how to install packages in R

Sunday, 11 May 2014

Arranging Multiple Plots in R

Arranging several plots in R as part of a grid isn't always straightforward. Imagine you had three plots and wanted one to stretch along the bottom row and place the other two above (i.e. Figure 1).


Figure 1: Sketch of intended placement


Using grid.arrange, it is possible to plot several outputs, but the function will automatically place them into a default grid structure (Figure 2).

grid.arrange(p1, p2, p3, p4, p5, p6, p7, p8, p9)



Figure 2: Using grid.arrange


This may be perfectly adequate if they are to be of equal size. However, this isn't always ideal. For example, when aligning the plots below, the result becomes cluttered (Figure 3).

grid.arrange(p3, p4, p5)


Figure 3: Work in progress


As per my original sketch, I want the top plot (with no legend) to run along the bottom row and the other two plots to be positioned side by side above.

The following example shows how this can be accomplished. First, a new layout is created, here a 2 x 2 grid. This is then assigned to a viewport and pushed onto the plotting device. It is then possible to draw each plot onto its own position on the grid. Specifically, a vector can be assigned to rows of columns that will span a plot over multiple cells. The resulting output is shown in Figure 4.

grid.newpage() # Open a new page on grid device
pushViewport(viewport(layout = grid.layout(3, 2)))
print(p3, vp = viewport(layout.pos.row = 3, layout.pos.col = 1:2))
print(p4, vp = viewport(layout.pos.row = 1:2, layout.pos.col = 1)) 
print(p5, vp = viewport(layout.pos.row = 1:2, layout.pos.col = 2:2))


Figure 4: Replicating my original sketch


Required

library(ggplot2)
library(grid)
library(gridExtra)

Monday, 31 March 2014

Working 9-5, what a way to measure social behaviour outside the lab: Introducing Sociometric Sensors.


At The University of Lincoln, we have recently taken delivery of several Sociometric sensors!!

Until very recently it was impossible to record social signalling in natural settings with a high level of precision over time. While observers have been employed in the past, their observations are inherently subjective, expensive and often inaccurate. However, advances in electronic measurement sensors, reduction in battery sizes and developments in computational data analysis have facilitated the measurement of what was previously deemed invisible. As a result, there is a growing body of evidence suggesting that social signalling plays a significant role in everyday persuasion and decision making, with applications extending to analysis and redesign of organisational networks.

A Sociometric sensor (Figure 1) is a small electronic device worn around the neck. It measures a variety of individual and interpersonal behaviours during a social interaction by way of four sensors: a microphone records speech; an accelerometer measures the degree and direction of nonverbal movement (Figure 2); a Bluetooth transmitter measures the proximity of sensors; and an infer-red transmitter measures when two sensors (and therefore participants) are facing one another. Once activated, the sensors record these attributes on an ongoing basis at a minimum of once per second (depending on the attribute and the sensor settings). These recordings are time synchronised so it is possible to compare behaviour across sensors, facilitating the analysis of social interactions over time (Figures 3 & 4). This can even be extended to include Social Network Analysis (a related Facebook example can be found here).



Figure 1: A Sociometric sensor




Figure 2: Body movement as measured by a Sociometric sensor across a typical Friday





Figure 3: Illustrating differing levels of social interaction between group members - this was calculated using a simple turn-taking analysis algorithm



Figure 4: Speech participation over time between group members (stacked)

Tuesday, 11 February 2014

Favourite Quotes from Honest Academics

Published research often hides the turmoil, excitement, frustration and elation of academic enquiry. The true story behind any research career is only revealed if academics are willing to talk openly about their successes and failures.

Instead, discussion is often limited to the contents of their glowing CV which never lists rejected papers, disastrous experiments or unsuccessful grant applications.

Over the last few years, I've scribbled down various quotes from academics who not only publish great research, but who are also interesting people:



'Enjoy and get used to saying 'I don't know!''


'Never forget how small academia actually is'



'Relationships are the key to success'



'Pick your battles. I didn't and I wish I had'



And my personal favourite, courtesy of James W. Pennebaker........


'The way forward can often appear perfectly logical, but it is rarely practical'


Sunday, 5 January 2014

Should we standardise the PhD recruitment process?

Competition for graduate jobs is tough with around 85 people competing for each position. When it comes to recruitment, graduate schemes typically include a written application, Psychometric tests and several interviews. 

Taken alone, it's easy to be critical. Applications are often read by software, Psychometric tests and Assessment Centres are closed source and interviews are a mixed bag at best. Nevertheless, they can be effective when combined. No method is perfect, so it makes sense to use more than one methodology when attempting to draw solid conclusions about an applicants suitability for a specific role.

But what about PhD recruitment and retention? 

It seems odd that a fresh faced graduate can be awarded funding to complete a PhD or even accepted onto a masters degree with very little pre-screening. A funded PhD is comparable to a graduate job because it pays roughly the same and involves a huge amount of work and dedication.

So how do British Universities decide who is awarded funding?

A short application form is usually sufficient. Structured interviews and Psychometric tests are an exception, not a rule. There is no standardisation across institutions. 

When it comes to a masters degree, is anyone who is willing to pay the required tuition fees ever refused entry provided they have a first degree in x and can pass a language test? 

I’m not suggesting that interviews and Psychometric tests always pick the right people, but it seems amazing that there is no procedure in place when it comes to the allocation of Research Council funding allocated for PhD studentships. This is particularly surprising given the increasing need to convince governments and taxpayers that science is worth funding.

It should come as no surprise that the failure to complete rate exceeds 40% at some institutions. 

In stark comparison, for the few who get through the first round of graduate recruitment in the real world, things are very different. Take British Telecom for example, where applicants complete at least two telephone interviews, numerous Psychometric tests and attend an Assessment centre.

Would a few structured interview questions help filter out those who are unlikely to ever finish a PhD? Psychology specific questions might include: 

1. 'Explain to me in layman’s terms what a t-test is’. A question that any final year psychology undergraduate should be able to answer. If they can't, why are they even considering a career in research?

2. 'If you had a million pounds to spend, what would you do research-wise?’ A creative thinking test. How much thought has a candidate given to resources and time in relation to their topic? 

Hindsight is a wonderful thing and I can't say for sure that I would have given brilliant answers to either of those questions myself. That said, I'm sure a few of us in psychology could put out our heads together and devise a short measure that might help predict progress three years on. This is exactly how the private sector refine and improve their own Psychometric tests. 

At present, we appear to have little understanding and are in no position to reduce the number of students who start, but fail to complete. Delays amongst Doctoral candidates in the Netherlands however, has been studied in some detail (van der Schoot, Yerkes, Mouw & Sonneveld 2013). But delays between students are only part of the problem.




Checks and balances at the end of each academic term are also inconsistent. Finally, universities have different cut-off periods for submission. Some impose a four year limit, i.e. get it submitted within four years or we can't award a PhD while others let the clock run forever.

Do British Universities have a moral obligation to ensure that students accepted onto any postgraduate programme have a good chance of completion, within an acceptable time frame, or does that responsibility lie with the applicant?

It would appear today that the the latter is preferred over the former.  


References

van de Schoot R, Yerkes MA, Mouw JM, Sonneveld H (2013) What Took Them So Long? Explaining PhD Delays among Doctoral Candidates. PLoS ONE 8(7): e68839. doi:10.1371/journal.pone.0068839