Subject: how to adjust link function in logistic regression to predict the proportion of correct responses in 2AFC task?

From: [email-masked]
Date: Sat, 16 Dec 2006 01:57:25 +0100

I have would like to use logistic regression to analyze the
percentage of correct responses in a 2 alternative forced
choice task. The question is whether one needs to take into
account the fact expected probabilities for the percentage of
correct responses ranges between 0.5 and 1 in this case and
how to adjust the link function accordingly in R (see details below).

Gabriel

Subjects were asked to match a tactile stimulus
(shape A or B) with a visual template (response a or b).
The exact stimulus properties depended on the
experimental factors ecc (3 levels: 0.4, 0.7 and 1.0)
and kappa (also 3 levels:  0.75, 1, 1.25), which yielded
nine experimental conditions. Five subjects participated
to the experiment and each stimulus was presented 10 times
in each experimental condition.

The following table reports the pooled responses of the
5 subjects.

     |       |           kappa          |
     |       |  0.75      1.0     1.25  |
ecc | shape +--------+--------+--------+
     |       |  resp  |  resp  |  resp  |
     |       |  a   b |  a   b |  a   b |
----+-------+--------+--------+--------+
0.4 |   A   |  41  9 |  38 12 | 35  15 |
     |   B   |   3 47 |   7 43 | 11  39 |
----+-------+--------+--------+--------+
0.7 |   A   |  22 28 |  33 17 | 39  11 |
     |   B   |  10 40 |  21 29 | 24  26 |
----+-------+--------+--------+--------+
1.0 |    A   |  26 24 |  26 24 | 28  22 |
     |   B   |  20 30 |  18 32 | 25  25 |
----+-------+--------+--------+--------+

For this analysis, I define "correct response" as
the resp=a for shape=A and resp=b for shape=B.
The proportions of correct responses are therefore:

     |       |           kappa          |
ecc | shape |  0.75      1.0     1.25  |
----+-------+--------+--------+--------+
0.4 |   A   |  0.82  |  0.76  |  0.70  |
     |   B   |  0.94  |  0.86  |  0.78  |
----+-------+--------+--------+--------+
0.7 |   A   |  0.44  |  0.66  |  0.78  |
     |   B   |  0.80  |  0.58  |  0.52  |
----+-------+--------+--------+--------+
1.0 |    A   |  0.52  |  0.52  |  0.56  |
     |   B   |  0.60  |  0.62  |  0.50  |
----+-------+--------+--------+--------+

The proportion of correct response is the
largest for ecc=0.4 and, in general, smallest
for ecc=1 as expected. It was expected that
proportions of correct response would be
close to 0.5 when ecc=1 because shapes
A and  B were the same in this condition.

I would like to use the logistic regression
to assess the effect of the shape, ecc and kappa
on the proportion of correct responses. For example,

glm(resp~shape*ecc*kappa,data=data,link=binomial)

or, better,

gee(resp~shape*ecc*kappa,id=subject,data=data,family=binomial,
         corstr = "exchangeable")

given the fact that data that are correlated because
the 50 responses come from five subjects.
My first question is rather statistical: do I need to
take into account the fact that the values of these proportions
are expected to range in the interval [0.5-1] (0.5 corresponding
to a random response) ? It seems to me that some sort
of correction is needed as it is the case when one fits
a psychometric function to this type of data (e.g. probit
is rescaled to fit inside the [0.5-1] interval and the absolute
threshold is defined as the point where the probit reaches
the 0.75 probability level).

Second, how can one implement a link function of the
type f(x) = (1+exp(x)/(1+exp(x)))/2 in R?

Third, can it be also done with gee and/or glmm?

---------------------------------------------------------------------
Gabriel Baud-Bovy               tel.: (+39) 02 2643 4839 (office)
UHSR University                       (+39) 02 2643 3429 (laboratory)
via Olgettina, 58                     (+39) 02 2643 4891 (secretary)
20132 Milan, Italy               fax: (+39) 02 2643 4892

______________________________________________
[email-masked] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

---

From: Prof Brian Ripley <[email-masked]>
Date: Sat, 16 Dec 2006 06:01:15 +0000 (GMT)

On Sat, 16 Dec 2006, [email-masked] wrote:

> correct responses ranges between 0.5 and 1 in this case.

Yes.

> type f(x) = (1+exp(x)/(1+exp(x)))/2 in R?

Looking at make.link() should give you enough to go on.

> Third, can it be also done with gee and/or glmm?

For gee, you need to change the C-level internals. (I've done this in the 
far past for S-PLUS but not for R.)  It would be easier to use yags (but I 
think you still need to dive into the internals).

What 'glmm' did you have in mind?  Looks like e.g. glmmML and glmmPQL will 
work with the new link.

[...]

Someone may have been here already: e.g.
http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1434755

-- 
Brian D. Ripley,                  [email-masked]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595