R/gendist.R

Defines functions gendist

Documented in gendist

gendist <-
function(Ys,perms,X=NULL,Ypre=NULL,prob=NULL,HT=FALSE) {

	numiter <- ncol(perms)
	distout <- rep(NA,numiter)
	
	if (is.null(prob)) {
		prob <- genprob(perms)
		warning("Generating probabilities from permutation matrix.")
	}

	# switch to apply?

	for (iter in 1:numiter) {
		Zri <- perms[,iter]
		Yri <- Ys$Y0
		Yri[Zri==1] <- Ys$Y1[Zri==1]

		distout[iter] <- estate(Yri,Zri,X,Ypre,prob,HT)
		}		
		
	return(distout)
	}

Try the ri package in your browser

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

ri documentation built on May 2, 2019, 6:51 a.m.