Hello, I have 49 paired data, x, y. I have sampled x (where replacement is true), and find its mean. How can I find the corresponding mean y, which is the paired data of above sample x? Thank you very much, Annie -- View this message in context: http://n4.nabble.com/find-the-corresponding-mean-y-tp1011427p1011427.html Sent from the R help mailing list archive at Nabble.com.
On Jan 11, 2010, at 12:42 PM, luciferyan wrote:> > Hello, I have 49 paired data, x, y. > I have sampled x (where replacement is true), and find its mean.If you show how you did that, then we can show you the next steps.> How can I find the corresponding mean y, which is the paired data of > above > sample x?-- David Winsemius, MD Heritage Laboratories West Hartford, CT
Annie, If I understand what you are asking, you want to sample some number of observations, with replacement, then find the mean of x and y for those observations. In this case, you would want to sample the row indices instead of the values. For example, #test data set.seed(1) df <- data.frame(x = rnorm(100), y = rnorm(100)) #sample from row indices samp <- sample(nrow(df), 25, replace = TRUE) #get means for x and y mean(df[samp,]$x) mean(df[samp,]$y) #or mean(df[samp,]) Greg On 1/11/10 9:42 AM, luciferyan wrote:> Hello, I have 49 paired data, x, y. > I have sampled x (where replacement is true), and find its mean. > How can I find the corresponding mean y, which is the paired data of above > sample x? > Thank you very much, > Annie >-- Greg Hirson ghirson at ucdavis.edu Graduate Student Agricultural and Environmental Chemistry 1106 Robert Mondavi Institute North One Shields Avenue Davis, CA 95616
Not very clear what you want, but perhaps... ?sortedXyData ...might help. hth KJ "luciferyan" <anniehyhung at googlemail.com> wrote in message news:1263231740556-1011427.post at n4.nabble.com...> > Hello, I have 49 paired data, x, y. > I have sampled x (where replacement is true), and find its mean. > How can I find the corresponding mean y, which is the paired data of above > sample x? > Thank you very much, > Annie > -- > View this message in context: > http://n4.nabble.com/find-the-corresponding-mean-y-tp1011427p1011427.html > Sent from the R help mailing list archive at Nabble.com. >