Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Stat advice for McNemar's test


From   "Newson, Roger B" <r.newson@imperial.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Stat advice for McNemar's test
Date   Tue, 21 Oct 2008 15:47:12 +0100

I don't know Walt's client, and have never spoken to him/her. However,
the word "interaction" usually means "difference between differences" or
"ratio between ratios". In this case, I would guess that it means the
difference between the before-after difference in the probability of
liking Product A and the before-after difference in the probability of
liking Product B. If this is the case, then the -glm- command can
compute a confidence interval for this difference between differences.
However, I would expect this confidence interval to be wide, unless the
sample size is very large.

Suppose that the data are reformatted into a form where there is one
observation per test per product, and therefore 4 observations per
subject (corresponding to the tests "Product A before", "Product A
after", "Product B before", and Product B after"). Suppose that there
are 4 variables, as follows:

variable_name   variable_label
subjid          Subject ID
product         Product (0=B, 1=A) 
testseq         Test sequence (0=Before, 1=After)
result          Test result (0=Does not like, 1=Likes)

The program to use on this dataset might use the -prodvars- package
(downloadable from SSC using the -ssc- command). It might be be as
follows:

xi i.product, noomit
prodvars _I*, rv(testseq) sepa(_)
glm result _I*, link(iden) family(binomial) noconst robust
cluster(subjid)
lincom _Iproduct_1_testseq-_Iproduct_0_testseq

The -xi- commmand generates 2 identifier variables _Iproduct_0 and
_Iproduct_1, identifying Product B and Product A, respectively. The
-prodvars- command generates 2 product variables _Iproduct_0_testseq and
_Iproduct_1_testseq, which are also identifiers, identifying "After"
tests for Product B and Product A, respectively. The -glm- command fits
a generalized linear model, with identity link and binomial family. This
model has 2 intercepts, corresponding to _Iproduct_0 and _Iproduct_1,
and equal to the probabilities of liking Product B and Product A in the
"Before" test. It also has 2 slopes, corresponding to
_Iproduct_0_testseq and _Iproduct_1_testseq, and equal to the
after-before differences in probability of liking Product B and Product
A, respectively. All standard errors are adjusted for clustering by
subject (ie for repeated measurements). Finally, the -lincom- command
computes a confidence interval for the Product A-Product B difference
between the 2 after-before differences, which measures how much easier
it is to acquire a taste for Product A than to acquire a taste for
Product B.

I hope this helps. Let me know if you have any queries.

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk 
Web page: www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/pop
genetics/reph/

Opinions expressed are those of the author, not of the institution.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Data
Analytics Corp.
Sent: 21 October 2008 14:06
To: Stata Listserve
Subject: st: Stat advice for McNemar's test

Hi,

I have a client who did a basic before-after taste test for two 
products.  For each, the consumers were asked if the like the product on

an initial taste and then again after a period of time.  Each consumer 
tested each product.  For one product, a McNemar's Test can be used to 
see if the marginals are the same - to see if there's a difference in 
liking from the initial to later taste.  But what about both products?  
The client wants to know about interactions between the products and 
time?  Any advice?

Thanks,

Walt






-- 
________________________

Walter R. Paczkowski, Ph.D.
Data Analytics Corp.
44 Hamilton Lane
Plainsboro, NJ 08536
________________________
(V) 609-936-8999
(F) 609-936-3733
dataanalytics@earthlink.net
www.dataanalyticscorp.com

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index