mn.HT: Horvitz-Thompson estimator for the missing-data setup

Description Usage Arguments Details Value References Examples

View source: R/my-code.R

Description

This function implements the Horvitz-Thompson estimator of the mean outcome in the presence of missing data.

Usage

1
mn.HT(y, tr, p, X=NULL, bal=FALSE)

Arguments

y

A vector or a matrix of outcomes with missing data.

tr

A vector of non-missing indicators (=1 if y is observed or 0 if y is missing).

p

A vector of known or fitted propensity scores.

X

The model matrix for the propensity score model, assumed to be logistic (set X=NULL if p is known or treated to be so).

bal

Logical; if TRUE, the function is used for checking balance (see the details).

Details

Variance estimation is based on asymptotic expansions, allowing for misspecification of the propensity score model.

For balance checking with bal=TRUE, the input y should correpond to the covariates for which balance is to be checked, and the output mu gives the differences between the Horvitz-Thompson estimates and the overall sample means for these covariates.

Value

mu

The estimated mean(s) or, if bal=TRUE, their differences from the overall sample means.

v

The estimated variance(s) of mu.

References

Tan, Z. (2006) "A distributional approach for causal inference using propensity scores," Journal of the American Statistical Association, 101, 1619-1637.

Tan, Z. (2010) "Bounded, efficient and doubly robust estimation with inverse weighting," Biometrika, 97, 661-682.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
data(KS.data)
attach(KS.data)
z=cbind(z1,z2,z3,z4)
x=cbind(x1,x2,x3,x4)

#missing data
y[tr==0] <- 0

#logistic propensity score model, correct
ppi.glm <- glm(tr~z, family=binomial(link=logit))

X <- model.matrix(ppi.glm)
ppi.hat <- ppi.glm$fitted

#ppi.hat treated as known
out.HT <- mn.HT(y, tr, ppi.hat)
out.HT$mu
out.HT$v

#ppi.hat treated as estimated
out.HT <- mn.HT(y, tr, ppi.hat, X)
out.HT$mu
out.HT$v

#balance checking 
out.HT <- mn.HT(x, tr, ppi.hat, X, bal=TRUE)
out.HT$mu
out.HT$v

out.HT$mu/ sqrt(out.HT$v)   #t-statistic

iWeigReg documentation built on May 29, 2017, 1:08 p.m.