sensitivity_plot: Plot how the distribution of possible effects changes with...

Description Usage Arguments Value Examples

View source: R/combined.R

Description

Takes the results of DOPE and plots how the uncertainty changes with various restrictions on the R-squared.

Usage

1
  sensitivity_plot(output,vname,adj=NULL)

Arguments

output

data.frame of simulations, usually from DOPE

vname

character or column index. Which distribution would you like to see?

adj

numeric. Set y-axis lower bound.

Value

Returns a ggplot object.

The solid dots indicate how the certainty in the effect changes as you say "the world is not that deterministic," reducing the maximum allowable R-squared. This reduces uncertainty relative to ignornace, indicated by the dashed line, at the cost of restrictiveness, indicated by the hollow points.

In the other direction, one might say that "the world is more deterministic than reflected in my model." This is represented by the crossed points and increases uncertainty until the lower pessimistic bound on effect certainty. The proportion of draws rejected by this lower thresholding is given by the filled diamonds.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
  set.seed(8675309)
  x_vars <- 5
  n_obs <- 1000
  corm <- RandomCormCPP(nvars = x_vars)
  X_mat <- MASS::mvrnorm(n_obs, rep(0,x_vars), Sigma = corm, empirical = TRUE)
  
  betas <- 1:x_vars
  
  y <- X_mat 
  
  dat <- data.frame(y,X_mat)
  
  mod <- lm(y ~ ., data=dat)
  dope <- DOPE(mod, nsims = 3000, n.cores = parallel::detectCores())
  
  sensitivity_plot(dope,"V2")

christophercschwarz/DOPE documentation built on April 10, 2020, 4:43 a.m.