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

# Re: st: Calculating Percent Agreement

 From Nick Cox To statalist@hsphsun2.harvard.edu Subject Re: st: Calculating Percent Agreement Date Thu, 14 Feb 2013 18:53:22 +0000

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/