Re: [R] find the corresponding mean y

2010-01-12 Thread Keith Jewell
Not very clear what you want, but perhaps...
?sortedXyData
...might help.

hth

KJ
luciferyan anniehyh...@googlemail.com wrote in message 
news:1263231740556-1011427.p...@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.


__
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] find the corresponding mean y

2010-01-11 Thread luciferyan

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.

__
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.


Re: [R] find the corresponding mean y

2010-01-11 Thread David Winsemius


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

__
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.


Re: [R] find the corresponding mean y

2010-01-11 Thread Greg Hirson

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
ghir...@ucdavis.edu

Graduate Student
Agricultural and Environmental Chemistry

1106 Robert Mondavi Institute North
One Shields Avenue
Davis, CA 95616

__
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.