R/dtri.R

"dtri" <-

function(x, a = 0., b = a + 2.)



{



	x <- (x - a)/(b - a)



	# zero out density beyond range of support.



	temp <- (2. * ifelse(x < 0.5, x, 1. - x))/(b - a)



	ifelse(temp < 0., 0., temp)



}

Try the Rlab package in your browser

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

Rlab documentation built on May 5, 2022, 1:05 a.m.