hmh
2018-Oct-05 08:36 UTC
[R] Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
On 05/10/2018 10:28, Annaert Jan wrote:> you discard any time series structure;But that is PRECISELY what a call a bug: There should not be any "time series structure" in the output or rnorm, runif and so on but there is one. rnorm(N,0,1) should give on average the same output as sample(rnorm(N,0,1)) Which is not the case. rnorm(N,0,1) should draw INDEPENDENT samples i.e. without time series structure ! -- - no title specified Hugo Math?-Hubert ATER Laboratoire Interdisciplinaire des Environnements Continentaux (LIEC) UMR 7360 CNRS - ?B?t IBISE Universit? de Lorraine ?- ?UFR SciFA 8, Rue du G?n?ral Delestraint F-57070 METZ +33(0)9 77 21 66 66 - - - - - - - - - - - - - - - - - - Les r?flexions naissent dans les doutes et meurent dans les certitudes. Les doutes sont donc un signe de force et les certitudes un signe de faiblesse. La plupart des gens sont pourtant certains du contraire. - - - - - - - - - - - - - - - - - - Thoughts appear from doubts and die in convictions. Therefore, doubts are an indication of strength and convictions an indication of weakness. Yet, most people believe the opposite. [[alternative HTML version deleted]]
Deepayan Sarkar
2018-Oct-05 09:16 UTC
[Rd] [R] Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
On Fri, Oct 5, 2018 at 2:07 PM hmh <hugomh at gmx.fr> wrote:> > On 05/10/2018 10:28, Annaert Jan wrote: > > you discard any time series structure; > But that is PRECISELY what a call a bug: > There should not be any "time series structure" in the output or rnorm, > runif and so on but there is one. > > rnorm(N,0,1) > should give on average the same output as > sample(rnorm(N,0,1))Agreed, but that is not what your code is testing. You seem to think that something much more specific should be true; namely, X[1:10] ~ iid normal, then cor(X[1:9], X[2:10]) and cor(sample(X[-1]), sample(X[-10])) should have the same distribution. This is not at all obvious, and in fact not true. Please check the reference you have been pointed to. Here is a related article in the same volume: https://www.jstor.org/stable/2332719 -Deepayan> Which is not the case. rnorm(N,0,1) should draw INDEPENDENT samples i.e. > without time series structure ! > > > -- > - no title specified > > Hugo Math?-Hubert > > ATER > > Laboratoire Interdisciplinaire des Environnements Continentaux (LIEC) > > UMR 7360 CNRS - B?t IBISE > > Universit? de Lorraine - UFR SciFA > > 8, Rue du G?n?ral Delestraint > > F-57070 METZ > > +33(0)9 77 21 66 66 > - - - - - - - - - - - - - - - - - - > Les r?flexions naissent dans les doutes et meurent dans les certitudes. > Les doutes sont donc un signe de force et les certitudes un signe de > faiblesse. La plupart des gens sont pourtant certains du contraire. > - - - - - - - - - - - - - - - - - - > Thoughts appear from doubts and die in convictions. Therefore, doubts > are an indication of strength and convictions an indication of weakness. > Yet, most people believe the opposite. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
hmh
2018-Oct-05 09:32 UTC
[R] Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
I got it ! thanks and sorry for annoying you with that. have a nice day, hugo On 05/10/2018 11:16, Deepayan Sarkar wrote:> On Fri, Oct 5, 2018 at 2:07 PM hmh <hugomh at gmx.fr> wrote: >> On 05/10/2018 10:28, Annaert Jan wrote: >>> you discard any time series structure; >> But that is PRECISELY what a call a bug: >> There should not be any "time series structure" in the output or rnorm, >> runif and so on but there is one. >> >> rnorm(N,0,1) >> should give on average the same output as >> sample(rnorm(N,0,1)) > Agreed, but that is not what your code is testing. You seem to think > that something much more specific should be true; namely, > > X[1:10] ~ iid normal, then > > cor(X[1:9], X[2:10]) > > and > > cor(sample(X[-1]), sample(X[-10])) > > should have the same distribution. This is not at all obvious, and in > fact not true. > > Please check the reference you have been pointed to. Here is a related > article in the same volume: > > https://www.jstor.org/stable/2332719 > > -Deepayan > > >> Which is not the case. rnorm(N,0,1) should draw INDEPENDENT samples i.e. >> without time series structure ! >> >> >> -- >> - no title specified >> >> Hugo Math?-Hubert >> >> ATER >> >> Laboratoire Interdisciplinaire des Environnements Continentaux (LIEC) >> >> UMR 7360 CNRS - B?t IBISE >> >> Universit? de Lorraine - UFR SciFA >> >> 8, Rue du G?n?ral Delestraint >> >> F-57070 METZ >> >> +33(0)9 77 21 66 66 >> - - - - - - - - - - - - - - - - - - >> Les r?flexions naissent dans les doutes et meurent dans les certitudes. >> Les doutes sont donc un signe de force et les certitudes un signe de >> faiblesse. La plupart des gens sont pourtant certains du contraire. >> - - - - - - - - - - - - - - - - - - >> Thoughts appear from doubts and die in convictions. Therefore, doubts >> are an indication of strength and convictions an indication of weakness. >> Yet, most people believe the opposite. >> >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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.-- - no title specified Hugo Math?-Hubert ATER Laboratoire Interdisciplinaire des Environnements Continentaux (LIEC) UMR 7360 CNRS - ?B?t IBISE Universit? de Lorraine ?- ?UFR SciFA 8, Rue du G?n?ral Delestraint F-57070 METZ +33(0)9 77 21 66 66 - - - - - - - - - - - - - - - - - - Les r?flexions naissent dans les doutes et meurent dans les certitudes. Les doutes sont donc un signe de force et les certitudes un signe de faiblesse. La plupart des gens sont pourtant certains du contraire. - - - - - - - - - - - - - - - - - - Thoughts appear from doubts and die in convictions. Therefore, doubts are an indication of strength and convictions an indication of weakness. Yet, most people believe the opposite. [[alternative HTML version deleted]]
Seemingly Similar Threads
- Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
- Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
- Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)
- Using cforest on a hierarchically structured dataset
- Bug : Autocorrelation in sample drawn from stats::rnorm (hmh)