R/probit2link.R

Defines functions probit2link

probit2link<-function(x,tolink="logit",inverse=FALSE){
###
### Internal function to transform a probit link to a logit (or any other link)
###
### Arguments
###
### x = numeric value, vector, or matrix
### tolink = Character string defining the link to which we want to transform. So far, only "logit" has been implemented.
### inverse = Logical. Whether the inverse should be calculate or not. Default is FALSE.
###
### F. Guillaume Blanchet - September 2013
##########################################################################################
	if(tolink=="logit"){
		if(!inverse){
			res<- -sqrt(2)*inverfc((2*exp(x))/(1+exp(x))) # How can these be named ?
		}else{
			efrcBasis<-erfc(-x/sqrt(2))
			res<-log(-(efrcBasis)/(-2+efrcBasis))
		}
	}
	res
}

Try the HMSC package in your browser

Any scripts or data that you put into this service are public.

HMSC documentation built on May 2, 2019, 6:53 p.m.