is here
All amazing and friendly types! Many are previous CU. A number were students in this class not long ago!
Teams
.html
via .qmd
or .Rmd
Some examples:
pacman
Nothing local, everything relative: so please do not include hardcoded paths to your computer
First best: if someone has access to your .Rmd
/.qmd
file they can hit render or compile and the whole thing reproduces first time.
But: often you need ancillary files for data and code. That’s OK but aims should still be that with a self contained folder someone can open a master.Rmd
file, hit compile and get everything. I usually have an input
and an output
subfolder.
Resources and ideas from the institute for replication https://i4replication.org/reproducibility.html
Longer term goal: replication package to make it wasier to access and share replications like these
Sample TOC:
Don’t skip the big picture.
See: How to critique: https://macartan.github.io/teaching/how-to-critique
Biggest message: be probing but be sympthetic
…and then use the DAG to describe new analysis, e.g. questions regarding:
If you fail to replicate:
Two distinct overarching goals:
e.g.
Home ground dominance. Holding the original M constant (i.e., the home ground of the original study), if you can show that a new answer strategy A’ yields better diagnosands than the original A, then A’ can be justified by home ground dominance.
Robustness to alternative models. A second justification for a change in answer strategy is that you can show that a new answer strategy is robust to both the original model M and a new, also plausible, M’.
Q&A
Q: Is my research design good?
A: Well let’s simulate it to see how it performs.
Q: What should I put in the simulation?
A: All elements of a research design.
Q: What are the elements of a research design?
A: M! I! D! A!
Telling the computer what M, I, D, and A are.
Estimating “diagnosands” like power, bias, rmse, error rates, ethical harm, amount learned.
Fine-tuning features of the data and answer strategies to understand how they change the diagnosands
declare_model()
declare_inquiry()
declare_assignment()
declare_measurement()
declare_inquiry
declare_estimator()
and there are more declare_
functions!
draw_data(design)
draw_estimands(design)
draw_estimates(design)
get_estimates(design, data)
run_design(design)
, simulate_design(design)
diagnose_design(design)
redesign(design, N = 200)
design |> redesign(N = c(200, 400)) |>
diagnose_designs()
compare_designs()
, compare_diagnoses()
https://raw.githubusercontent.com/rstudio/cheatsheets/master/declaredesign.pdf
You now have a two arm design object in memory!
If you just type design
it will run the design—a good check to make sure the design has been declared properly.
ID | U | Y_Z_0 | Y_Z_1 | Z | Y |
---|---|---|---|---|---|
001 | 0.0241755 | 0.0241755 | 0.5241755 | 0 | 0.0241755 |
002 | -0.2978318 | -0.2978318 | 0.2021682 | 0 | -0.2978318 |
003 | -0.2818823 | -0.2818823 | 0.2181177 | 1 | 0.2181177 |
004 | 1.7400711 | 1.7400711 | 2.2400711 | 1 | 2.2400711 |
005 | 0.6893446 | 0.6893446 | 1.1893446 | 1 | 1.1893446 |
006 | -0.3798324 | -0.3798324 | 0.1201676 | 1 | 0.1201676 |
design | sim_ID | inquiry | estimand | estimator | term | estimate | std.error | statistic | p.value | conf.low | conf.high | df | outcome |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
design | 1 | ate | 0.5 | estimator | Z | 0.25 | 0.22 | 1.12 | 0.27 | -0.19 | 0.68 | 98 | Y |
design | 2 | ate | 0.5 | estimator | Z | 0.61 | 0.18 | 3.33 | 0.00 | 0.25 | 0.98 | 98 | Y |
design | 3 | ate | 0.5 | estimator | Z | 0.26 | 0.23 | 1.16 | 0.25 | -0.19 | 0.71 | 98 | Y |
Mean Estimate | Bias | SD Estimate | RMSE | Power | Coverage |
---|---|---|---|---|---|
0.47 | -0.03 | 0.21 | 0.21 | 0.67 | 0.92 |
(0.02) | (0.02) | (0.01) | (0.02) | (0.05) | (0.03) |
diagnosand | mean_1 | mean_2 | mean_difference | conf.low | conf.high |
---|---|---|---|---|---|
mean_estimand | 0.50 | 0.50 | 0.00 | 0.00 | 0.00 |
mean_estimate | 0.51 | 0.49 | -0.03 | -0.06 | 0.01 |
bias | 0.01 | -0.01 | -0.03 | -0.06 | 0.01 |
sd_estimate | 0.30 | 0.20 | -0.10 | -0.13 | -0.08 |
rmse | 0.30 | 0.20 | -0.10 | -0.13 | -0.08 |
power | 0.43 | 0.67 | 0.24 | 0.18 | 0.31 |
coverage | 0.94 | 0.95 | 0.01 | -0.01 | 0.04 |