LR.inference: LR.inference

Description Usage Arguments Value Examples

View source: R/LR.inference.R

Description

Function that gives inference for logistic regression plug-in estimators of ATE and Blip Variance.

Usage

1
LR.inference(W, A, Y, Qform, alpha = 0.05, simultaneous.inference = FALSE)

Arguments

W,

matrix or data.frame of covariates

A,

a binary vector of treatment assignments

Y,

a binary vector of outcomes

Qform,

a formula for Y in terms of the covariates as input in glm

alpha,

significance level for the (1-alpha)100 percent CI's. 0.05 is default

simultaneous.inference,

TRUE if user wants simultaneous confidence bounds for both ATE and blip variance at level alpha. default is FALSE

Value

if simultaneous.inference is specified as TRUE then will return a vector giving pt estimate, left and right bound for ATE, simultaneous ATE CI, blip variance, and simultaneous blip variance. Otherwise gives pt estimate, left and right bound for ATE and blip variance.

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
# using built-in package functions, g0_linear and define Q0_linear to specify
# pscore and outcome model probabilities
g0_linear
Q0_linear = function(A,W1,W2,W3,W4) plogis(A + W1 + W2 + A*(W3 + W4) + W3 + W4)

# get a randomly drawn dataframe under the specified model
data = gendata(1000, g0_linear, Q0_linear)

# get the truth
truth = get.truth(g0_linear, Q0_linear)
truth

# well-specified model
Qform = formula("Y ~ W1 + W2 + A*(W3 + W4)")

# specifying the covariates, treatment and outcome
W = data[,2:5]
A = data$A
Y = data$Y

# should cover each truth 95 percent of the time.
info = LR.inference(W=W,A=A,Y=Y,Qform=Qform, alpha = .05)
info

# should cover each truth 95 percent of the time and both truths
# simultaneously 95 percent of the time for the simultaneous CI's
info1 = LR.inference(W=W,A=A,Y=Y,Qform=Qform, alpha = .05, 
                    simultaneous.inference = TRUE)
info1

jlstiles/sim.papers documentation built on May 23, 2019, 5:03 a.m.