Posts tagged ‘R’

October 23, 2012

MERpsychophysics (beta release)

The package MERpsychophysics contains a collection of R functions for the analysis of psychophysical data in R.You can download the package by clicking here or on MERpsychophysics R code in the Blogroll. Together with the r-files, you should also receive a copy of the GNU Public License (LICENSE.txt) and the reference manual (MERpsychophysics_Reference_Manual.pdf). In order to load the package on your current R workspace, you should:

  1. Unzip the MERpsychophysics.0 folder, if necessary.
  2. Put the MERpsychophysics.0 folder  in your favorite path (e.g. “/Users/alessandro”)
  3. Open the R session, and type: setwd(“my path/MERpsychophysics.0”) – for example, setwd(“/Users/alessandro/MERpsychophysics.0”)
  4. Type: source(“MERpsychophysics.r”)
  5. Use again the setwd function in order to change the working directory. For example: setwd(“my path/my data folder”). If you don’t change the working directory, all exported file will be saved in MERpsychophysics.0 folder.
  6. Have fun with it! If is the first time you use the package, you might want to open the file MERdemo.r and see some examples.

It is necessary to repeat steps 3-4 at each new working session – or simply write the the two command lines at the beginning of your R script.  The first time you use the MERpsychophysics, remember to install all the R packages indicated in the Reference Manual.

The code provides the following tools for   the analysis of psychophysical data with the Generalized Linear Mixed Model (GLMM):

  • Estimate of PSE and JND and their confidence interval with Bootstrap Method
  • Estimate of PSE and JND and their variance with Delta Method
  • GLMM plotting

The CRAN package lme4.0 is used for GLMM fitting. This package is widely used in the statistical community for the analysis of clustered data. Please, refer to the CRAN and to the lme4 web-page for further details on this package (you will find all the links here).  The MERpsychophysics.0 is compatible with the  version of lme4.0 (not with the the current CRAN version version lme4.1). See here to install lme4.0 (if you are running on OS X Maverick see also here).

Algorithms used in MERpsychophysics for PSE and JND, which are not in the lme4 package, are referenced in the following article:

Moscatelli A, Mezzetti M, Lacquaniti F (2012). Modelling Psychophysical Data at the Population-Level: The Generalized Linear Mixed Model. Journal of Vision, 12(11):26.

The article is OPEN access. In the web site of  the Journal of Vision, you will also find the figures of the article in full-quality and original size. Please, cite the article if using the MERpsychophysics package for your data analysis!

The code is in a beta release, I am considering to write it as CRAN package later on – any feedback is welcome!

Contacts details are in the Blogroll.

Advertisements
Tags: ,