HomeOverviewDownload PalamedesSupporting documentationFrequently asked questionsSubmit comments and questionsSubmit a bug reportNews and updates (last update: January 5, 2021)Why "Palamedes"?About usOptions besides PalamedesDemos figure galleryModel Comparison ExamplesConfused about Weibull?Failed Fits?Hierarchical Bayesian PF Fitting

The Palamedes function PAL_PFHB_fitModel fits Psychometric Functions to data according to the model shown in Figure 1 by default. If data are obtained from multiple observers, PAL_PFHB_fitModel will automatically fit a hierchical model. Function will also fit multiple conditions simultaneously, by default constraining the lapse rate to be equal across conditions (but not across observers). See examples in the PalamedesDemos folder. Posterior distributions are sampled by either JAGS or Stan. JAGS (http://mcmc-jags.sourceforge.net/) or cmdStan ('command Stan'; https://mc-stan.org/users/interfaces/cmdstan.html) either of which must be installed for this to work. Type 'help PAL_PFHB_fitModel' for information on how to use the function, choose different forms and parameter values of the priors, set form (logistic, gumbel, etc.) of PF, etc. Function PAL_PFHB_inspectFit can be used to inspect fitted functions alongside data (it produces a figure such as Figure 2). Function PAL_PFHB_inspectParam can be used to inspect posterior functions, diagnostics, and more (it produces figures such as Figure 3 and Figure 4).


Figure 1. Default model fitted by PAL_PFHB_fitModel. Forms and parameters of prior functions may be adjusted. Default form of F(x; α, β, γ, λ) is the Logistic function. Any of the PF parameters (location, slope, guess rate, lapse rate) may be independently constrained between multiple conditions in experiment. Options: 'unconstrained' (parameter free to vary in each condition), 'constrained' (parameter is constrained to be equal between conditions), 'fixed' (parameter is fixed at some value). Parameters may also be constrained in some custom manner through the use of a model matrix on condition. This allows one, for example, to specify parameters corresponding to 'effects'. A simple example of this is given in the file PAL_PFHB_SingleSubjectMultipleConditions_Demo.m in the PalamedesDemos folder. A more elaborate example that demonstrates the flexibility with which the user can specify effects is given here: Prins, Vision Sciences Society, 2019. The default constraints on parameters are indicated in figure using curly brackets.


Figure 2. Example output from PAL_PFHB_inspectFit. Figure shows data, PF with parameters corresponding to modes (default) in the parameter posterior distributions, and 100 PFs randomly sampled from posterior distribution.


Figure 3. Top left panel shows consecutive samples in three chains of Stan from posterior distribution of PF's location parameter (aka 'threshold') for subject 1, condition 1. Top right shows posterior distribution as histogram with smooth posterior estimated through kernel density estimation, and 0.95 HDI. Bottom left shows autocorrelation functions for each of the sample chains and the effective sample size (ESS).


Figure 4. Similar to Figure 3 but showing diagnostics, posterior and summary statistics for the difference between the location parameters in two conditions of experiment. Bottom right shows scatterplot and correlation coefficient between the parameters.