xt_wang@cs.concordia.ca
2004-Aug-06 01:34 UTC
[R] question about random variable generating function
Hello, everybody, I have questions about functions in chapter 5: The R API:entry points for c code in "writing R Extensions". They are : 1. double rnorm(double mu, double sigma) 2. double norm_rand() question is: which of the above two functions can be used to generate a random variable of normal distribution? If norm_rand() is the function, how can I generate random variables whose mean=0 and standard deviation=5? As I know, it is used to generate a random variable which mean=0,std=1. I will appreciate very much if anybody can help me. Thanks in advance! Maggie
Alec Stephenson
2004-Aug-06 01:50 UTC
[R] question about random variable generating function
Both: norm_rand generates a standard normal, rnorm allows mean and standard deviation arguments, so using the latter is easiest. Alec Stephenson Department of Statistics Macquarie University NSW 2109, Australia>>> <xt_wang at cs.concordia.ca> 08/06/04 11:34am >>>Hello, everybody, I have questions about functions in chapter 5: The R API:entry points for c code in "writing R Extensions". They are : 1. double rnorm(double mu, double sigma) 2. double norm_rand() question is: which of the above two functions can be used to generate a random variable of normal distribution? If norm_rand() is the function, how can I generate random variables whose mean=0 and standard deviation=5? As I know, it is used to generate a random variable which mean=0,std=1. I will appreciate very much if anybody can help me. Thanks in advance! Maggie ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html