R/getVar.R

Defines functions getVar

Documented in getVar

getVar <-
function(covs, tIndex){

  ## create treatment vector
  treat = numeric(nrow(covs))
  treat[tIndex] = 1
  
  ## model propensity score, calculate variance
  psModel = glm(treat~., family=binomial('logit'), data=covs)
  psVar = var(psModel$fitted)
  return(psVar)
}

Try the PropScrRand package in your browser

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

PropScrRand documentation built on April 24, 2022, 1:05 a.m.