discrimR: Replicated Thurstonian Model for discrimination analysis

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/discrimR.R

Description

The model is a synthesis of a mixture and a mixed effect model. The random effect distribution for the cluster term (often individuals) is a point mass for delta = 0 and a continuous distribution for delta > 0.

The function fits the model and computes d-prime for an average subject, 2) the variance among subjects, 3) the "posterior" probability of a subject being a discriminator (with delta > 0), 4) the "posterior" expectation on the random effect (ie. the subject-specific delta) and 5) the probability that a randomly chosen individual is a discriminator (ie. the probability mass at delta = 0 in the random effects distribution)

Warning: This function is preliminary; see the details for further information.

Usage

1
2
3
4
discrimR(formula, data, weights, cluster, start, subset, na.action,
           contrasts = NULL, hess = FALSE, ranef = FALSE, zi = FALSE,
           method = c("duotrio", "probit", "threeAFC", "triangle",
             "twoAFC"), ...)

Arguments

formula

A formula where the lhs is the binomial response. An indicator vector or a matrix with two column; successes and failures like in a call to glm with a binomial family. The rhs should be 1; no other predictors are currently allowed, but extending this is ongoing work.

data

The data.frame in which to look for variables.

weights

Possible weights

cluster

The clustering variable; should be a factor.

start

Optional starting values; recommended in the current implementation

subset

...

na.action

...

contrasts

...

hess

Should the hessian of the parameters be computed?

ranef

Should the random effect estimates be computed?

zi

Should the posterior probabilities of a subject being a discriminator be computed?

method

Should correspond to the actual test applied.

...

Additional arguments to optim. control=list(trace=TRUE, REPORT=1) is recommended, so the reduction in deviance and convergence can be followed.

Details

This function is preliminary and improving it is ongoing work. The computational methods are expected to change completely. This will hopefully facilitate methods for more general rhs-formulae with additional predictors.

Currently no methods or extractor functions have been written, so the user will have to select the relevant elements from the fitted object (see below). Implementation of methods and extractor functions will occur in due course.

Value

A list with the following elements:

fpar

The fixed effect parameter, ie. delta (for an average individual)

rpar

A vector with two elements: The first element is the variance component (standard deviation) on the log-scale, where optimization is performed. The second element is the variance component (standard deviation) on the original scale.

deviance

Deviance for the model

se

standard errors for 1) the fixed effect parameter and 2) the variance component on the log-scale

convergence

Convergence message from optim

lli

Log-likelihood contributions from each of the observations.

ranef

The random effect estimates for the levels of the clustering factor (often individual)

zi

posterior probabilities of a subject being a discriminator

p

The probability that a randomly chosen individual is a discriminator (ie. the probability mass for delta > 0 in the random effects distribution)

fitted

Fitted values

Y

The scaled response vector on which optimization is performed.

call

the matched call

Author(s)

Rune Haubo B Christensen

See Also

triangle, twoAFC, threeAFC, duotrio, discrimPwr, discrimSim, discrimSS, samediff, AnotA, findcr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
freq <- c(10,8,10,9,8,9,9,1,10,10,8,2,6,7,6,7,6,4,5,5,3,3,9,9,5,5,8,8,9,9)
tmp <- data.frame(id = factor(1:30), n = rep(10, 30), freq = freq)
head(tmp)
str(tmp)

fm <- discrimR(cbind(freq, n - freq) ~ 1, tmp, cluster = id,
                    start = c(.5, .5), method = "twoAFC",
                    ranef = TRUE, zi = TRUE, hess = TRUE, 
                    control=list(trace=TRUE, REPORT=1))

names(fm)
fm[1:4]

## End(Not run)

sensR documentation built on May 2, 2019, 9:43 a.m.