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

Function Description: rasympower

Random draws from the bilateral power distribution, dasympower. By R. Chisholm.

Function Arguments:

ArgumentDefault Value

Function Source:


#
#
#
# doublenormal
#


#
# Simulate draws from a double normal
#

#
#
#

#
#
#

#
doublenormal=function(N=1e4,m=0,sd1=1,sd2=seq(0,2,by=.1))
{
n1=rnorm(N,m,sd1)
newsd=numeric()

for(i in 1:length(sd2))
{
n2=rnorm(N,n1,sd2[i])
newsd[i]=sd(n2)
}

sqrtdiff=1/sqrt(newsd-sd2)
plot(sd2,sqrtdiff)
cor=lm(sqrtdiff~sd2)
abline(cor)

return(data.frame(sd1,sd2,newsd))
}