Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.



File: utilities/distributions.r

View File Source Download File No help file available

Function: rmixnorm

Function Description: rmixnorm

Random draw on the mixed normal distribution.

Function Arguments:

ArgumentDefault Value
n
mean1
mean2
sd1
sd2
f

Function Source:

rmixnorm=function(n,mean1,mean2,sd1,sd2,f)
{
r=runif(n)
part1=which(r>f)
part2=which(r<=f)

y1=rnorm(length(part1),mean=mean1,sd=sd1)
y2=rnorm(length(part2),mean=mean2,sd=sd2)

return(c(y1,y2))
}