Public Member Functions | Protected Member Functions

PsiPsychometric Class Reference

Standard psychometric function model. More...

#include <psychometric.h>

Inheritance diagram for PsiPsychometric:
BetaPsychometric OutlierModel

List of all members.

Public Member Functions

 PsiPsychometric (int nAFC, PsiCore *core, PsiSigmoid *sigmoid)
 Set up a psychometric function model for an nAFC task (nAFC=1 ~> yes/no).
 ~PsiPsychometric (void)
 destructor (also deletes the core and sigmoid objects)
virtual double evaluate (double x, const std::vector< double > &prm) const
 Evaluate the psychometric function at this position.
virtual double negllikeli (const std::vector< double > &prm, const PsiData *data) const
 negative log likelihood
virtual double neglpost (const std::vector< double > &prm, const PsiData *data) const
 negative log posterior (unnormalized)
virtual double leastfavourable (const std::vector< double > &prm, const PsiData *data, double cut, bool threshold=true) const
 derivative of log likelihood in the least favourable direction in parameter space
virtual double deviance (const std::vector< double > &prm, const PsiData *data) const
 deviance for a given data set and parameter constellation
virtual Matrixddnegllikeli (const std::vector< double > &prm, const PsiData *data) const
 2nd derivative of the negative log likelihood (newly allocated matrix)
virtual std::vector< double > dnegllikeli (const std::vector< double > &prm, const PsiData *data) const
 1st derivative of the negative log likelihood
const PsiCoregetCore (void) const
 get the core of the psychometric function
const PsiSigmoidgetSigmoid (void) const
 get the sigmoid of the psychometric function
void setPrior (unsigned int index, PsiPrior *prior) throw (BadArgumentError)
 set a Prior for the parameter indicated by index
double evalPrior (unsigned int index, double x) const
 evaluate the respective prior at value x
virtual double randPrior (unsigned int index) const
 sample form a prior
const PsiPriorgetPrior (unsigned int index) const
 get a prior
int getNalternatives (void) const
 get the number of alternatives (1 means yes/no)
virtual unsigned int getNparams (void) const
 get the number of free parameters of the psychometric function
virtual std::vector< double > getStart (const PsiData *data) const
 determine a starting value using logistic regression on a dataset
double getThres (const std::vector< double > &prm, double cut) const
 get the threshold at a cut between 0 and 1
double getSlope (const std::vector< double > &prm, double x) const
 get the slope at a stimulus intensity
std::vector< double > getDevianceResiduals (const std::vector< double > &prm, const PsiData *data) const
 deviance residuals for model checking
double getRpd (const std::vector< double > &devianceresiduals, const std::vector< double > &prm, const PsiData *data) const
 correlation between deviance residuals and predictions
double getRkd (const std::vector< double > &devianceresiduals, const PsiData *data) const
 correlation between deviance residuals and block sequence
double dllikeli (std::vector< double > prm, const PsiData *data, unsigned int i) const
 derivative of the negative loglikelihood with respect to parameter i
double dlposteri (std::vector< double > prm, const PsiData *data, unsigned int i) const
 derivative of the negative log posterior with respect to parameter i
void setgammatolambda (void)
double getGuess (const std::vector< double > &prm) const
 calling this function applies the constraint that gamma and lambda should be equal in a yes/no paradigm
double dpredict (const std::vector< double > &prm, double x, unsigned int i) const
 partial derivative of psychometric function prediction w.r.t. i-th parameter
double ddpredict (const std::vector< double > &prm, double x, unsigned int i, unsigned int j) const
 2nd partial derivative of psychometric function prediction w.r.t. i-th and j-th parameters

Protected Member Functions

 PsiPsychometric (int nAFC, PsiCore *core, PsiSigmoid *sigmoid, unsigned int nparameters)
 Set up a psychometric function model for an nAFC task, explicitely specifiing the number of parameters (useful for derived classes).

Detailed Description

Standard psychometric function model.

Standard model for the psychometric function that assumes that the number of correct responses is a binomial random variable with parameters N (number of trials) and Psi, where Psi is

Psi = guessingrate + (1-guessingrate-lapserate) * Sigmoid ( x | theta )

For an nAFC task, the guessingrate is typicall fixed at 1/n.

The term Sigmoid ( x | theta ) is represented by two objects: a PsiSigmoid f, that describes a nonlinear function from the real numbers to (0,1) and a PsiCore g, that describes the "internal" workings of the nonlinear function. Thus, the Term Sigmoid ( x | theta ) equals f(g(x,theta)).

The object copies and manages its own memory. This means that when setting PsiSigmoid and PsiCore in the constructor, as well as setting PsiPrior via setPrior(), copies of the respective objects are made. Furthermore when the object is destroyed theses copies are destoryed also.


Constructor & Destructor Documentation

PsiPsychometric::PsiPsychometric ( int  nAFC,
PsiCore core,
PsiSigmoid sigmoid,
unsigned int  nparameters 
) [protected]

Set up a psychometric function model for an nAFC task, explicitely specifiing the number of parameters (useful for derived classes).

Parameters:
nAFC number of alternatives (1 indicating yes/no)
core internal part of the nonlinear function
sigmoid "external" saturating part of the nonlinear function
nparameters number of parameters given explicitely
PsiPsychometric::PsiPsychometric ( int  nAFC,
PsiCore core,
PsiSigmoid sigmoid 
)

Set up a psychometric function model for an nAFC task (nAFC=1 ~> yes/no).

Parameters:
nAFC number of alternatives in the task (1 indicating yes/no)
core internal part of the nonlinear function (in many cases this is actually a linear function)
sigmoid "external" saturating part of the nonlinear function

Member Function Documentation

Matrix * PsiPsychometric::ddnegllikeli ( const std::vector< double > &  prm,
const PsiData data 
) const [virtual]

2nd derivative of the negative log likelihood (newly allocated matrix)

Parameters:
prm parameters at which the second derivative should be evaluated
data data for which the likelihood should be evaluated

Reimplemented in BetaPsychometric.

double PsiPsychometric::deviance ( const std::vector< double > &  prm,
const PsiData data 
) const [virtual]

deviance for a given data set and parameter constellation

Parameters:
prm parameters of the psychometric functin model
data data for which the likelihood should be evaluated

Reimplemented in BetaPsychometric, and OutlierModel.

double PsiPsychometric::dllikeli ( std::vector< double >  prm,
const PsiData data,
unsigned int  i 
) const

derivative of the negative loglikelihood with respect to parameter i

Parameters:
prm parameters of the model
data data for which the likelihood should be evaluated
i index of the parameter for which the derivative should be evaluated
double PsiPsychometric::dlposteri ( std::vector< double >  prm,
const PsiData data,
unsigned int  i 
) const

derivative of the negative log posterior with respect to parameter i

Parameters:
prm parameters of the psychometric function model
data data for which the likelihood should be valuated
i index of the parameter for which the derivative should be evaluated
std::vector< double > PsiPsychometric::dnegllikeli ( const std::vector< double > &  prm,
const PsiData data 
) const [virtual]

1st derivative of the negative log likelihood

Parameters:
prm parameters at which the first derivative should be evaluated
data data for which the likelihood should be evaluated

Reimplemented in BetaPsychometric.

double PsiPsychometric::evaluate ( double  x,
const std::vector< double > &  prm 
) const [virtual]

Evaluate the psychometric function at this position.

Parameters:
x stimulus intensity
prm parameters of the psychometric function model
std::vector< double > PsiPsychometric::getDevianceResiduals ( const std::vector< double > &  prm,
const PsiData data 
) const

deviance residuals for model checking

Parameters:
prm parameters of the psychometric function model
data data for which the deviance residuals should be determined
double PsiPsychometric::getRpd ( const std::vector< double > &  devianceresiduals,
const std::vector< double > &  prm,
const PsiData data 
) const

correlation between deviance residuals and predictions

Parameters:
devianceresiduals deviance residuals as determined by getDevianceResiduals
prm parameters of the psychometric function model
data data set corresponding to the deviance residuals
double PsiPsychometric::getSlope ( const std::vector< double > &  prm,
double  x 
) const [inline]

get the slope at a stimulus intensity

Parameters:
prm parameters of the psychometric function model
x performance level at which the slope should be evaluated
double PsiPsychometric::getThres ( const std::vector< double > &  prm,
double  cut 
) const [inline]

get the threshold at a cut between 0 and 1

Parameters:
prm parameters of the psychometric function model
cut performance level at which the threshold should be evaluated
double PsiPsychometric::leastfavourable ( const std::vector< double > &  prm,
const PsiData data,
double  cut,
bool  threshold = true 
) const [virtual]

derivative of log likelihood in the least favourable direction in parameter space

Parameters:
prm parameters of the psychometric function model
data data for which the likelihood should be evaluated
cut performance level at which the threshold should be evaluated
threshold should the calculations be performed for thresholds? (anything else is not yet implemented)
double PsiPsychometric::negllikeli ( const std::vector< double > &  prm,
const PsiData data 
) const [virtual]

negative log likelihood

Parameters:
prm parameters of the psychometric function model
data data for which the likelihood should be evaluated

Reimplemented in BetaPsychometric, and OutlierModel.

double PsiPsychometric::neglpost ( const std::vector< double > &  prm,
const PsiData data 
) const [virtual]

negative log posterior (unnormalized)

Parameters:
prm parameters of the psychometric function model
data data for which the posterior should be evaluated

Reimplemented in OutlierModel.


The documentation for this class was generated from the following files: