The Palamedes function PAL_PFHB_fitModel fits Psychometric Functions to data according to the model shown
in Figure 1. 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). Parameter may also be constrained in some custom manner through the use of a model
matrix on condition (a simple example is given in the PalamedesDemos folder). 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.