Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Calculating Percent Agreement


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Calculating Percent Agreement
Date   Thu, 14 Feb 2013 23:43:54 +0000

Your data structure might be better as -wide-:

reshape wide q1 q2 q3 , i(obs) j(dup)

after which you have easy indicators such as

gen agree1 = q11 == q12

and standard procedures such as -ci, binomial- then can be used.

Nick

On Thu, Feb 14, 2013 at 6:53 PM, Nick Cox <njcoxstata@gmail.com> wrote:
> Reverse engineering the definition of % agreement from your examples,
> your results can be reproduced by
>
> gen agree = .
>
> di
>
> foreach var in q1 q2 q3 {
>         qui bysort obs : replace agree = (`var'[1] == `var'[2]) if _n == 1
>         su agree, meanonly
>         di "`var': % agreement  " %4.1f  100 * r(sum) / r(N)
> }
>
> apart from the fact that 2/3 rounds to 67%,  not 66%.
>
> If you want anything inferential too, this code is clearly not sufficient.
>
> Nick
>
> On Thu, Feb 14, 2013 at 6:20 PM, Lynne Morgan <lmorgan3@wisc.edu> wrote:
>
>> I have a data set based on a questionnaire similar to the one below. There
>> are two entries for each object because each was rated twice. We would like
>> to look at the percent agreement between the two questions but there were
>> several raters so we just want to look at the differences for each question.
>> In this case, I want to calculate that q1 has a % agreement of 66%, q2
>> agreement= 33% and q3 % agreement=100%.
>>
>> Because it is not by rater, I can't use the stata kappa command or kap. What
>> is the best way to calculate this in stata? Or, what is the best way to
>> transpose the data in order to use kappa?
>>
>> obs q1    q2    q3    dup
>> 1    0        0     0         1
>> 1     0       1     0         2
>> 2     0       1     1         1
>> 2     1       1     1         2
>> 3    1        0     1         1
>> 3    1        1     1         2
>>
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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