Package 'qdm'

Title: Fitting a Quadrilateral Dissimilarity Model to Same-Different Judgments
Description: This package provides different specifications of a Quadrilateral Dissimilarity Model which can be used to fit same-different judgments in order to get a predicted matrix that satisfies regular minimality [Colonius & Dzhafarov, 2006, Measurement and representations of sensations, Erlbaum]. From such a matrix, Fechnerian distances can be computed.
Authors: Nora Umbach [aut, cre], Florian Wickelmaier [aut]
Maintainer: Nora Umbach <[email protected]>
License: GPL (>= 2)
Version: 0.1-0
Built: 2024-12-01 08:42:30 UTC
Source: CRAN

Help Index


Discrimination Judgments of Frequency-Modulated Tones

Description

Three subjects were repeatedly presented with all possible pairs of nine frequency-modulated (FM) tones. The tones had one out of nine different modulation rates, a random modulation phase, a duration of 500 ms, a sound pressure level of 60 dB, and a center frequency of 1000 Hz.

On each trial, subjects judged whether the two FM tones sounded same or different.

Usage

data(FMrate)

Format

A data frame of eight variables and 26,820 observations:

resp

the response of a subject in each trial, either s for same or d for different.

RT

reaction time from stimulus onset until reaction of subject.

id

subject id.

ses

number of experimental session.

s1

stimulus (FM rate in Hz) which was presented in the first observation area; in this case: first.

s2

stimulus (FM rate in Hz) which was presented in the second observation area.

phi1

random modulation phase shift for stimulus presented in the first observation area.

phi2

random modulation phase shift for stimulus presented in the second observation area.

Source

Umbach, N., & Wickelmaier, F. (2014). Violations of regular minimality in discrimination judgments of frequency-modulated tones. Presented at the 45th European Mathematical Psychology Group (EMPG) Meeting, July 30 to August 1, Tuebingen, Germany.

Examples

data(FMrate)
xtabs(~ id + ses, FMrate)

Discrimination Judgments of Gray Patches

Description

Four subjects were repeatedly presented with all possible pairs of nine gray patches presented under a constant illumination of 133.27 cd/m^2. Stimuli had a size of 0.81 degrees of visual angle and were presented side by side with a distance of 2.32 degrees of visual angle.

On each trial, subjects judged whether the two patches looked same or different.

Usage

data(lightness)

Format

A data frame of seven variables and 35,760 observations:

resp

the response of a subject in each trial, either s for same or d for different.

RT

reaction time from stimulus onset until reaction of subject.

id

subject id.

ses

number of experimental session.

s1

stimulus which was presented in the first observation area; in this case: on the left side of the monitor.

s2

stimulus which was presented in the second observation area.

key

which mouse button was pressed. Assigment of same and different to the mouse buttons varied between subjects.

Source

Umbach, N (2013). Dimensionality of the Perceptual Space of Achromatic Surface Colors. Dissertation, University of Tuebingen.

Examples

data(lightness)
xtabs(~ id + ses, lightness)

Perspective Plot for Predictions of Quadrilateral Dissimilarity Model

Description

Draws a perspective plot of the predictions of a Quadrilateral Dissimilarity Model fitted with qdm.

Usage

## S3 method for class 'qdm'
persp(x, col = "gray", zlim = 0:1, phi = 10, theta = -25,
      xlab = "OA1", ylab = "OA2", zlab = "Predictions", ...)

Arguments

x

object of class 'qdm'. See qdm.

col

the color(s) of the surface facets. Transparent colours are ignored. This is recycled to the (nx-1)(ny-1) facets.

zlim

Defaults to zlim=c(0,1) since probabilities are plotted.

theta, phi

angles defining the viewing direction. 'theta' gives the azimuthal direction and 'phi' the colatitude.

xlab, ylab, zlab

titles for the axes. N.B. These must be character strings; expressions are not accepted. Numbers will be coerced to character strings.

...

additional graphical parameters (see 'par').

See Also

qdm, persp


Predictions of Quadrilateral Dissimilarity Model

Description

Predicts regular minimality compliant discrimination probabilities for a model fitted with qdm.

Usage

## S3 method for class 'qdm'
predict(object, x = object$psi$x, y = object$psi$y,
        respfun = object$respfun, bias = object$bias, ...)

Arguments

object

object of class "qdm". See qdm.

x

stimulus intensities for the first observation area. Defaults to the values used for fitting the model.

y

stimulus intensities for the second observation area. Defaults to the values used for fitting the model.

respfun

function used to describe relationship between discrimination probabilities and similarity measure. Defaults to the function used for fitting the model. See qdm for Details.

bias

perceptual bias of subject. Defaults to the bias used for fitting the model.

...

additional arguments.

See Also

qdm


Create Discrimination Probabilities (Psi) from Data Frame

Description

Creates matrices with discrimination probabilities, number of trials, number of different answers, and stimulus intensities from a data frame.

Usage

psi(data, oa1 = "s1", oa2 = "s2", resp = "resp")

Arguments

data

data frame with repeated same-different judgments.

oa1, oa2

name of the variable that contains the stimulus intensities in the first and second observation area.

resp

name of response variable for same-different judgments; answers have to be d and s for "different" and "same" response, respectively.

Details

The data frame must include at least a column for the response and one column each for observation areas one and two. The return value of psi may serve as an input to qdm that fits a quadrilateral dissimilarity model to the judgments.

Value

An object of class psi that consists of the following components:

prob

a matrix of discrimination probabilities per stimulus combination.

ntrials

a matrix of number of trials per stimulus combination.

freq

a matrix of frequencies of different answers per stimulus combination.

x, y

(if possible numeric) vectors of stimulus intensities.

See Also

qdm.

Examples

data(FMrate)
psi1 <- psi(FMrate[FMrate$id == "subj1",])

Fit a Quadrilateral Dissimilarity Model

Description

Fits a Quadrilateral Dissimilarity Model to same-different data.

Usage

qdm(psi, start, respfun = c("logistic", "guessing", "gumbel", "gompertz",
    "weibull", "cauchy", "shepardA", "shepardAneg", "shepardB",
    "shepardBneg", "shepardD", "shepardDneg", "shepardE", "shepardEneg",
    "shepardF", "shepardFneg"), bias = 0,
    estimfun = c("minchi2", "ols", "wls"), optimizer = c("optim", "nlm"),
    optimargs = list())

Arguments

psi

data object created with psi.

start

starting values for parameter estimation.

respfun

function that describes relationship between discrimination probabilities and similarity measure, see Details.

bias

takes perceptual bias into account. Default is 0.

estimfun

method to estimate parameters, see Details.

optimizer

which optimizer should be used: nlm or optim.

optimargs

takes additional arguments passed to nlm or optim.

Details

More details about the Quadrilateral Dissimilarity Model can be found in Dzhafarov and Colonius (2006).

Via respfun, different functions can be selected to describe the relationship between discrimination probabilities and dissimilarity measure. Implemented are the logistic function (logistic), the logistic function with guessing parameter (guessing), several other functions commonly used as psychometric functions (gumbel, gompertz, weibull, cauchy), and five functions suggested by Shepard (1987) (shepardA, shepardB, shepardD, shepardE, shepardF) and their negatives (shepardAneg, shepardBneg, shepardDneg shepardEneg, shepardFneg). Default is the logistic function. Note that for some of these functions the results critically depend on the choice of the starting values.

Parameters can be estimated by using different minimizing functions available via the estimfun argument: ordinary least squares (ols), weighted least squares (wls), and minimization of Pearson's X2X^2 (minchi2). Default is the minimization of X2X^2.

Value

An object of class qdm that consists of the following components:

optimout

output of optimizer (nlm or optim).

coefficients

estimated parameters.

psi

psi object used to fit Quadrilateral Dissimilarity Model.

respfun

function used to describe relationship between discrimination probabilities and similarity measure.

bias

perceptual bias used in the model.

References

Dzhafarov, E. N., & Colonius, H. (2006). Regular Minimality: A fundamental law of discrimination. In H. Colonius & E. N. Dzhafarov (Eds.), Measurement and representation of sensations (pp. 1–46). Hillsdale, NJ: Lawrence Erlbaum Associates.

Shepard, R. N. (1987). Towards a universal law of generalization for psychological science. Science, 237, 1317–1323.

See Also

psi, predict.qdm, persp.qdm, nlm, optim.

Examples

## prepare data
data(FMrate)
psi1 <- psi(FMrate[FMrate$id == "subj1",])

## estimate model
p.s <- c(.2, .5, .1, .5, .3, .1, .1, .1)
q1 <- qdm(psi1, start=p.s)
print(q1)

## model predictions
predict(q1)
persp(q1)