diff --git a/DESCRIPTION b/DESCRIPTION index 9bdf34d..d90b9f7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,7 @@ Package: vizdraws Title: Visualize Draws from the Prior and Posterior Distributions Version: 0.9 +Date: 2019-07-9 Authors@R: c( person("Ignacio", "Martinez", email = "ignacio@protonmail.com", role = c("aut", "cre")), person("Linus", "Marco", email = "lmarco163@gmail.com", role = "aut"), diff --git a/docs/articles/index.html b/docs/articles/index.html new file mode 100644 index 0000000..c964081 --- /dev/null +++ b/docs/articles/index.html @@ -0,0 +1,135 @@ + + + + + + + + +Articles • vizdraws + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
+

All vignettes

+

+ + +
+
+
+ + +
+ + + + + + diff --git a/docs/articles/introduction.html b/docs/articles/introduction.html new file mode 100644 index 0000000..ed1aca9 --- /dev/null +++ b/docs/articles/introduction.html @@ -0,0 +1,144 @@ + + + + + + + +Introduction • vizdraws + + + + + + + + + +
+
+ + + +
+
+ + + + +
+

+Draws from the prior distribution

+
library(vizdraws)
+set.seed(1982)
+vizdraws(prior = rnorm(n = 10000, mean = 0, sd = 1), xlim = c(-3,3))
+
+

+
+
+
+

+Updating the prior

+
vizdraws(prior = rnorm(n = 10000, mean = 0, sd = 1),
+                       posterior = rnorm(n = 10000, mean = 0.3, sd = 0.5),
+                       xlim = c(-3,3))
+
+

+
+
+
+

+Meanimum meaningful effect

+
vizdraws(prior = rnorm(n = 10000, mean = 0, sd = 1),
+                       posterior = rnorm(n = 10000, mean = 0.3, sd = 0.5),
+                       xlim = c(-3,3), 
+                       MME = 0.1)
+
+

+
+
+
+ + + +
+ + + +
+ + + + + diff --git a/docs/authors.html b/docs/authors.html new file mode 100644 index 0000000..bb6bf0c --- /dev/null +++ b/docs/authors.html @@ -0,0 +1,160 @@ + + + + + + + + +Citation and Authors • vizdraws + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +

Martinez I, Thal D, Marco L (2019). +vizdraws: Interactive visualization for the prior and posterior distribution. +R package version 0.9, https://CRAN.R-project.org/package=vizdraws. +

+
@Manual{,
+  title = {{vizdraws}: Interactive visualization for the prior and posterior distribution},
+  author = {Ignacio Martinez and Dan Thal and Linus Marco},
+  year = {2019},
+  note = {R package version 0.9},
+  url = {https://CRAN.R-project.org/package=vizdraws},
+}
+ + +
    +
  • +

    Ignacio Martinez. Author, maintainer. +

    +
  • +
  • +

    Linus Marco. Author. +

    +
  • +
  • +

    Dan Thal. Author. +

    +
  • +
+ +
+ +
+ + + +
+ + + + + + diff --git a/docs/docsearch.css b/docs/docsearch.css new file mode 100644 index 0000000..e5f1fe1 --- /dev/null +++ b/docs/docsearch.css @@ -0,0 +1,148 @@ +/* Docsearch -------------------------------------------------------------- */ +/* + Source: https://github.com/algolia/docsearch/ + License: MIT +*/ + +.algolia-autocomplete { + display: block; + -webkit-box-flex: 1; + -ms-flex: 1; + flex: 1 +} + +.algolia-autocomplete .ds-dropdown-menu { + width: 100%; + min-width: none; + max-width: none; + padding: .75rem 0; + background-color: #fff; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, .1); + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); +} + +@media (min-width:768px) { + .algolia-autocomplete .ds-dropdown-menu { + width: 175% + } +} + +.algolia-autocomplete .ds-dropdown-menu::before { + display: none +} + +.algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { + padding: 0; + background-color: rgb(255,255,255); + border: 0; + max-height: 80vh; +} + +.algolia-autocomplete .ds-dropdown-menu .ds-suggestions { + margin-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion { + padding: 0; + overflow: visible +} + +.algolia-autocomplete .algolia-docsearch-suggestion--category-header { + padding: .125rem 1rem; + margin-top: 0; + font-size: 1.3em; + font-weight: 500; + color: #00008B; + border-bottom: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--wrapper { + float: none; + padding-top: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { + float: none; + width: auto; + padding: 0; + text-align: left +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content { + float: none; + width: auto; + padding: 0 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--content::before { + display: none +} + +.algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { + padding-top: .75rem; + margin-top: .75rem; + border-top: 1px solid rgba(0, 0, 0, .1) +} + +.algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { + display: block; + padding: .1rem 1rem; + margin-bottom: 0.1; + font-size: 1.0em; + font-weight: 400 + /* display: none */ +} + +.algolia-autocomplete .algolia-docsearch-suggestion--title { + display: block; + padding: .25rem 1rem; + margin-bottom: 0; + font-size: 0.9em; + font-weight: 400 +} + +.algolia-autocomplete .algolia-docsearch-suggestion--text { + padding: 0 1rem .5rem; + margin-top: -.25rem; + font-size: 0.8em; + font-weight: 400; + line-height: 1.25 +} + +.algolia-autocomplete .algolia-docsearch-footer { + width: 110px; + height: 20px; + z-index: 3; + margin-top: 10.66667px; + float: right; + font-size: 0; + line-height: 0; +} + +.algolia-autocomplete .algolia-docsearch-footer--logo { + background-image: url("data:image/svg+xml;utf8,"); + background-repeat: no-repeat; + background-position: 50%; + background-size: 100%; + overflow: hidden; + text-indent: -9000px; + width: 100%; + height: 100%; + display: block; + transform: translate(-8px); +} + +.algolia-autocomplete .algolia-docsearch-suggestion--highlight { + color: #FF8C00; + background: rgba(232, 189, 54, 0.1) +} + + +.algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { + box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) +} + +.algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { + background-color: rgba(192, 192, 192, .15) +} diff --git a/docs/docsearch.js b/docs/docsearch.js new file mode 100644 index 0000000..b35504c --- /dev/null +++ b/docs/docsearch.js @@ -0,0 +1,85 @@ +$(function() { + + // register a handler to move the focus to the search bar + // upon pressing shift + "/" (i.e. "?") + $(document).on('keydown', function(e) { + if (e.shiftKey && e.keyCode == 191) { + e.preventDefault(); + $("#search-input").focus(); + } + }); + + $(document).ready(function() { + // do keyword highlighting + /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ + var mark = function() { + + var referrer = document.URL ; + var paramKey = "q" ; + + if (referrer.indexOf("?") !== -1) { + var qs = referrer.substr(referrer.indexOf('?') + 1); + var qs_noanchor = qs.split('#')[0]; + var qsa = qs_noanchor.split('&'); + var keyword = ""; + + for (var i = 0; i < qsa.length; i++) { + var currentParam = qsa[i].split('='); + + if (currentParam.length !== 2) { + continue; + } + + if (currentParam[0] == paramKey) { + keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); + } + } + + if (keyword !== "") { + $(".contents").unmark({ + done: function() { + $(".contents").mark(keyword); + } + }); + } + } + }; + + mark(); + }); +}); + +/* Search term highlighting ------------------------------*/ + +function matchedWords(hit) { + var words = []; + + var hierarchy = hit._highlightResult.hierarchy; + // loop to fetch from lvl0, lvl1, etc. + for (var idx in hierarchy) { + words = words.concat(hierarchy[idx].matchedWords); + } + + var content = hit._highlightResult.content; + if (content) { + words = words.concat(content.matchedWords); + } + + // return unique words + var words_uniq = [...new Set(words)]; + return words_uniq; +} + +function updateHitURL(hit) { + + var words = matchedWords(hit); + var url = ""; + + if (hit.anchor) { + url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; + } else { + url = hit.url + '?q=' + escape(words.join(" ")); + } + + return url; +} diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..2122abe --- /dev/null +++ b/docs/index.html @@ -0,0 +1,140 @@ + + + + + + + +Visualize Draws from the Prior and Posterior Distributions • vizdraws + + + + + + + + + +
+
+ + + +
+
+ + + + + +
+ +

vizdraws allows you to create interactive visualizations of draws from a prior and posterior distribution.

+
+

+Example

+

This is a basic example which shows you how to solve a common problem:

+
library(vizdraws)
+set.seed(9782)
+vizdraws(prior = rnorm(10000, 0, 1), posterior = rnorm(10000, 1.1, 0.5), MME = 0.5, threshold = 0.8)
+
+Posterior distribution

Posterior distribution

+
+
+
+
+

+Notes

+

The bell-curve icon was created by Davo Sime.

+
+
+ + + +
+ + + +
+ + + + + diff --git a/docs/link.svg b/docs/link.svg new file mode 100644 index 0000000..88ad827 --- /dev/null +++ b/docs/link.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css new file mode 100644 index 0000000..c03fb08 --- /dev/null +++ b/docs/pkgdown.css @@ -0,0 +1,236 @@ +/* Sticky footer */ + +/** + * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ + * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css + * + * .Site -> body > .container + * .Site-content -> body > .container .row + * .footer -> footer + * + * Key idea seems to be to ensure that .container and __all its parents__ + * have height set to 100% + * + */ + +html, body { + height: 100%; +} + +body > .container { + display: flex; + height: 100%; + flex-direction: column; + + padding-top: 60px; +} + +body > .container .row { + flex: 1 0 auto; +} + +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + color: #666; + display: flex; + flex-shrink: 0; +} +footer p { + margin-bottom: 0; +} +footer div { + flex: 1; +} +footer .pkgdown { + text-align: right; +} +footer p { + margin-bottom: 0; +} + +img.icon { + float: right; +} + +img { + max-width: 100%; +} + +/* Fix bug in bootstrap (only seen in firefox) */ +summary { + display: list-item; +} + +/* Typographic tweaking ---------------------------------*/ + +.contents .page-header { + margin-top: calc(-60px + 1em); +} + +/* Section anchors ---------------------------------*/ + +a.anchor { + margin-left: -30px; + display:inline-block; + width: 30px; + height: 30px; + visibility: hidden; + + background-image: url(./link.svg); + background-repeat: no-repeat; + background-size: 20px 20px; + background-position: center center; +} + +.hasAnchor:hover a.anchor { + visibility: visible; +} + +@media (max-width: 767px) { + .hasAnchor:hover a.anchor { + visibility: hidden; + } +} + + +/* Fixes for fixed navbar --------------------------*/ + +.contents h1, .contents h2, .contents h3, .contents h4 { + padding-top: 60px; + margin-top: -40px; +} + +/* Static header placement on mobile devices */ +@media (max-width: 767px) { + .navbar-fixed-top { + position: absolute; + } + .navbar { + padding: 0; + } +} + + +/* Sidebar --------------------------*/ + +#sidebar { + margin-top: 30px; +} +#sidebar h2 { + font-size: 1.5em; + margin-top: 1em; +} + +#sidebar h2:first-child { + margin-top: 0; +} + +#sidebar .list-unstyled li { + margin-bottom: 0.5em; +} + +.orcid { + height: 16px; + vertical-align: middle; +} + +/* Reference index & topics ----------------------------------------------- */ + +.ref-index th {font-weight: normal;} + +.ref-index td {vertical-align: top;} +.ref-index .icon {width: 40px;} +.ref-index .alias {width: 40%;} +.ref-index-icons .alias {width: calc(40% - 40px);} +.ref-index .title {width: 60%;} + +.ref-arguments th {text-align: right; padding-right: 10px;} +.ref-arguments th, .ref-arguments td {vertical-align: top;} +.ref-arguments .name {width: 20%;} +.ref-arguments .desc {width: 80%;} + +/* Nice scrolling for wide elements --------------------------------------- */ + +table { + display: block; + overflow: auto; +} + +/* Syntax highlighting ---------------------------------------------------- */ + +pre { + word-wrap: normal; + word-break: normal; + border: 1px solid #eee; +} + +pre, code { + background-color: #f8f8f8; + color: #333; +} + +pre code { + overflow: auto; + word-wrap: normal; + white-space: pre; +} + +pre .img { + margin: 5px 0; +} + +pre .img img { + background-color: #fff; + display: block; + height: auto; +} + +code a, pre a { + color: #375f84; +} + +a.sourceLine:hover { + text-decoration: none; +} + +.fl {color: #1514b5;} +.fu {color: #000000;} /* function */ +.ch,.st {color: #036a07;} /* string */ +.kw {color: #264D66;} /* keyword */ +.co {color: #888888;} /* comment */ + +.message { color: black; font-weight: bolder;} +.error { color: orange; font-weight: bolder;} +.warning { color: #6A0366; font-weight: bolder;} + +/* Clipboard --------------------------*/ + +.hasCopyButton { + position: relative; +} + +.btn-copy-ex { + position: absolute; + right: 0; + top: 0; + visibility: hidden; +} + +.hasCopyButton:hover button.btn-copy-ex { + visibility: visible; +} + +/* mark.js ----------------------------*/ + +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} + +/* vertical spacing after htmlwidgets */ +.html-widget { + margin-bottom: 10px; +} diff --git a/docs/pkgdown.js b/docs/pkgdown.js new file mode 100644 index 0000000..eb7e83d --- /dev/null +++ b/docs/pkgdown.js @@ -0,0 +1,115 @@ +/* http://gregfranko.com/blog/jquery-best-practices/ */ +(function($) { + $(function() { + + $("#sidebar") + .stick_in_parent({offset_top: 40}) + .on('sticky_kit:bottom', function(e) { + $(this).parent().css('position', 'static'); + }) + .on('sticky_kit:unbottom', function(e) { + $(this).parent().css('position', 'relative'); + }); + + $('body').scrollspy({ + target: '#sidebar', + offset: 60 + }); + + $('[data-toggle="tooltip"]').tooltip(); + + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + // Ignore external links + if (links[i].host !== location.host) + continue; + + var nav_path = paths(links[i].pathname); + + var length = prefix_length(nav_path, cur_path); + if (length > max_length) { + max_length = length; + pos = i; + } + } + + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); + menu_anchor.parent().addClass("active"); + menu_anchor.closest("li.dropdown").addClass("active"); + } + }); + + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + + // Returns -1 if not found + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(-1); + + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 0 : -1); + } + + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } + + return(haystack.length); + } + + /* Clipboard --------------------------*/ + + function changeTooltipMessage(element, msg) { + var tooltipOriginalTitle=element.getAttribute('data-original-title'); + element.setAttribute('data-original-title', msg); + $(element).tooltip('show'); + element.setAttribute('data-original-title', tooltipOriginalTitle); + } + + if(ClipboardJS.isSupported()) { + $(document).ready(function() { + var copyButton = ""; + + $(".examples, div.sourceCode").addClass("hasCopyButton"); + + // Insert copy buttons: + $(copyButton).prependTo(".hasCopyButton"); + + // Initialize tooltips: + $('.btn-copy-ex').tooltip({container: 'body'}); + + // Initialize clipboard: + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { + text: function(trigger) { + return trigger.parentNode.textContent; + } + }); + + clipboardBtnCopies.on('success', function(e) { + changeTooltipMessage(e.trigger, 'Copied!'); + e.clearSelection(); + }); + + clipboardBtnCopies.on('error', function() { + changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); + }); + }); + } +})(window.jQuery || window.$) diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml new file mode 100644 index 0000000..3a0b13b --- /dev/null +++ b/docs/pkgdown.yml @@ -0,0 +1,6 @@ +pandoc: 2.3.1 +pkgdown: 1.3.0 +pkgdown_sha: ~ +articles: + introduction: introduction.html + diff --git a/docs/reference/index.html b/docs/reference/index.html new file mode 100644 index 0000000..344b8b7 --- /dev/null +++ b/docs/reference/index.html @@ -0,0 +1,164 @@ + + + + + + + + +Function reference • vizdraws + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    All functions

    +

    +
    +

    vizdrawsOutput() rendervizdraws()

    +

    Shiny bindings for vizdraws

    +

    vizdraws()

    +

    vizdraws

    +
    + + +
    + +
    + + +
    +

    Site built with pkgdown 1.3.0.

    +
    +
    +
    + + + + + + diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html new file mode 100644 index 0000000..9ef3565 --- /dev/null +++ b/docs/reference/pipe.html @@ -0,0 +1,147 @@ + + + + + + + + +Pipe operator — %>% • vizdraws + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    See magrittr::%>% for details.

    + +
    + +
    lhs %>% rhs
    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown 1.3.0.

    +
    +
    +
    + + + + + + diff --git a/docs/reference/vizdraws-shiny.html b/docs/reference/vizdraws-shiny.html new file mode 100644 index 0000000..15700a1 --- /dev/null +++ b/docs/reference/vizdraws-shiny.html @@ -0,0 +1,180 @@ + + + + + + + + +Shiny bindings for vizdraws — vizdraws-shiny • vizdraws + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Output and render functions for using vizdraws within Shiny +applications and interactive Rmd documents.

    + +
    + +
    vizdrawsOutput(outputId, width = "100%", height = "100%")
    +
    +rendervizdraws(expr, env = parent.frame(), quoted = FALSE)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + +
    outputId

    output variable to read from

    width, height

    Must be a valid CSS unit (like '100%', +'400px', 'auto') or a number, which will be coerced to a +string and have 'px' appended.

    expr

    An expression that generates a vizdraws

    env

    The environment in which to evaluate expr.

    quoted

    Is expr a quoted expression (with quote())? This +is useful if you want to save an expression in a variable.

    + + +
    + +
    + +
    + + +
    +

    Site built with pkgdown 1.3.0.

    +
    +
    +
    + + + + + + diff --git a/docs/reference/vizdraws.html b/docs/reference/vizdraws.html new file mode 100644 index 0000000..11725ec --- /dev/null +++ b/docs/reference/vizdraws.html @@ -0,0 +1,240 @@ + + + + + + + + +vizdraws — vizdraws • vizdraws + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    vizdraws

    + +
    + +
    vizdraws(prior = NULL, posterior = NULL, MME = 0, threshold = NULL,
    +  units = NULL, quantity = FALSE, xlab = NULL, breaks = NULL,
    +  break_names = NULL, colors = NULL, width = NULL, height = NULL,
    +  xlim = NULL, font_scale = 1, display_mode_name = FALSE,
    +  title = "", elementId = NULL)
    + +

    Arguments

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    prior

    draws from the prior distribution. This is an optional parameter but either this or posterior should be provided

    posterior

    draws from the posterior distribution. This is an optional parameter but either this or prior should be provided

    MME

    minimum meaninful effect. If not provided MME is set to zero

    threshold

    if the probability is greater than this threshold, you would feel confortable making a decision

    units

    optional arguement to specify the units of x. For example, dollars or applications

    quantity

    defaults to FALSE. When set to true text will change to reflect that you are predicting a quantity rather than a treatment effect

    xlab

    defaults to NULL

    breaks

    defaults to NULL

    break_names

    defaults to NULL

    colors

    colors for the left, middle, and right areas. The defaults are c("#e41a1c", "#377eb8", "#4daf4a")

    width

    width for shiny

    height

    height for shiny

    xlim

    defaults to NULL

    font_scale

    defaults to 1

    display_mode_name

    defaults to FALSE

    title

    defaults to ''

    elementId

    Use an explicit element ID for the widget +(rather than an automatically generated one).elementID for shiny

    + +

    Value

    + +

    A HTML widget object

    + + +

    Examples

    +
    if(interactive()){ +set.seed(9782) +library(vizdraws) +vizdraws(prior= rnorm(100000)) + }
    +
    + +
    + +
    + + +
    +

    Site built with pkgdown 1.3.0.

    +
    +
    +
    + + + + + + diff --git a/inst/CITATION b/inst/CITATION new file mode 100644 index 0000000..bef95d7 --- /dev/null +++ b/inst/CITATION @@ -0,0 +1,11 @@ +year <- sub("-.*", "", meta$Date) +note <- sprintf("R package version %s", meta$Version) + +bibentry(bibtype = "Manual", + title = "{vizdraws}: Interactive visualization for the prior and posterior distribution", + author = c(person("Ignacio", "Martinez"), + person("Dan", "Thal"), + person("Linus", "Marco")), + year = year, + note = note, + url = "https://CRAN.R-project.org/package=vizdraws") diff --git a/vignettes/.gitignore b/vignettes/.gitignore new file mode 100644 index 0000000..097b241 --- /dev/null +++ b/vignettes/.gitignore @@ -0,0 +1,2 @@ +*.html +*.R diff --git a/vignettes/introduction.Rmd b/vignettes/introduction.Rmd new file mode 100644 index 0000000..a075ffc --- /dev/null +++ b/vignettes/introduction.Rmd @@ -0,0 +1,57 @@ +--- +title: "Introduction" +output: rmarkdown::html_vignette +vignette: > + %\VignetteIndexEntry{introduction} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + + +## Draws from the prior distribution + +```{r prior, eval=FALSE} +library(vizdraws) +set.seed(1982) +vizdraws(prior = rnorm(n = 10000, mean = 0, sd = 1), xlim = c(-3,3)) + +``` + +
    + +
    + +## Updating the prior + +```{r posterior, eval=FALSE} +vizdraws(prior = rnorm(n = 10000, mean = 0, sd = 1), + posterior = rnorm(n = 10000, mean = 0.3, sd = 0.5), + xlim = c(-3,3)) +``` + +
    + +
    + +## Meanimum meaningful effect + +```{r mme, eval=FALSE} +vizdraws(prior = rnorm(n = 10000, mean = 0, sd = 1), + posterior = rnorm(n = 10000, mean = 0.3, sd = 0.5), + xlim = c(-3,3), + MME = 0.1) + +``` + +
    + +
    + +