[R] rnorm() converted to daily

Meyners, Michael, LAUSANNE, AppliedMathematics Michael.Meyners at rdls.nestle.com
Fri Apr 17 10:21:41 CEST 2009


SD in y is more than 15 times (!!!) larger than in x and z,
respectively, and hence SD of the mean y is also larger. 100,000 values
are not enough to stabilize this. You could have obtained 0.09 or even
larger as well. Try y with different seeds, y varies much more than x
and z do. Or check the variances: 

var.x <- var(replicate(100, mean( rnorm( 100000, mean=0.08, sd=0.25 ))))
var.y <- var(replicate(100, mean( rnorm( 100000, mean=(0.08/252),
sd=(0.25/sqrt(252)) )) * 252))
var.z <- var(replicate(100, mean( rnorm( 100000, mean=(0.08/252),
sd=0.001 )) * 252))

I guess what you are doing wrong is assuming that 0.25/sqrt(252) is
similar to 0.25/252, the latter being close so 0.001, while the former
is obviously not. Try to replace 0.25 in y by 0.0158, than you should be
close enough.

HTH, Michael

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Ken-JP
Sent: Freitag, 17. April 2009 09:26
To: r-help at r-project.org
Subject: [R] rnorm() converted to daily



yearly 8% drift, 25% sd

why are x and y so different (x and z look ok)?

Does this have something to do with biases due to the relationship
between population and sample-estimates as a function of n samples and
sd?  Or am I doing something wrong?

-----------------------------------------------------------------------

set.seed( 1 );
x <- mean( rnorm( 100000, mean=0.08, sd=0.25 )); set.seed( 1 ); y <-
mean( rnorm( 100000, mean=(0.08/252), sd=(0.25/sqrt(252)) )) * 252;
set.seed( 1 ); z <- mean( rnorm( 100000, mean=(0.08/252), sd=0.001 )) *
252; #
-----------------------------------------------------------------------
x    # 0.07943898
y    # 0.07109407
z    # 0.07943449



--
View this message in context:
http://www.nabble.com/rnorm%28%29-converted-to-daily-tp23092444p23092444
.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at 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.




More information about the R-help mailing list