| KTPsi {OPI} | R Documentation |
An implementation of Kontsevich and Tyler \Psi algorithm.
Description
An implementation of Kontsevich and Tyler (Vis Res 39 (1999) pages 2729–2737 default parameterised for Standard Automated Perimetry. based on A. Turpin, D. Jankovic and A.M. McKendrick, "Identifying Steep Psychometric Function Slope Quickly in Clinical Applications", Vision Research, 50(23). November 2010. Pages 2476-2485
Usage
KTPsi(
domains = list(slopes = 1:5, thresholds = 20:40, fps = c(0, 0.025, 0.05, 0.1, 0.2), fns
= c(0, 0.025, 0.05, 0.1, 0.2)),
priors = list(slopes = rep(1, length(domains$slopes))/length(domains$slopes),
thresholds = rep(1, length(domains$thresholds))/length(domains$thresholds), fps =
rep(1, length(domains$fps))/length(domains$fps), fns = rep(1,
length(domains$fns))/length(domains$fns)),
stimValues = 17:40,
stopType = "N",
stopValue = 140,
maxPresentations = 200,
minInterStimInterval = NA,
maxInterStimInterval = NA,
verbose = 0,
makeStim,
...
)
KTPsi.start(
domains = list(slopes = 1:5, thresholds = 20:40, fps = c(0, 0.025, 0.05, 0.1, 0.2), fns
= c(0, 0.025, 0.05, 0.1, 0.2)),
priors = list(slopes = rep(1, length(domains$slopes))/length(domains$slopes),
thresholds = rep(1, length(domains$thresholds))/length(domains$thresholds), fps =
rep(1, length(domains$fps))/length(domains$fps), fns = rep(1,
length(domains$fns))/length(domains$fns)),
stimValues = 17:40,
stopType = "N",
stopValue = 140,
maxPresentations = 200,
minInterStimInterval = NA,
maxInterStimInterval = NA,
verbose = 0,
makeStim,
...
)
KTPsi.step(state, nextStim = NULL, fixedStimValue = NA)
KTPsi.final(state, method = "expectation")
KTPsi.stop(state)
Arguments
domains |
A list of 4 vectors:
|
priors |
A list of 4 vectors:
Each prior should the same length as its |
stimValues |
Vector of allowable stimulus values. |
stopType |
|
stopValue |
Value for number of presentations ( |
maxPresentations |
Maximum number of presentations regardless of |
minInterStimInterval |
If both |
maxInterStimInterval |
|
verbose |
|
makeStim |
A function that takes a stimulus value and numPresentations and returns an OPI datatype ready for passing to opiPresent. See examples. |
... |
Extra parameters to pass to the opiPresent function |
state |
Current state of the KTPsi as returned by (eg) |
nextStim |
The next stimulus to present in a suitable format for passing to |
fixedStimValue |
Currently ignored. |
method |
Either |
Details
The assumed psychometric function is the cumulative Gaussian:
\mbox{fp}+(1-\mbox{fp}-\mbox{fn})(1-\mbox{pnorm}(x, \mbox{threshold}, \mbox{slope})
hence domain$slopes are standard deviations and domain$thresholds are the mean.
While it is assumed that domains$thresholds and stimValues are in dB, this need not be the case.
As long as the makeStim function converts stimValues into cd/\mbox{m}^2
for the opiPresent function, then any units should work.
The checkFixationOK function is called (if present in stim made from makeStim)
after each presentation, and if it returns FALSE, the pdf for that state is not changed
(ie the presentation is ignored), but the stim, number of presentations etc is recorded in
the state.
If more than one KTPsi is to be interleaved (for example, testing multiple locations), then thePsi
KTPsi.start, KTPsi.step, KTPsi.stop and KTPsi.final calls can maintain
the state of the KTPsi after each presentation, and should be used. If only a single KTPsi is
required, then the simpler KTPsi function can be used, which is a wrapper for the four functions
that maintain state. See examples below.
Value
Single location
KTPsi returns a list containing
-
npresTotal number of presentations used. -
respSeqResponse sequence stored as a matrix: row 1 is dB values of stimuli, row 2 is 1/0 for seen/not-seen, row 3 is fixated 1/0 (always 1 ifcheckFixationOKnot present in stim objects returned frommakeStim). -
pdfsIfverboseis bigger than 0, then this is a list of the pdfs used for each presentation, otherwise NULL. -
finalThe mean/median/mode of the final pdf, depending onstimChoice, which is the determined threshold. -
opiRespA list of responses received from each successful call toopiPresentwithinKTPsi.
Multilple locations
KTPsi.start returns a list that can be passed to KTPsi.step, KTPsi.stop, and KTPsi.final. It represents the state of a KTPsi at a single location at a point in time and contains the following.
-
nameKTPsi A copy of all of the parameters supplied to KTPsi.start:
domains,priors,stimValues,stopType,stopValue,maxPresentations,makeStimandopiParams.-
psiA matrix wherepsi[domain_index, stim]is the probability of seeingstimassuming the psychometric function for the domain indexdomain_index. -
labelsA text representation ofpsi[domain_index, ], or the the psychometric function for the domain indexdomain_index. -
pdfCurrent pdf: vector of probabilities the same length as product of lengths ofdomainelements. -
numPresentationsThe number of timesKTPsi.stephas been called on this state. -
stimuliA vector containing the stimuli used at each call ofKTPsi.step. -
responsesA vector containing the responses received at each call ofKTPsi.step. -
responseTimesA vector containing the response times received at each call ofKTPsi.step. -
fixatedA vector containing TRUE/FALSE if fixation was OK according tocheckFixationOKfor each call ofKTPsi.step(defaults to TRUE ifcheckFixationOKnot present). -
opiRespA list of responses received from each call toopiPresentwithinKTPsi.step.
KTPsi.step returns a list containing
-
stat:The new state after presenting a stimuli and getting a response. -
respThe return from theopiPresentcall that was made.
KTPsi.stop returns TRUE if the KTPsi has reached its stopping criteria, and FALSE otherwise.
KTPsi.final returns an estimate of threshold based on state based on its parameter.
TRUE if the state has reached its stopping criteria, and FALSE otherwise.
References
Kontsevich and Tyler. Vision Research 39 (1999) pages 2729–2737.
A. Turpin, D. Jankovic and A.M. McKendrick, "Identifying Steep Psychometric Function Slope Quickly in Clinical Applications", Vision Research, 50(23). November 2010. Pages 2476-2485
A. Turpin, P.H. Artes and A.M. McKendrick "The Open Perimetry Interface: An enabling tool for clinical visual psychophysics", Journal of Vision 12(11) 2012.
See Also
Examples
chooseOpi("SimGaussian")
if(!is.null(opiInitialize(sd = 2)$err))
stop("opiInitialize failed")
# This section is for single location KTPsi
# Stimulus is Size III white-on-white as in the HFA
makeStim <- function(db, n) {
s <- list(x=9, y=9, level=dbTocd(db), size=0.43, color="white",
duration=200, responseWindow=1500, checkFixationOK=NULL)
class(s) <- "opiStaticStimulus"
return(s)
}
KTPsi(makeStim = makeStim, stopType="H", stopValue= 3, tt=30, fpr=0.03)
KTPsi(makeStim = makeStim, stopType="N", stopValue= 27, verbose = 0, tt=30, fpr=0.03)
# For multiple locations...
## Not run:
states <- lapply(1:10, function(loc) KTPsi.start(makeStim = makeStim))
unfinished <- 1:10
while (length(unfinished) > 0) {
loc <- unfinished[[1]]
states[[loc]] <- KTPsi.step(states[[loc]])$state
if (KTPsi.stop(states[[loc]]))
unfinished <- unfinished[-1]
}
## End(Not run)