sensemakr: Senstivity abalysis of linear models

Description Usage Arguments Value References Examples

View source: R/sensemakr.R

Description

Description.

Usage

1
2
3
4
5
sensemakr(model, treatment, benchmarks, ...)

## S3 method for class 'lm'
sensemakr(model, treatment, benchmarks = NULL,
  group_list = NULL)

Arguments

model

the model.

treatment

character vector with the treatment variable.

benchmarks

character vector with the covariates for benchmarking.

...

extra arguments

group_list

a list of character vectors where elements within one vector are terms that should be grouped.

Value

The function returns an object of class 'sensemakr' which is a list with the main results for sensitivity analysis, namely:

Treat Stats

A list with the main statistics of the treatment estiamate which are needed for computing the sensitivity.

  • name

  • estimate

  • se

  • df

Benchmarks

Benchmark values for the covariates listed on paramter X

  • R2 a data.frame with becnhmark values R2.

  • SD a data.frame with benchmark values

  • natural a data.frame with...

References

Cite paper(s)

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
31
32
33
34
rm(list = ls())

# library
library(sensemakr)

# loads data
data("darfur")

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

# benchmark variables
X = c("herder_dar", "female", "age", "pastvoted", "farmer_dar")

# runs benchmarking etc
sense <- sensemakr(model, treatment = "directlyharmed", benchmarks = X)

# plots

## contour plot
plot1_data <- plot(sense)
plot2_data <- plot(sense, contour = "t-value")
plot3_data <- plot(sense, contour = "lower bound")
plot4_data <- plot(sense, contour = "upper bound")

## worst-case plot
plot5_data <- plot(sense, type = "worst-case")

# testing verbal outputs
interpret(sense)
interpret(sense, q = 0.6)

summary(sense)

statsccpr/sensemakr documentation built on May 30, 2019, 10:41 a.m.