boxMuller: The Box-Muller transformation

Description Usage Arguments Details Value Examples

View source: R/homework.R

Description

Takes two samples from the uniform distribution on the interval [0,1] and maps them to two standard, normally distributed samples.

Usage

1
boxMuller(n = 1)

Arguments

n

The number of samples to be returned.

Details

Uses the following equations to generate the two standard, normally distributed samples:

X1=√{−2log(U_1)}cos(2π U_2)

X2=√{−2log(U_1)}sin(2π U_2)

Value

A vector of samples from the standard normal distribution.

Examples

1
boxMuller(500)

loublanpain/BMI585FinalProjectLouBlanpain documentation built on Dec. 21, 2021, 11:49 a.m.