R/Qhat.R

Defines functions Qhat

Documented in Qhat

Qhat <- function(y, 
                 a, 
                 g, 
                 wgt = NULL){  

  pai <- table(a) / length(a)

  ind <- a == g

  if( is(wgt, "NULL") ) wgt <- numeric(length(ind)) + 1.0

  multiplier <- wgt * ind / pai[as.character(a)]

  Q <- sum( y * multiplier ) / sum( multiplier )

  return(Q)

}

Try the OTRselect package in your browser

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

OTRselect documentation built on Nov. 25, 2023, 1:08 a.m.