[R] Sampling in R
Seyit Ali Kayis
s_a_kayis at hotmail.com
Tue Apr 21 10:53:52 CEST 2009
Dear R users,
I need to do sampling without replacement (bootstraps). I have two variables (Xvar, Yvar).
I have a correlation from original data set cor(Xvar, Yvar)=0.6174221. I am doing 50000 sampling,
and in each sampling calculating correlations, saving, sorting and getting 95% cutt off point (0.1351877).
I am getting maximum value as 0.3507219 (much smaller than correlation of my original data).
I repeated the sampling a couple of time and none of them produced a correlation
coefficient higher than my original data set. However, if I sort out my Xvar and Yvar and
obtain correlation it is 0.9657125 which is much higher than correlation for my original data.
I am doing sampling in another program and getting at least 1% higher correlation than mine.
Now I am getting confused with sampling(random data) in R. My data and codes for the scenario above are
in the attached file. I want to understand where I am making a mistake. Any comment is deeply appreciated.
Kind Regards
Seyit Ali
------------------------------------------------------------------------------------------------------------------
Dr. Seyit Ali KAYIS
Selcuk University
Faculty of Agriculture
Kampus, Konya, TURKEY
s_a_kayis at yahoo.com, s_a_kayis at hotmail.com
Tell: +90 332 223 2830 Mobile: +90 535 587 1139 Fax: +90 332 241 0108
Greetings from Konya, TURKEY
http://www.ziraat.selcuk.edu.tr/skayis/
----------------------------------------------------------------------------------------------------------------------
_________________________________________________________________
No-one wants to be lonely this Autumn Find someone to snuggle up with
Fchannel%2Findex%2Easpx%3Ftrackingid%3D1048628&_t=773568480&_r=nzWINDOWSliveMAILemailTAGLINES&_m=EXT
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Data_and_Sampling_codes.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090421/c9a15418/attachment-0002.txt>
More information about the R-help
mailing list