Skip to content

Commit 80a1ce8

Browse files
committed
Updates to ensure that the man pages show the examples
1 parent 76e6c90 commit 80a1ce8

10 files changed

Lines changed: 44 additions & 111 deletions

File tree

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: DrBristol
2-
Title: Hypotheses Using Biased and Unbiased Urn Models Inspired by Muriel Bristol and Ronald Fisher
2+
Title: Hypothesis Tests Using Biased and Unbiased Urn Models Inspired by Muriel Bristol and Ronald Fisher
33
Version: 0.0.1.0000
4-
Authors@R: c(person("Matias", "Lopez", role = c("aut", "cre"), email="first.last@example.com", comment = c(ORCID = "YOUR-ORCID-ID")),
4+
Authors@R: c(person("Matias", "Lopez", role = c("aut", "cre"), email="matiaslopez.uy@gmail.com", comment = c(ORCID = "0000-0002-0871-2841")),
55
person("Jake", "Bowers", role ="aut", email = "jwbowers@illinois.edu", comment = c(ORCID = "0000-0002-4048-1166")))
66
Description: This package implements the tests and sensitivity analyses described in Lopez and Bowers (20XX). Forthcoming. Title.
77
License: MIT + file LICENSE

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22

33
export(find_p_two_types)
44
export(sens_urn)
5-
export(sim_urn)
65
importFrom(BiasedUrn,dFNCHypergeo)
76
importFrom(stats,uniroot)

R/p_binary.R

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@
1515
#' @param interpretation Logical. TRUE if the function returns text helping
1616
#' to interpret the result, FALSE (default option) to returns only the p-value
1717
#' @return Either a p-value (numeric, scalar) or a list containing the p-value and text containing an interpretation
18+
#' @examples
19+
#' # Equal probability, 2 kinds of evidence
20+
#' find_p_two_types(obs_support = 7, total_obs = 10)
21+
#' # Equal probability, 2 kinds of evidence with interpretation printed
22+
#' find_p_two_types(obs_support = 7, total_obs = 10, interpretation = TRUE)
23+
#' # Unequal probability, 2 kinds of evidence with interpretation printed
24+
#' find_p_two_types(obs_support = 7, total_obs = 10, interpretation = TRUE, odds = .5)
25+
#' find_p_two_types(obs_support = 7, total_obs = 10, interpretation = TRUE, odds = 2)
26+
#' # Equal probability, Unequal evidentiary weight, 2 kinds of evidence
27+
#' find_p_two_types(obs_support = 7, total_obs = 10, weights = rep(1, 7), interpretation = TRUE, odds = 1)
28+
#' find_p_two_types(obs_support = 7, total_obs = 10, weights = rep(c(2, 1), c(1, 7 - 1)), interpretation = TRUE, odds = 1)
1829
#' @export
1930
find_p_two_types <- function(obs_support, total_obs, odds = 1, weights = NULL, interpretation = FALSE) {
2031
if (is.null(weights)) {
@@ -45,15 +56,3 @@ find_p_two_types <- function(obs_support, total_obs, odds = 1, weights = NULL, i
4556
return(list(thep = thep, interp = interp))
4657
}
4758
}
48-
#' @examples
49-
#' ...
50-
#' # Equal probability, 2 kinds of evidence
51-
#' find_p_two_types(obs_support = 7, total_obs = 10)
52-
#' # Equal probability, 2 kinds of evidence with interpretation printed
53-
#' find_p_two_types(obs_support = 7, total_obs = 10, interpretation = TRUE)
54-
#' # Unequal probability, 2 kinds of evidence with interpretation printed
55-
#' find_p_two_types(obs_support = 7, total_obs = 10, interpretation = TRUE, odds = .5)
56-
#' find_p_two_types(obs_support = 7, total_obs = 10, interpretation = TRUE, odds = 2)
57-
#' # Equal probability, Unequal evidentiary weight, 2 kinds of evidence
58-
#' find_p_two_types(obs_support = 7, total_obs = 10, weights = rep(1, 7), interpretation = TRUE, odds = 1)
59-
#' find_p_two_types(obs_support = 7, total_obs = 10, weights = rep(c(2, 1), c(1, 7 - 1)), interpretation = TRUE, odds = 1)

R/plot_p.R

Lines changed: 0 additions & 36 deletions
This file was deleted.

R/sensitivity_analysis.R

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@
1010
#' @param total_obs An integer representing the total number of observations
1111
#' @param weights A vector of numeric weights representing the differential evidentiary weight of the working theory supporting observations.
1212
#' @param p_threshold A decimal (Double). The p-value threshold. Default is p=.05.
13-
#' @return The p-value for a given amount of bias in drawing observations from the urn.
13+
#' @return A list with two elements:
14+
#' (1) in \code{w} the differential odds of observing a working theory supporting observation over a rival theory supporting observation.
15+
#' (2) in \code{p} The p-value given the found \code{w}.
16+
#' @examples
17+
#' # What is the odds that would bring our p=.02 to p \approx .05
18+
#' find_p_two_types(obs_support = 7, total_obs = 10, odds = 1)
19+
#' sens_urn(obs_support = 7, total_obs = 10, p_threshold = .05)$w
20+
#' # Notice that this is correct:
21+
#' find_p_two_types(obs_support = 7, total_obs = 10, odds = 1.58928)
1422
#' @importFrom BiasedUrn dFNCHypergeo
1523
#' @importFrom stats uniroot
1624
#' @export
@@ -39,9 +47,3 @@ sens_urn <- function(obs_support, total_obs, weights = NULL, p_threshold = .05)
3947
)
4048
return(list(w = theodds, p = thep_at_theodds))
4149
}
42-
#' @examples
43-
#' # What is the odds that would bring our p=.02 to p \approx .05
44-
#' find_p_two_types(obs_support = 7, total_obs = 10, odds = 1)
45-
#' sens_urn(obs_support = 7, total_obs = 10, p_threshold = .05)$w
46-
#' # Notice that this is correct:
47-
#' find_p_two_types(obs_support = 7, total_obs = 10, odds = 1.58928)

R/sim_urn.R

Lines changed: 0 additions & 24 deletions
This file was deleted.

R/summary_table.R

Lines changed: 0 additions & 1 deletion
This file was deleted.

man/find_p_two_types.Rd

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sens_urn.Rd

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/sim_urn.Rd

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)