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: dmixnorm

Function Description: dmixnorm

Mixed normal distribution. The parameter f is the probability of following the first, with mean1 and sd1; 1-f is the probability for the second normal

Function Arguments:

ArgumentDefault Value
x
mean1
mean2
sd1
sd2
f
logFALSE

Function Source:

dmixnorm=function(x,mean1,mean2,sd1,sd2,f,log=FALSE)
{
y1=dnorm(x,mean=mean1,sd=sd1)
y2=dnorm(x,mean=mean2,sd=sd2)

result=f*y1+(1-f)*y2

if(log) return(log(result))
else return(result)
}