[R] Bls: RE: example

Jim Lemon jim at bitwrit.com.au
Sun Apr 28 07:51:48 CEST 2013


On 04/27/2013 11:32 PM, triutami.iut at gmail.com wrote:
> Dear Sir,
> Yes, I want to generate the data by two Gaussian but mean from one of them generatated from polar its coordinates. I am confused about the algorithm? I know how to generate two Gaussian data with certain mean&covariance matrix using mvnorm but what about mean from its polar coordinates?
> Thanks for your help.
>
Hi Iut,
If you mean transforming a normal (Gaussian) variate into polar 
coordinates, it is not too hard:

polar.norm<-180+rnorm(100,0,10)

You can alter the "mean" point by changing the constant value and the 
extent to which the tails wrap around the circles with the third 
argument to "rnorm". Be aware that large negative and positive values 
will "wrap around" to the polar values of the opposite sign depending 
upon the variance of the normal variate.

Jim



More information about the R-help mailing list