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: logistic.standard

Function Description: logistic.standard

This is standard logistic function, but with asymptote and basement allowed. The latter are only implemented if extra parameters are passed. Moved from calc.surviv.r on 25 July 2010 to provide the standard logistic.

Function Arguments:

ArgumentDefault Value
x
param
logFALSE
...

Function Source:

logistic.standard=function(x,param,log=FALSE,...)
{
x=as.matrix(x)
nopredictor=dim(x)[2]
a=param[1]
b=param[2:(nopredictor+1)]

asymp=IfElse(length(param)>nopredictor+1,param[nopredictor+2],1)
basement=IfElse(length(param)>nopredictor+2,param[nopredictor+3],0)

X=x%*%b
pwr=a+X
y=invlogit(pwr)
prob=y*(asymp-basement)+basement

infinite.pos=which(is.infinite(exp(pwr)))
prob[infinite.pos]=basement+asymp

if(log) return(log(prob))
return(prob)
}