adjusted_estimate: Bias-adjusted estimates, standard-errors and t-values

Description Usage Arguments Value References Examples

View source: R/bias_functions.R

Description

These functions compute bias adjusted estimates (adjusted_estimate), standard-errors (adjusted_se) and t-values (adjusted_t), given a hypothetical strength of the confounder in the partial R2 parameterization.

The functions work either with an lm object, or directly passing in numerical inputs, such as the current coefficient estimate, standard error and degrees of freedom.

Usage

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
adjusted_estimate(...)

## S3 method for class 'lm'
adjusted_estimate(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, ...)

## S3 method for class 'numeric'
adjusted_estimate(estimate, se, dof, r2dz.x, r2yz.dx, reduce = TRUE, ...)

adjusted_se(...)

## S3 method for class 'numeric'
adjusted_se(se, dof, r2dz.x, r2yz.dx, ...)

## S3 method for class 'lm'
adjusted_se(model, treatment, r2dz.x, r2yz.dx, ...)

adjusted_t(...)

## S3 method for class 'lm'
adjusted_t(model, treatment, r2dz.x, r2yz.dx, reduce = TRUE, h0 = 0, ...)

## S3 method for class 'numeric'
adjusted_t(estimate, se, dof, r2dz.x, r2yz.dx, reduce = TRUE, h0 = 0, ...)

adjusted_partial_r2(...)

## S3 method for class 'numeric'
adjusted_partial_r2(
  estimate,
  se,
  dof,
  r2dz.x,
  r2yz.dx,
  reduce = TRUE,
  h0 = 0,
  ...
)

## S3 method for class 'lm'
adjusted_partial_r2(
  model,
  treatment,
  r2dz.x,
  r2yz.dx,
  reduce = TRUE,
  h0 = 0,
  ...
)

bias(...)

## S3 method for class 'numeric'
bias(se, dof, r2dz.x, r2yz.dx, ...)

## S3 method for class 'lm'
bias(model, treatment, r2dz.x, r2yz.dx, ...)

relative_bias(...)

## S3 method for class 'lm'
relative_bias(model, treatment, r2dz.x, r2yz.dx, ...)

## S3 method for class 'numeric'
relative_bias(estimate, se, dof, r2dz.x, r2yz.dx, ...)

rel_bias(r.est, est)

Arguments

...

Arguments passed to other methods. First argument should either be an lm model with the outcome regression or a numeric vector with the coefficient estimate.

model

An lm object with the outcome regression.

treatment

A character vector with the name of the treatment variable of the model.

r2dz.x

Hypothetical partial R2 of unobserved confounder Z with treatment D, given covariates X.

r2yz.dx

Hypothetical partial R2 of unobserved confounder Z with outcome Y, given covariates X and treatment D.

reduce

Should the bias adjustment reduce or increase the absolute value of the estimated coefficient? Default is TRUE.

estimate

Coefficient estimate.

se

Standard error of the coefficient estimate.

dof

Residual degrees of freedom of the regression.

h0

Null hypothesis for computation of the t-value. Default is zero.

r.est

restricted estimate. A numerical vector.

est

unrestricted estimate. A numerical vector.

Value

Numeric vector with bias, adjusted estimate, standard error, or t-value.

References

Cinelli, C. and Hazlett, C. (2020), "Making Sense of Sensitivity: Extending Omitted Variable Bias." Journal of the Royal Statistical Society, Series B (Statistical Methodology).

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
# loads data
data("darfur")

# fits model
model <- lm(peacefactor ~ directlyharmed + age +
                          farmer_dar + herder_dar +
                           pastvoted + hhsize_darfur +
                           female + village, data = darfur)

# computes adjusted estimate for confounder with  r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_estimate(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)

# computes adjusted SE for confounder with  r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_se(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)

# computes adjusted t-value for confounder with  r2dz.x = 0.05, r2yz.dx = 0.05
adjusted_t(model, treatment = "directlyharmed", r2dz.x = 0.05, r2yz.dx = 0.05)

# Alternatively, pass in numerical values directly.
adjusted_estimate(estimate = 0.09731582, se = 0.02325654,
                  dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)

adjusted_se(estimate = 0.09731582, se = 0.02325654,
            dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)

adjusted_t(estimate = 0.09731582, se = 0.02325654,
           dof = 783, r2dz.x = 0.05, r2yz.dx = 0.05)

sensemakr documentation built on Oct. 8, 2021, 9:10 a.m.