On 2011-02-22 12:51, Vlatka Matkovic Puljic wrote:
Well, it should be difference by ID and TIME for q1:
something like:
for ID 1187
in TIME 1 q1=3
and TIME 2 (for same ID) q1=3
so diff would be 3-3=0
TIME ID q1
1 1187 3
1 1187 3
And I don't know how to make R to find pairs and calculate diff?
Maybe plyr can do the job:
require(plyr)
ddply(dd, .(ID), summarize,
dq1 = q1[TIME == 1] - q1[TIME == 2],
dq2 = q2[TIME == 1] - q2[TIME == 2])
(I don't know how you're planning to use Wilcoxon on the result.)
Peter Ehlers
2011/2/21 Dennis Murphy<djmu...@gmail.com>
Hi:
Assuming dd is the name of your data frame,
dd$diff<- with(dd, q2 - q1)
dd
TIME ID q1 q2 diff
1 1 1187 3 2 -1
2 1 1706 3 3 0
3 1 1741 2 4 2
4 2 1187 3 2 -1
5 2 1706 3 3 0
6 2 1741 2 4 2
is one way to do it.
HTH,
Dennis
On Mon, Feb 21, 2011 at 11:05 AM, Vlatka Matkovic Puljic<
v.matkovic.pul...@gmail.com> wrote:
Dear all,
I want to perform paired Wilcoxon signed ranks test on my data.
I have pairs defined by ID and TIME variables.
How can I calculate difference in variables q1, q2 in each pair?
TIME ID q1 q2
1 1187 3 2
1 1706 3 3
1 1741 2 4
2 1187 3 2
2 1706 3 3
2 1741 2 4
Please, any clue!
:)
--
**************************
Vlatka Matkovic Puljic
+32/ 485/ 453340
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org 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.
______________________________________________
R-help@r-project.org 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.