R statistics, change ranked tables to paired
Posted
by
cousin_pete
on Stack Overflow
See other posts from Stack Overflow
or by cousin_pete
Published on 2013-06-28T04:18:37Z
Indexed on
2013/06/28
4:21 UTC
Read the original article
Hit count: 65
I have data for many tables like:
event_id player finish 1 a 1 1 b 2 1 c 3 1 d 4 2 b 1 2 e 2 2 f 3 2 a 3 2 g 5
Many event_id's, each from 5 to 20 players, finish may be tied.
In order to use conditional logistic regression in R I would like to reformat the tables to be like:
event_id player1 player2 result 1 a b 1 1 a c 1 1 a d 1 1 b c 1 1 b d 1 1 c d 1 2 b e 1 2 b f 1 2 b a 1 2 b g 1 2 e f 1 2 e a 1 2 e g 1 2 f a 0.5 2 f g 1 2 a g 1
An event_id of 4 players will have 4*3/2 = 6 records in the new table, 5 players will have 5*4/2 = 10 records and so on. If player "a" has "finish" less than player "b" the "result" is 1. If "finish" is equal the "result" is 0.5. If player "a" has finish greater than player "b" then the "result" would be 0.
Any help appreciated!
© Stack Overflow or respective owner