Responding Optimally with Unknown Sources
of Evidence (ROUSE)
To run your own simulations, load
these Matlab files onto your computer
- Files
necessary for the Graphical User Interface (GUI) – these files are not
well commented and should only be changed by an experienced Matlab user.
Once all the files (including the ROUSE core routines below) are loaded
onto any machine with Matlab and the appropriate folder is included in the
Matlab path, then typing “sim_rouse” at a Matlab prompt will start the
GUI.
- ROUSE
core routines – these three routines are all that is needed for a
basic simulation of ROUSE. The main routine, “rouse.m” returns an array
containing target (1’s) and foil (0’s) responses for the four basic
priming conditions and the specified number of simulations given the parameter
arguments. In addition, it returns a similar sized array of the separate
target and foil log-likelihood values. This code is heavily commented.
These routines are not “good Matlab code” in that they heavily rely on for
loops. If rewritten using Matrix calculations (an example of such
replacement code is give in “create_words.c”) they will run much faster.
The use of for loops is intentional; this makes it easier for a user to
rewrite these routines in similar languages such as Pascal, Fortran, and C/C++.
- rouse.m (main routine – initializes variables and
loops through simulations)
- create_words.m (stochastically determines which
features are shared)
- rouse_trial.m (stochastically determines feature
activation and then tallies the log-likelihoods)
- 1000
times faster “mex” files – either loading “rouse.c” and compiling your
own mex file or loading the mex file “rouse.dll” if you are running Matlab
on a Windows PC will result in a replacement of the ROUSE core routines
(there may be problems associated with just copying rouse.dll since this
executable file is not properly registered; the mex command in Matlab does
more than just compile). These C routines might result in a 1000 times speed up. I do not specify the process
for compiling a mex file (it’s involved), although this information can be
learned through the online manuals at http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/api/apiguide.pdf.
In particular chapter 2 will get you started. It will be necessary to change
a couple of include commands at the start of "rouse.c" in order to
specify the proper libraries (this will depend upon where exactly you have
placed Matlab on your hard drive). In
addition, it might be that “rouse.c” is not fully compatible with your
particular C Compiler and needs some alteration. The code is not well
commented, and contains several routines specific to passing variables
back and forth between Matlab and C, and therefore users wishing to create
their own versions of the core routines should start with the above Matlab
routines, instead of these C routines.
- rouse.c (The passed and returned arguments are the
same as “rouse.m”)
- rouse.dll (If you’re running Matlab on a Windows PC,
this is a pre-compiled mex file. Instead of loading rouse.c or any of the
three core routines, you can load this file. Transfer in binary; right
click on link and "save as")
- Even faster analytic version of ROUSE ("mex" file) –
see above about using mex files. "rouse_analytic.c" is well
commented (but in general is harder to understand than the above stochastic
versions of ROUSE). An analytic version of ROUSE is obtained by considering
all possible combinations of ON, DISCOUNTED, and OFF features (i.e., a
trinomial distribution). This routine represents a speed up of perhaps 100
times over even "rouse.c". In addition, this analytic version does
not rely upon a random number generator and is therefore ideal for parameter
estimation. A Matlab version of analytic ROUSE is not provided (and would be
too slow because of Matlab's abhorrence of "for" loops). This
routine returns different variables than "rouse.c"/"rouse.m",
and therefore the calling function "rouse_run.m" is changed
slightly. "rouse_analytic.c" returnrs probability distributions
for the ON and DISCOUNTED features (but not the entire log-odds
distributions). Therefore the "Plot Log Odds" button in the GUI
will produce errors if pressed.
- rouse_analytic.c
(analytic version of ROUSE with comments)
- rouse_analytic.dll (If you’re running Matlab on a Windows PC,
this is a pre-compiled mex file)
- rouse_run_analytic.m
(modified rouse_run function in order to accommodate the different passed
and returned variables associated with rouse_analytic. The name of this file
should be changed to "rouse_run.m" in order to integrate with the
other GUI routines)