declaredesign / designlibrary Goto Github PK
View Code? Open in Web Editor NEWLibrary of Research Designs
Home Page: https://declaredesign.org/library/
License: Other
Library of Research Designs
Home Page: https://declaredesign.org/library/
License: Other
Create a function that lists all available designers and designs with corresponding citation and description
simple_two_arm_designer(N=200, code=TRUE) does not return a N=200 design with the 200 substituted in, but instead returns a block of code where N is still a free variable. code=TRUE essentially ignores all the other arguments
Having a flag that changes the return type is usually weak design - see eg https://martinfowler.com/bliki/FlagArgument.html - you may be better off just having users do get_design_code(my_design)
, instead of copying the code=TRUE boilerplate into every single design.
c. When design gets made by a designer add in a declare_citation (made by declare design team, date etc, with possibly a brief description taken in from attributes
> names(simple_two_arm_design)
NULL
> simple_two_arm_design <- simple_two_arm_designer()
> names(simple_two_arm_design)
[1] "population" "potential_outcomes" "estimand" "assignment" "reveal" "estimator"
Would be nice to know what the name of the Rmd file is and where it got put.
See, for example, the otherwise very shoddy contribute_design
That check:
ie a vignette that lists every design ) designer in library with a citation and short summary (eg print get_analysis?). Citation especially important as new designs get added.
@nfultz has outlined the problem very nicely here
Basically, construct_design_code()
is using getSrcref()
to grab the source code of the designer functions in the package. That's great and works fine locally because we can set the project to run R CMD INSTALL --no-multiarch --with-keep.source DesignLibrary
by default.
The problem arises in two instances:
detach("package:DesignLibrary", unload = TRUE)
devtools::install_github("DeclareDesign/DesignLibrary")
library(DesignLibrary)
simple_two_arm_designer()
detach("package:DesignLibrary", unload = TRUE)
devtools::install_github("DeclareDesign/DesignLibrary", keep_source = TRUE)
library(DesignLibrary)
simple_two_arm_designer()
@nfultz is there a way to ensure that keep.source is always true when the package is built? Can we set R_KEEP_PKG_SOURCE=yes
as a side effect before installing the package on the user's computer, for example?
macartan proposed tags: estimation, measurement, experimental, observational, quasi-experimental, null design replication design etc
Please add designs by editing the comment below, using the following syntax:
- [ ] [Author(s), year](url_for_article.html)
It would be good to have a designer for CLPM - should be able to specify # of items , # of Subjects, # of waves, response family, and a matrix of model coefficients.
For a while the travis build has been breaking when it tries to run the design declaration in the crossover_designer()
The code that's breaking looks like this, and runs fine in local checks, but not when travis tries to run checks:
crossover_design <- declare_design(
population,
potential_outcomes_A,
potential_outcomes_B,
estimand,
assignment,
dplyr::mutate(A = as.numeric(Z %in% c("T2", "T4")),
B = as.numeric(Z %in% c("T3", "T4"))),
declare_reveal(YA,Z),
declare_reveal(YB,Z),
estimator_sat,
estimator_direct)
Travis error below and build log here.
Basically it doesn't seem to have access to dplyr. I've tried adding library(dplyr)
to testthat.R, and it's also in the travis.yml.
What am I doing wrong here? Something obvious I am missing, clearly.
> test_check(package = "DesignLibrary")
── 1. Error: (unknown) (@test_designers.R#13) ─────────────────────────────────
Could not evaluate step 6 as either a step or call.
1: the_designer() at testthat/test_designers.R:13
2: declare_design(population, potential_outcomes_A, potential_outcomes_B, estimand,
assignment, dplyr::mutate(A = as.numeric(Z %in% c("T2", "T4")), B = as.numeric(Z %in%
c("T3", "T4"))), declare_reveal(YA, Z), declare_reveal(YB, Z), estimator_sat,
estimator_direct) at /home/travis/build/DeclareDesign/DesignLibrary/DesignLibrary.Rcheck/00_pkg_src/DesignLibrary/R/crossover_designer.R:60
3: tryCatch(eval_tidy(qs[[i]]), error = function(e) tryCatch(callquos_to_step(qs[[i]],
qnames[[i]]), error = function(e) stop("Could not evaluate step ", i, " as either a step or call."))) at /tmp/RtmppZMCvC/devtools3fc36d3f8160/DeclareDesign/R/declare_design.R:151
4: tryCatchList(expr, classes, parentenv, handlers)
5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
6: value[[3L]](cond)
7: tryCatch(callquos_to_step(qs[[i]], qnames[[i]]), error = function(e) stop("Could not evaluate step ",
i, " as either a step or call.")) at /tmp/RtmppZMCvC/devtools3fc36d3f8160/DeclareDesign/R/declare_design.R:153
8: tryCatchList(expr, classes, parentenv, handlers)
9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: value[[3L]](cond)
11: stop("Could not evaluate step ", i, " as either a step or call.") at /tmp/RtmppZMCvC/devtools3fc36d3f8160/DeclareDesign/R/declare_design.R:154
Observational designs for descriptive inference
Experimental designs for descriptive inference
Experimental designs for causal inference
Observational designs for causal inference
Designers should all have code in attributes, our designers will do that recursively
Should be done on the fly when documenting package, if possible. If not we'll drop it.
systemfit package not currently loading with DesignLibrary installation
Add a simple stan model to the library ; priors enter as part of estimation declaration; compute frequentist properties of Bayesian design, eg Bayes risk given prior distribution but also given distribution provided in declare_population
Hi all -- trying to use simple_two_arm_designer()
, but getting an error after a clean install of master branch. I see:
> library(DesignLibrary)
> simple_two_arm_designer(N = 100)
Error in construct_design_code(simple_two_arm_designer, match.call.defaults()) :
could not find opening tag in simple_two_arm_designer
What am I doing wrong?
Designer | Priority | Assignee | Function | Documentation | Shiny | Vignette | Merged |
---|---|---|---|---|---|---|---|
adaptive_trial_designer | |||||||
Clara | x | x | |||||
bayes_designer | o | ||||||
block_cluster_two_arm_designer | Lily | x | x | x | x | ||
cluster_sampling_designer | Clara | x | x | x | x | x | |
conjoint_template_designer | o | ||||||
crossover_designer | Jasper | x | x | x | x | x | |
difference_in_differences_designer | o | ||||||
election_forecast_designer | o | ||||||
encouragement_designer | |||||||
fixed_allocation_designer | o | ||||||
instrumental_variables_designer | Macartan | x | |||||
list_experiment_designer | o | ||||||
matching_designer | o | ||||||
mediation_analysis_designer | Lily | x | |||||
multi_arm_trial_designer | Lily | x | x | x | x | ||
multiple comparisons_designer | |||||||
parallel_for_mediation_designer | |||||||
Jasper | |||||||
randomized_saturation_designer | Jasper | ||||||
post_stratification_designer | |||||||
pretest_posttest_designer | Clara | x | x | x | x | x | |
process_tracing_designer | o | ||||||
randomized_response_designer | Lily/Clara | x | x | x | x | x | |
regression_discontinuity_designer | x | x | x | x | x | ||
respondent_driven_sampling_designer | |||||||
selective_trial_designer | o | ||||||
simple_random_sampling_designer | o | ||||||
simple_spillover_designer | Macartan | x | x | x | x | x | |
simple_two_arm_designer | x | x | x | x | x | ||
stan designer | Lily | o | |||||
stepped_wedge_designer | |||||||
synthetic_control_designer | |||||||
time_series_cross_sectional_designer | o | ||||||
topic_analysis_designer | |||||||
two_sided_noncompliance_designer | o | ||||||
two_way_factorial_designer | x | x | x | x | x | ||
weighted_sampling_designer | o | ||||||
Current function is in design/R/helpers
It essentially puts the ses in parentheses under the diagnosands and does rounding and lets you add names if you use the defaults. Looks nice after kable.
reshape_diagnosis <- function(diagnosis,
digits = 2,
col.names = NULL,
default.names = c("Estimator", "Coef Name", "Estimand", "Bias", "RMSE", "Power", "Coverage", "Mean(Estimate)", "sd(Estimate)", "Mean(se)", "Type S", "Mean(Estimand)")
) {
At the moment when make_vignette()
doesn't have any front_text passed to it, it looks up the help file for the designer and takes it from there. That's nice functionality for automatically generating vignettes for any designers we have contributed with full documentation, but we need to think about the (hopefully common) use case in which a user is adding a designer and a vignette.
In such cases, we could just error and say, either you need to add a description to the documentation of your designer, or you need to specify front_text? We could also just generate a vignette with no front_text (also a nice alternative).
@medinali what do you think is the best approach? My temptation is for make_vignette()
to look for front text firstly in the function's formal arguments (front_text
), then in the help file, and if it fails to find any front text anywhere, then it just builds a vignette with no front text, and perhaps some boilerplate (e.g., "user has not provided a description of this desiger").
We have a method that is working well but can incorporate other methods (i.e., using the ugly duckling paste0 approach).
Need to write a separate vignette on these approaches. Should be clear about format of code object (vector of strings, each element is a verbatim line of code).
Using new guide, with seealso, keywords, author attribution, etc.
download_design()
functioni.e., we need to have a little guide / reminder for how to use roxygenize (document package in rstudio or use function)
Travis says:
Quitting from lines 34-35 (crossover_designer.Rmd)
Error: processing vignette 'crossover_designer.Rmd' failed with diagnostics:
Please only send design objects to diagnose_design.
Execution halted
@medinali would you mind taking a look at some point this week?
Related designers listed in the help for given designers (see also cluster_factorial_designer...)
see enhancing navigation, here for description of how to do this by creating "families" of designs, or by using seealso
Can't see how to issue on website so issuing this here.
A wishlist for the overview table (much of which I realize may be hard and will require plugins):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.