plot_DOPE: Plot a distribution of possible effects.

Description Usage Arguments Value Examples

View source: R/combined.R

Description

Takes the results of DOPE and plots the distributions with usually good defaults.

Usage

1
  plot_DOPE(output,vname,xmin=NULL,xmax=NULL,bw=NULL,shade=FALSE,include_naive = TRUE)

Arguments

output

data.frame of simulations, usually from DOPE

vname

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

xmin

numeric. Change the lower bound of plotted distribution.

xmax

numeric. Change the upper bound of plotted distribution.

bw

numeric. Set distribution bin width.

shade

logical. Shade the distribution according to R-squared values?

include_naive

logical. If it exists, indicate the naive regression coefficient?

Value

Returns a ggplot object of the simulated distribution of possible effects with numerical summaries.

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())
  
  plot_DOPE(dope,"V2")

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