R/simulateObserved.R

simulateObserved <-
function (cdf)
{
	n = length (cdf)
	tmp = runif (1, min=0, max=1)
	obs = 1
	for (k in 2:n)
	{
		if (tmp>cdf[k-1] & tmp<=cdf[k])
			obs = k
	}
	return (obs)	
}

Try the DIRECT package in your browser

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

DIRECT documentation built on Sept. 8, 2023, 5:45 p.m.