R/ratioEstimatort.R

Defines functions ratioEstimatort

#Helper function to compute ratio Estimator total for bootstrapping

ratioEstimatort <- function(data, tau_x, indices){
  #data: 1st column:y, 2nd column:pis, rest: xsample_d
  d <- data[indices,]
  
  #y
  y <- d[,1]
  
  #pis 
  pis <- d[,2]
  
  #xsample
  xsample <- d[, 3]
  
  #Estimator
  tyHT <- horvitzThompson(y=y,pi=pis)$pop_total
  txHT <- horvitzThompson(y=xsample,pi=pis)$pop_total
  
  return(as.vector(tau_x/txHT*tyHT))
}

Try the mase package in your browser

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

mase documentation built on Nov. 28, 2023, 1:08 a.m.