diff --git a/dev/index.html b/dev/index.html index b8319d0..1c02efd 100644 --- a/dev/index.html +++ b/dev/index.html @@ -107,7 +107,7 @@

Basic UsageX <- Bernoulli(0.1) random(X, 10) -#> [1] 0 0 0 0 0 0 0 0 0 0 +#> [1] 0 0 0 0 0 0 1 1 0 0 pdf(X, 1) #> [1] 0.1 @@ -188,8 +188,8 @@

Developers

Dev status

diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index 60b1f7a..221ea7e 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -12,7 +12,7 @@ articles: paired-tests: paired-tests.html poisson: poisson.html two-sample-z-test: two-sample-z-test.html -last_built: 2024-09-10T15:27Z +last_built: 2024-09-16T15:19Z urls: reference: https://alexpghayes.github.io/distributions3/reference article: https://alexpghayes.github.io/distributions3/articles diff --git a/dev/reference/vec_proxy.distribution.html b/dev/reference/vec_proxy.distribution.html index 8a7b56e..f8f8044 100644 --- a/dev/reference/vec_proxy.distribution.html +++ b/dev/reference/vec_proxy.distribution.html @@ -58,11 +58,9 @@

Methods for including distributions as vctrs in tibbles

Usage

-
# S3 method for class 'distribution'
-vec_proxy(x, ...)
+    
vec_proxy.distribution(x, ...)
 
-# S3 method for class 'distribution'
-vec_restore(x, to, ...)
+vec_restore.distribution(x, to, ...)
diff --git a/dev/search.json b/dev/search.json index 207c9d1..b397a7f 100644 --- a/dev/search.json +++ b/dev/search.json @@ -1 +1 @@ -[{"path":"https://alexpghayes.github.io/distributions3/dev/CODE_OF_CONDUCT.html","id":null,"dir":"","previous_headings":"","what":"Contributor Code of Conduct","title":"Contributor Code of Conduct","text":"contributors maintainers project, pledge respect people contribute reporting issues, posting feature requests, updating documentation, submitting pull requests patches, activities. committed making participation project harassment-free experience everyone, regardless level experience, gender, gender identity expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion. Examples unacceptable behavior participants include use sexual language imagery, derogatory comments personal attacks, trolling, public private harassment, insults, unprofessional conduct. Project maintainers right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct. Project maintainers follow Code Conduct may removed project team. Instances abusive, harassing, otherwise unacceptable behavior may reported opening issue contacting one project maintainers. Code Conduct adapted Contributor Covenant (https://www.contributor-covenant.org), version 1.0.0, available https://contributor-covenant.org/version/1/0/0/.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to distributions","title":"Contributing to distributions","text":"outlines propose change distributions. detailed info contributing , tidyverse packages, please see development contributing guide.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to distributions","text":"Small typos grammatical errors documentation may edited directly using GitHub web interface, long changes made source file. YES: edit roxygen comment .R file R/. : edit .Rd file man/.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"prerequisites","dir":"","previous_headings":"","what":"Prerequisites","title":"Contributing to distributions","text":"make substantial pull request, always file issue make sure someone team agrees ’s problem. ’ve found bug, create associated issue illustrate bug minimal reprex.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"","what":"Pull request process","title":"Contributing to distributions","text":"recommend create Git branch pull request (PR). Look Travis AppVeyor build status making changes. README contain badges continuous integration services used package. New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat. Contributions test cases included easier accept. user-facing changes, add bullet top NEWS.md current development version header describing changes made followed GitHub username, links relevant issue(s)/PR(s).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to distributions","text":"Please note distributions project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"see-tidyverse-development-contributing-guide","dir":"","previous_headings":"","what":"See tidyverse development contributing guide","title":"Contributing to distributions","text":"details.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2022 distributions3 authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"false-positives","dir":"Articles","previous_headings":"Things that can go wrong","what":"False positives","title":"Intro to hypothesis testing","text":"need concerned rejecting null hypothesis null hypothesis true. called false positive Type error. null hypothesis true, calculate statistic like , still expect see value p-value 9.6⋅10−79.6 \\cdot 10^{-7} 9.6⋅10−59.6 \\cdot 10^{-5} percent time. small p-values isn’t issue, let’s consider different null hypothesis μ0=3.9\\mu_0 = 3.9. Now $$ Z = {\\bar x - \\mu_0 \\{\\sigma \\\\sqrt n}} = {4 - 3.9 \\\\sqrt \\frac 23} \\approx 0.12 $$ corresponding p-value P(|Z|>0.12)=P(Z<−0.12)+P(Z>0.12)≈0.9 P(|Z| > 0.12) = P(Z < -0.12) + P(Z > 0.12) \\approx 0.9 see quite probable! definitely reject null hypothesis! leads us new question: reject null hypothesis? standard choice set acceptable probability false positive α\\alpha. One arbitrary common choice set α=0.05\\alpha = 0.05, means okay ${1 \\20}$ chance false positive. reject null hypothesis p-value less α\\alpha. often called “rejecting null hypothesis significance level α\\alpha”. formally, might write P(rejectH0|H0true)=α P(\\text{reject} \\; H_0 | H_0 \\; \\text{true}) = \\alpha","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"false-negatives","dir":"Articles","previous_headings":"Things that can go wrong","what":"False negatives","title":"Intro to hypothesis testing","text":"hand, may also fail reject null hypothesis null hypothesis fact false. might just enough data reject null, example. call false negative Type II error. write Power=P(fail rejectH0|H0false)=1−β \\text{Power} = P(\\text{fail reject} \\; H_0 | H_0 \\; \\text{false}) = 1 - \\beta achieve power 1−β1 - \\beta one sample Z-test, need $$ n \\approx \\left( { \\sigma \\cdot (z_{\\alpha / 2} + z_\\beta) \\ \\mu_0 - \\mu_A } \\right)^2 $$ μA\\mu_A true mean μ0\\mu_0 proposed mean. ’ll exercise later help see comes .","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"z-test","dir":"Articles","previous_headings":"Examples","what":"Z-test","title":"Intro to hypothesis testing","text":"company claims battery lifetimes normally distributed μ=40\\mu = 40 σ=5\\sigma = 5 hours. curious claim mean reasonable, collect random sample 100 batteries. sample mean 39.8. p-value Z-test H0:μ=40H_0 : \\mu = 40? begin calculating Z-score $$ Z = {\\bar x - \\mu_0 \\{\\sigma \\\\sqrt n}} = {39.8 - 40 \\{5 \\\\sqrt 100}} = 0.4 $$ calculate, using fact Z∼Normal(0,1)Z \\sim \\mathrm{Normal}(0, 1), P(Z<−0.4)+P(Z>0.4)≈0.69 P(Z < -0.4) + P(Z > 0.4) \\approx 0.69 might also interested one-sided test, HA:μ<40H_A : \\mu < 40. case p-value case Z<−0.4Z < -0.4, p-value P(Z<−0.4)≈0.34 P(Z < -0.4) \\approx 0.34","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"power-for-z-test","dir":"Articles","previous_headings":"Examples","what":"Power for Z-test","title":"Intro to hypothesis testing","text":"Suppose powdered medicine supposed mean particle diameter μ=15\\mu = 15 micrometers, standard deviation diameters stays steady around 1.8 micrometers. company like high power detect mean thicknesses 0.2 micrometers away 15. n=100n = 100, power test true μ\\mu 15.2 micrometers. Assume company interested controlling type error α=0.05\\alpha = 0.05 level. reject null Z score less zα/2z_{\\alpha / 2} z1−α/2z_{1 - \\alpha / 2}, Z score less -1.96 greater 1.96. Recall Z score ${\\bar x - \\mu_0 \\{\\sigma \\\\sqrt n}}$, can rearrange terms x‾\\bar x see reject null x‾<14.65\\bar x < 14.65 x‾>15.35\\bar x > 15.35. Now interested probability rejection region alternative hypothesis μA=15.2\\mu_A = 15.2 true. P(x‾>15.35|μ=15.2)+P(x‾<14.65|μ=15.2) P(\\bar x > 15.35 | \\mu = 15.2) + P(\\bar x < 14.65 | \\mu = 15.2) know x‾∼Normal(15.2,1.8/100)\\bar x \\sim \\mathrm{Normal} \\left(15.2, 1.8 / \\sqrt{100}\\right) equals 0.001+0.198≈0.199 0.001 + 0.198 \\approx 0.199 power 20 percent. quite low.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample sign tests","text":"Sometimes want Z-test T-test, reason tests appropriate. data may skewed, distribution outliers, non-normal important way. circumstances sign test appropriate. example, suppose wander around Times Square ask strangers salaries. Incomes typically skewed, might get sample like: 8478,21564,36562,176602,9395,18320,50000,2,40298,39,10780,2268583,3404930 8478, 21564, 36562, 176602, 9395, 18320, 50000, 2, 40298, 39, 10780, 2268583, 3404930 look QQ plot, see massive outliers: Luckily, sign test requires independent samples valid inference (consequence, low power).","code":"incomes <- c(8478, 21564, 36562, 176602, 9395, 18320, 50000, 2, 40298, 39, 10780, 2268583, 3404930) qqnorm(incomes) qqline(incomes)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample sign tests","text":"sign test allows us test whether median distribution equals hypothesized value. Let’s test whether data consistent median 50,000, close-ish median income U.S. memory serves. H0:m=50,000HA:μ≠50,000 H_0: m = 50,000 \\qquad H_A: \\mu \\neq 50,000 mm stands population median. test statistic B=∑=1n1(50,000,∞)(xi)∼Binomial(N,0.5) B = \\sum_{=1}^n 1_{(50, 000, \\infty)} (x_i) \\sim \\mathrm{Binomial}(N, 0.5) BB number data points observed strictly greater median, NN sample size exact ties median removed. Forgetting remove exact ties frequent mistake students test classes TA. sort data can see B=3B = 3 N=12N = 12 case: can verify R well:","code":"sort(incomes) #> [1] 2 39 8478 9395 10780 18320 21564 36562 40298 #> [10] 50000 176602 2268583 3404930 b <- sum(incomes > 50000) b #> [1] 3 n <- sum(incomes != 50000) n #> [1] 12"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample sign tests","text":"calculate two-sided p-value, need find 2⋅min(P(B≥3),P(B≤3))=2⋅min(1−P(B≤2),P(B≤3)) \\begin{align} 2 \\cdot \\min(P(B \\ge 3), P(B \\le 3)) = 2 \\cdot \\min(1 - P(B \\le 2), P(B \\le 3)) \\end{align} need c.d.f. binomial random variable: practice computing c.d.f. binomial random variables rather tedious aren’t great shortcuts small samples. got question like exam, ’d want use binomial p.m.f. repeatedly, like : P(B≤3)=P(B=0)+P(B=1)+P(B=2)+P(B=3)=(120)0.500.512+(121)0.510.511+(122)0.520.510+(123)0.530.59 \\begin{align} P(B \\le 3) &= P(B = 0) + P(B = 1) + P(B = 2) + P(B = 3) \\\\ &= \\binom{12}{0} 0.5^0 0.5^12 + \\binom{12}{1} 0.5^1 0.5^11 + \\binom{12}{2} 0.5^2 0.5^10 + \\binom{12}{3} 0.5^3 0.5^9 \\end{align} Finally, sometimes interest one sided sign tests. test H0:m≤3HA:m>3 \\begin{align} H_0: m \\le 3 \\qquad H_A: m > 3 \\end{align} p-value given P(B>3)=1−P(B≤2) P(B > 3) = 1 - P(B \\le 2) calculate test H0:m≥3HA:m<3 H_0: m \\ge 3 \\qquad H_A: m < 3 p-value given P(B<3) P(B < 3) calculate ","code":"library(distributions3) X <- Binomial(n, 0.5) 2 * min(cdf(X, b), 1 - cdf(X, b - 1)) #> [1] 0.1459961 1 - cdf(X, b - 1) #> [1] 0.9807129 cdf(X, b) #> [1] 0.07299805"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"using-the-binom-test-function","dir":"Articles","previous_headings":"","what":"Using the binom.test() function","title":"One sample sign tests","text":"verify results can use binom.test() base R. x argument gets value BB, n value NN, p = 0.5 test median. , H0:m=3H_0 : m = 3 use H0:m≤3H_0 : m \\le 3 H0:m≥3H_0 : m \\ge 3 results agree manual computations, reassuring.","code":"binom.test(3, n = 12, p = 0.5) #> #> Exact binomial test #> #> data: 3 and 12 #> number of successes = 3, number of trials = 12, p-value = 0.146 #> alternative hypothesis: true probability of success is not equal to 0.5 #> 95 percent confidence interval: #> 0.05486064 0.57185846 #> sample estimates: #> probability of success #> 0.25 binom.test(3, n = 12, p = 0.5, alternative = \"greater\") #> #> Exact binomial test #> #> data: 3 and 12 #> number of successes = 3, number of trials = 12, p-value = 0.9807 #> alternative hypothesis: true probability of success is greater than 0.5 #> 95 percent confidence interval: #> 0.07187026 1.00000000 #> sample estimates: #> probability of success #> 0.25 binom.test(3, n = 12, p = 0.5, alternative = \"less\") #> #> Exact binomial test #> #> data: 3 and 12 #> number of successes = 3, number of trials = 12, p-value = 0.073 #> alternative hypothesis: true probability of success is less than 0.5 #> 95 percent confidence interval: #> 0.0000000 0.5273266 #> sample estimates: #> probability of success #> 0.25"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-confidence-interval.html","id":"using-the-t-test-function","dir":"Articles","previous_headings":"","what":"Using the t.test() function","title":"T confidence interval for a mean","text":"want verify calculation correct, R function t.test() performs T-tests calculates T confidence intervals means. get confidence interval single sample, pass t.test() vector data, tell confidence coefficient (recall 0.88) via conf.level argument. conf.level defaults 0.95, means don’t specify confidence interval get 95 percent confidence interval. t.test() returns interval (2.63, 6.37), exactly calculated hand, reassuring. also one-sample T-test us well. don’t specify conf.level, get 95 percent confidence interval: wider 88 percent confidence interval, expect.","code":"t.test(x, conf.level = 0.88) #> #> One Sample t-test #> #> data: x #> t = 4.1367, df = 9, p-value = 0.002534 #> alternative hypothesis: true mean is not equal to 0 #> 88 percent confidence interval: #> 2.631598 6.368402 #> sample estimates: #> mean of x #> 4.5 t.test(x) #> #> One Sample t-test #> #> data: x #> t = 4.1367, df = 9, p-value = 0.002534 #> alternative hypothesis: true mean is not equal to 0 #> 95 percent confidence interval: #> 2.0392 6.9608 #> sample estimates: #> mean of x #> 4.5"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample T-tests","text":"Let’s suppose student interesting estimating many memes professors know love. go class, every time professor uses new meme, write . year classes, student recorded following meme counts, count corresponds single class took: 3,7,11,0,7,0,4,5,6,2 3, 7, 11, 0, 7, 0, 4, 5, 6, 2 Note: Z-test, need know population standard deviation σ\\sigma. T-tests, unnecessary, estimate standard deviation data. results additional uncertainty test statistic, reflected heavier tails T distribution compared normal distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"One sample T-tests","text":"can T-test, need make check can reasonably treat mean sample normally distributed. happens case either following hold: data comes normal distribution. lots data. much? Many textbooks use 30 data points rule thumb. Since small sample, let’s check data comes normal distribution using normal quantile-quantile plot. Since data lies close line y=xy = x, notable systematic deviations line, ’s safe treat sample coming normal distribution. can proceed hypothesis test.","code":"# read in the data x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) # make the qqplot qqnorm(x) qqline(x)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample T-tests","text":"Let’s test null hypothesis , average, professors know 3 memes. H0:μ=3HA:μ≠3 H_0: \\mu = 3 \\qquad H_A: \\mu \\neq 3 First need calculate T-statistic. Let’s use R. Remember T-statistic defined T=x‾−μ0s/n∼tn−1 T = \\frac{\\bar x - \\mu_0}{s / \\sqrt{n}} \\sim t_{n-1} x‾=1n∑=1nxi\\bar x = \\frac 1n \\sum_{=1}^n x_i sample mean, μ0\\mu_0 proposed value population mean, s=1n−1∑=1n(xi−x‾)2s = \\sqrt{\\frac{1}{n-1} \\sum_{=1}^n (x_i - \\bar x)^2} sample standard deviation, nn sample size. test statistic T distribution n−1n-1 degrees freedom.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample T-tests","text":"R looks like: Since sample size 10, calculate two-sided p-value, need find P(|t9|≥|1.38|)=P(t9≥1.38)+P(t9≤−1.38)=1−P(t9≤1.38)+P(t9≤−1.38) \\begin{align} P(|t_9| \\ge |1.38|) &= P(t_9 \\ge 1.38) + P(t_9 \\le -1.38) \\\\ &= 1 - P(t_9 \\le 1.38) + P(t_9 \\le -1.38) \\\\ \\end{align} need c.d.f. t9t_9 distribution. Note saved t_stat also done slightly accurate since rounding error. p-value 0.20. verify T-table. Note get value cdf(T_9, 1.38) looking 1.38 T-table. may also seen different formula p-value two-sided T-test, makes use fact T distribution symmetric: P(|t9|≥|1.38|)=2⋅P(t9≤−|1.38|) \\begin{align} P(|t_9| \\ge |1.38|) &= 2 \\cdot P(t_9 \\le -|1.38|) \\end{align} Using formula get result: Finally, sometimes interest one sided T-tests. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} p-value given P(t9>1.38) P(t_9 > 1.38) calculate test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 p-value given P(t9<1.38) P(t_9 < 1.38) calculate ","code":"n <- length(x) # calculate the z-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(n)) t_stat #> [1] 1.378916 library(distributions3) T_9 <- StudentsT(df = 9) # make a T_9 distribution 1 - cdf(T_9, 1.38) + cdf(T_9, -1.38) #> [1] 0.2008985 1 - cdf(T_9, abs(t_stat)) + cdf(T_9, -abs(t_stat)) #> [1] 0.2012211 2 * cdf(T_9, -1.38) #> [1] 0.2008985 1 - cdf(T_9, 1.38) #> [1] 0.1004493 cdf(T_9, 1.38) #> [1] 0.8995507"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"using-the-t-test-function","dir":"Articles","previous_headings":"","what":"Using the t.test() function","title":"One sample T-tests","text":"want verify calculation correct, R function t.test() performs T-tests calculates T confidence intervals means. get T statistic, degrees freedom sampling distribution, p-value pass t.test() vector data. tell t.test() null hypothesis passing mu argument. case, want test mu = 3. don’t specify mu, t.test() assumes want test hypothesis H0:μ=0H_0 : \\mu = 0. looks like can also get one-sided p-values t.test() specifying alternative hypothesis. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} use test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 use results agree hand calculations earlier.","code":"t.test(x, mu = 3) #> #> One Sample t-test #> #> data: x #> t = 1.3789, df = 9, p-value = 0.2012 #> alternative hypothesis: true mean is not equal to 3 #> 95 percent confidence interval: #> 2.0392 6.9608 #> sample estimates: #> mean of x #> 4.5 t.test(x) #> #> One Sample t-test #> #> data: x #> t = 4.1367, df = 9, p-value = 0.002534 #> alternative hypothesis: true mean is not equal to 0 #> 95 percent confidence interval: #> 2.0392 6.9608 #> sample estimates: #> mean of x #> 4.5 t.test(x, mu = 3, alternative = \"greater\") #> #> One Sample t-test #> #> data: x #> t = 1.3789, df = 9, p-value = 0.1006 #> alternative hypothesis: true mean is greater than 3 #> 95 percent confidence interval: #> 2.505919 Inf #> sample estimates: #> mean of x #> 4.5 t.test(x, mu = 3, alternative = \"less\") #> #> One Sample t-test #> #> data: x #> t = 1.3789, df = 9, p-value = 0.8994 #> alternative hypothesis: true mean is less than 3 #> 95 percent confidence interval: #> -Inf 6.494081 #> sample estimates: #> mean of x #> 4.5"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample Z-tests for a proportion","text":"Let’s suppose student interesting estimating percent professors department watches Game Thrones. go office hours ask professor turns 17 62 professors department watch Game Thrones. Several faculty think Game Thrones board game. can imagine data bunch zeros ones, ithi^{th} data point, xix_i one professor ii watches Game Thrones, zero otherwise. full dataset might look something like: 1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0 \\begin{align} & 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, \\\\ & 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, \\\\ & 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 \\end{align} much easier just remember 17 ones 45 zeros.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"One sample Z-tests for a proportion","text":"can Z-test, need make check can reasonably treat mean sample normally distributed. data definitely normal distribution since ’s zeros ones, need check central limit theorem kicks . time check 30 data points , proportion, something slightly different. data binary, like , central limit theorem kicks slower usual. standard thing check whether n⋅π>5n \\cdot \\pi > 5 n⋅(1−π)>5n \\cdot (1 - \\pi) > 5 nn sample size (62 case) π\\pi sample average. Note textbooks might use pp rather π\\pi. case π=17/62\\pi = 17 / 62, 62⋅17/62=1762 \\cdot 17 / 62 = 17 62⋅(1−17/62)=4562 \\cdot (1 - 17 / 62) = 45 ’re good go.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample Z-tests for a proportion","text":"Let’s test null hypothesis , average, twenty percent professors Game Thrones. corresponding null hypothesis H0:π=0.2HA:π≠0.2 H_0: \\pi = 0.2 \\qquad H_A: \\pi \\neq 0.2 First need calculate Z-statistic. Remember Z-statistic proportion Z=π−π0π0(1−π0)n∼Normal(0,1) Z = \\frac{\\pi - \\pi_0}{\\sqrt{\\frac{\\pi_0 (1 - \\pi_0)}{n}}} \\sim \\mathrm{Normal}(0, 1)","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample Z-tests for a proportion","text":"R looks like: calculate two-sided p-value, need find P(|Z|≥|1.46|)=P(Z≥1.46)+P(Z≤−1.46)=1−P(Z≤1.46)+P(Z≤−1.46)=1−Φ(1.46)+Φ(−1.46) \\begin{align} P(|Z| \\ge |1.46|) &= P(Z \\ge 1.46) + P(Z \\le -1.46) \\\\ &= 1 - P(Z \\le 1.46) + P(Z \\le -1.46) \\\\ &= 1 - \\Phi(1.46) + \\Phi(-1.46) \\end{align} need c.d.f. standard normal Note saved z_stat also done slightly accurate since rounding error. p-value 0.14. verify Z-table. Note get value cdf(Z, 1.46) looking 1.46 Z-table. may also seen different formula p-value two-sided Z-test, makes use fact normal distribution symmetric: P(|Z|≥|1.46|)=2⋅P(Z≤−|1.46|)=2⋅Φ(−1.46) \\begin{align} P(|Z| \\ge |1.46|) &= 2 \\cdot P(Z \\le -|1.46|) &= 2 \\cdot \\Phi(-1.46) \\end{align} Using formula get result:","code":"n <- 62 pi <- 17 / 62 pi_0 <- 0.2 # calculate the z-statistic z_stat <- (pi - pi_0) / sqrt(pi_0 * (1 - pi_0) / n) z_stat #> [1] 1.460501 library(distributions3) #> #> Attaching package: 'distributions3' #> The following object is masked from 'package:stats': #> #> Gamma #> The following object is masked from 'package:grDevices': #> #> pdf Z <- Normal(0, 1) # make a standard normal r.v. 1 - cdf(Z, 1.46) + cdf(Z, -1.46) #> [1] 0.1442901 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.1441523 2 * cdf(Z, -1.46) #> [1] 0.1442901"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"one-sided-z-tests","dir":"Articles","previous_headings":"","what":"One-sided Z-tests","title":"One sample Z-tests for a proportion","text":"Finally, sometimes interest one sided Z-tests. test H0:π≤0.2HA:π>0.2 \\begin{align} H_0: \\pi \\le 0.2 \\qquad H_A: \\pi > 0.2 \\end{align} p-value given P(Z>1.46) P(Z > 1.46) calculate test H0:π≥0.2HA:π<0.2 H_0: \\pi \\ge 0.2 \\qquad H_A: \\pi < 0.2 p-value given P(Z<1.46) P(Z < 1.46) calculate ","code":"1 - cdf(Z, 1.46) #> [1] 0.07214504 cdf(Z, 1.46) #> [1] 0.927855"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample Z-tests","text":"Let’s suppose student interesting estimating many memes professors know love. go class, every time professor uses new meme, write . year classes, student recorded following meme counts, count corresponds single class took: 3,7,11,0,7,0,4,5,6,2 3, 7, 11, 0, 7, 0, 4, 5, 6, 2 student talks students ’ve done similar studies determines σ=2\\sigma = 2 reasonable value standard deviation distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"One sample Z-tests","text":"can Z-test, need make check can reasonably treat mean sample normally distributed. happens case either following hold: data comes normal distribution. lots data. much? Many textbooks use 30 data points rule thumb. Since small sample, check data comes normal distribution using normal quantile-quantile plot. Since data lies close line y=xy = x, notable systematic deviations line, ’s safe treat sample coming normal distribution. can proceed hypothesis test.","code":"# read in the data x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) # make the qqplot qqnorm(x) qqline(x)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample Z-tests","text":"Let’s test null hypothesis , average, professors know 3 memes. H0:μ=3HA:μ≠3 H_0: \\mu = 3 \\qquad H_A: \\mu \\neq 3 First need calculate Z-statistic. Let’s R. Remember Z-statistic defined Z=x‾−μ0σ/n∼Normal(0,1) Z = \\frac{\\bar x - \\mu_0}{\\sigma / \\sqrt{n}} \\sim \\mathrm{Normal}(0, 1)","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample Z-tests","text":"R looks like: calculate two-sided p-value, need find P(|Z|≥|2.37|)=P(Z≥2.37)+P(Z≤−2.37)=1−P(Z≤2.37)+P(Z≤−2.37)=1−Φ(2.37)+Φ(−2.37) \\begin{align} P(|Z| \\ge |2.37|) &= P(Z \\ge 2.37) + P(Z \\le -2.37) \\\\ &= 1 - P(Z \\le 2.37) + P(Z \\le -2.37) \\\\ &= 1 - \\Phi(2.37) + \\Phi(-2.37) \\end{align} need c.d.f. standard normal Note saved z_stat also done slightly accurate since rounding error. p-value 0.0177. verify Z-table. Note get value cdf(Z, 2.37) looking 2.37 Z-table. may also seen different formula p-value two-sided Z-test, makes use fact normal distribution symmetric: P(|Z|≥|2.37|)=2⋅P(Z≤−|2.37|)=2⋅Φ(−2.37) \\begin{align} P(|Z| \\ge |2.37|) &= 2 \\cdot P(Z \\le -|2.37|) \\\\ &= 2 \\cdot \\Phi(-2.37) \\end{align} Using formula get result: Finally, sometimes interest one sided Z-tests. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} p-value given P(Z>2.37) P(Z > 2.37) calculate test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 p-value given P(Z<2.37) P(Z < 2.37) calculate ","code":"n <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(n)) z_stat #> [1] 2.371708 library(distributions3) Z <- Normal(0, 1) # make a standard normal r.v. 1 - cdf(Z, 2.37) + cdf(Z, -2.37) #> [1] 0.01778809 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 2 * cdf(Z, -2.37) #> [1] 0.01778809 1 - cdf(Z, 2.37) #> [1] 0.008894043 cdf(Z, 2.37) #> [1] 0.991106"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"rejection-regions","dir":"Articles","previous_headings":"","what":"Rejection regions","title":"One sample Z-tests","text":"Preface: strongly opposed make dichotomous “reject/fail reject” decision hypothesis tests. hypothesis test, report p-value, period. Picking arbitrary α\\alpha level rejection threshold treating gold standard ridiculous, evidenced 60 years statistical literature laden warnings hypothesis testing. said, sometimes can useful think reject hypothesis test. can think three different rejection regions Z-test: rejection region terms p-value rejection region terms test statistic rejection region terms sample mean given α\\alpha level threshold, rejection regions equivalent. ’ll start thinking rejection two-sided test. H0:μ=μ0HA:μ≠μ0 \\begin{align} H_0 : \\mu = \\mu_0 \\qquad H_A : \\mu \\neq \\mu_0 \\end{align} calculate test statistic ZobsZ_\\text{obs}, p-value P(|Z|>|Zobs|)P(|Z| > |Z_\\text{obs}|) reject P(|Z|>|Zobs|)<αP(|Z| > |Z_\\text{obs}|) < \\alpha. defines first rejection region. Using observation , exactly equivalent rejecting P(|Z|>|Zobs|)<α⇔2⋅P(Z<−|Zobs|)<α⇔P(Z<−|Zobs|)<α/2 \\begin{align} P(|Z| > |Z_\\text{obs}|) < \\alpha & \\Longleftrightarrow 2 \\cdot P(Z < -|Z_\\text{obs}|) < \\alpha \\\\ & \\Longleftrightarrow P(Z < -|Z_\\text{obs}|) < \\alpha / 2 \\end{align} last statement exactly Zobsz1−α/2⇔x‾>μ0+z1−α/2σn \\begin{align} \\frac{\\bar x - \\mu_0}{\\sigma / \\sqrt{n}} > z_{1 - \\alpha / 2} & \\Longleftrightarrow \\bar x > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\end{align} x‾−μ0σ/nμ0+z1−α/2σn\\bar{x} > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} x‾<μ0+zα/2σn\\bar{x} < \\mu_0 + z_{\\alpha / 2} \\frac{\\sigma}{\\sqrt n}, power test μ=μA\\mu = \\mu_A P(reject H0|μ=μA)=P(x‾>μ0+z1−α/2σn|μ=μA)+P(x‾<μ0+zα/2σn|μ=μA). P(\\text{reject } H_0 \\left | \\mu = \\mu_A \\right .) = P\\left( \\left . \\bar x > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A \\right) + P\\left( \\left . \\bar x < \\mu_0 + z_{\\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A \\right). Remember X‾∼Normal(μ,σ2n)\\bar X \\sim \\mathrm{Normal} \\left(\\mu, \\frac{\\sigma^2}{n} \\right). means , given μ=μA\\mu = \\mu_A, x‾∼Normal(μ,σ2n)\\bar{x} \\sim \\mathrm{Normal} \\left(\\mu, \\frac{\\sigma^2}{n} \\right), let’s us calculate probabilities need find power: P(x‾>μ0+z1−α/2σn|μ=μA)=P(x‾−μAσ/n>μ0+z1−α/2σn−μAσ/n)=P(Z>μ0−μAσ/n+z1−α/2), \\begin{align} P\\left( \\left . \\bar{x} > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A \\right) &= P\\left( \\frac{\\bar{x} - \\mu_A}{\\sigma/\\sqrt{n}} > \\frac{\\mu_0 + z_{1-\\alpha/2}\\frac{\\sigma}{\\sqrt{n}} - \\mu_A}{\\sigma/\\sqrt{n}} \\right) \\\\ &= P\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right), \\end{align} similarly P(x‾<μ0+zα/2σn|μ=μA)=P(Z<μ0−μAσ/n+zα/2). P\\left( \\left . \\bar{x} < \\mu_0 + z_{\\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A\\right) = P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right). , power test, true population mean μA\\mu_A, Power=P(Z>μ0−μAσ/n+z1−α/2)+P(Z<μ0−μAσ/n+zα/2)=[1−P(Z<μ0−μAσ/n+z1−α/2)]+P(Z<μ0−μAσ/n+zα/2) \\begin{align} \\text{Power} &= P\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) + P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right) \\\\ &= \\left[1 - P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right)\\right] + P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right) \\end{align} Let’s calculate μA=5\\mu_A = 5. means probability reject null hypothesis (H0:μ=3H_0: \\mu = 3) true mean 55 0.89.","code":"power_lower <- (3 - 5) / (2 / sqrt(10)) + quantile(Z, 0.025) power_upper <- (3 - 5) / (2 / sqrt(10)) + quantile(Z, 1 - 0.025) cdf(Z, power_lower) + (1 - cdf(Z, power_upper)) #> [1] 0.8853791"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"formulas-for-sample-size-calculations","dir":"Articles","previous_headings":"Power and sample size calculations","what":"Formulas for sample size calculations","title":"One sample Z-tests","text":"Often times researchers like go direction: aim specific level power, calculate many observations needed reach level. achieve power 1−β1 - \\beta one sample Z-test H0:μ=μ0H_0 : \\mu = \\mu_0, need $$ n \\approx \\left( { \\sigma \\cdot (z_{\\alpha / 2} + z_\\beta) \\ \\mu_0 - \\mu_A } \\right)^2 $$ samples. nn integer, round . Often, denominator thought detectable difference. , question becomes many samples required sufficient power detect difference particular size. equation simply rewrite equation presented power. Recall, power two sided test Power=P(Z>μ0−μAσ/n+z1−α/2)+P(Z<μ0−μAσ/n+zα/2). \\text{Power} = P\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) + P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right). Usually, one terms contributing close zero. Let’s say first term one clearly different zero. determine sample size, want determine nn P(Z>μ0−μAσ/n+z1−α/2)=1−βP\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) = 1-\\beta. , similarly, P(Z<μ0−μAσ/n+z1−α/2)=βP\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) = \\beta. .e. need μ0−μAσ/n+z1−α/2=zβ\\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} = z_{\\beta}. zβ=μ0−μAσ/n+z1−α/2⇔zβ−z1−α/2=μ0−μAσ/n⇔σ(zβ−z1−α/2)=(μ0−μA)n⇔σ(zβ−z1−α/2)μ0−μA=n⇔(σ(zβ−z1−α/2)μ0−μA)2=n \\begin{align} z_{\\beta} = \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} & \\Longleftrightarrow z_{\\beta} - z_{1-\\alpha/2} = \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} \\\\ & \\Longleftrightarrow \\sigma (z_{\\beta} - z_{1-\\alpha/2}) = (\\mu_0-\\mu_A)\\sqrt{n} \\\\ & \\Longleftrightarrow \\frac{\\sigma (z_{\\beta} - z_{1-\\alpha/2})}{\\mu_0-\\mu_A} = \\sqrt{n} \\\\ & \\Longleftrightarrow \\left(\\frac{\\sigma (z_{\\beta} - z_{1-\\alpha/2})}{\\mu_0-\\mu_A}\\right)^2 = n \\end{align} Since z1−α/2=−zα/2z_{1-\\alpha/2} = -z_{\\alpha/2}, equation : (σ(zβ+zα/2)μ0−μA)2=n. \\left(\\frac{\\sigma (z_{\\beta} + z_{\\alpha/2})}{\\mu_0-\\mu_A}\\right)^2 = n. example, say student prior experiment determined wanted test number memes professors know love 2. want make sure sample size large enough likely reject null hypothesis true number 3. determine want probability 0.9 rejecting null true number 3. , sample size calculation looks like : $$ n \\approx \\left( { 2 \\cdot (1.96 + 1.28) \\ 2-3 } \\right)^2 = 41.99 $$ make sure reject null hypothesis probability 0.9 true value 3, ask 53 professors. calculation done R. Remember, β=1−Power\\beta = 1-\\text{Power}. Note small discrepancy. due rounding error.","code":"(2 * (quantile(Z, 0.05 / 2) + quantile(Z, 1 - 0.9)) / (3 - 2))^2 #> [1] 42.02969"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/paired-tests.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"Paired tests","text":"Suppose ’re interested people’s happiness discovering #rstats Twitter community. survey get happiness scores, using happiness survey goes 0 100. data looks like ","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/paired-tests.html","id":"working-with-the-differences","dir":"Articles","previous_headings":"","what":"Working with the differences","title":"Paired tests","text":"Crucially, since measurement measurement person, can subtract measurement measurement one sample test differences.","code":"before <- c(88, 73, 35, 21, 28, 56, 50, 73, 93, 55) after <- c(80, 78, 56, 28, 26, 50, 39, 67, 98, 63) diff <- after - before diff #> [1] -8 5 21 7 -2 -6 -11 -6 5 8"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/paired-tests.html","id":"paired-tests-versus-two-sample-tests","dir":"Articles","previous_headings":"","what":"Paired tests versus two sample tests","title":"Paired tests","text":"One key question : use paired instead two sample tests? Students typically struggle , ’s worth spending time thinking . abstract terms, use paired tests two observations experimental unit two sample tests two observations different experimental units. difficulty takes time become comfortable experimental units. recommend memorizing examples paired tests appropriate: left/right shoe examples use two sample test: Also note two sample tests, use pair - power pair can memorize analogize","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"the-poisson-distribution","dir":"Articles","previous_headings":"","what":"The Poisson distribution","title":"The Poisson distribution: From basic probability theory to regression models","text":"classic basic probability distribution employed modeling count data Poisson distribution. probability mass function f(y;λ)f(y; \\lambda) yields probability random variable YY take count y∈{0,1,2,…}y \\\\{0, 1, 2, \\dots\\} based distribution parameter λ>0\\lambda > 0: Pr(Y=y)=f(y;λ)=exp(−λ)⋅λyy!. \\text{Pr}(Y = y) = f(y; \\lambda) = \\frac{\\exp\\left(-\\lambda\\right) \\cdot \\lambda^y}{y!}. Poisson distribution many distinctive features, e.g., expectation variance equal given parameter λ\\lambda. Thus, E(Y)=λ\\text{E}(Y) = \\lambda Var(Y)=λ\\text{Var}(Y) = \\lambda. Moreover, Poisson distribution related basic probability distributions. Namely, can obtained limit binomial distribution number attempts high success probability low. Poisson distribution can approximated normal distribution λ\\lambda large. See Wikipedia (2022) properties references. distributions3 package Poisson distribution objects can generated Poisson() function. Subsequently, object can handled like distribution objects distributions3: print; extract mean variance; evaluate density, cumulative distribution, quantile function; simulate random samples. Using plot() method distribution can also visualized use show probabilities counts 0,1,…,150, 1, \\dots, 15 change parameter λ=0.5,2,5,10\\lambda = 0.5, 2, 5, 10. vignette illustrate infrastructure can leveraged obtain predicted probabilities number goals soccer matches 2018 FIFA World Cup.","code":"library(\"distributions3\") Y <- Poisson(lambda = 1.5) print(Y) ## [1] \"Poisson(lambda = 1.5)\" mean(Y) ## [1] 1.5 variance(Y) ## [1] 1.5 pdf(Y, 0:5) ## [1] 0.22313016 0.33469524 0.25102143 0.12551072 0.04706652 0.01411996 cdf(Y, 0:5) ## [1] 0.2231302 0.5578254 0.8088468 0.9343575 0.9814241 0.9955440 quantile(Y, c(0.1, 0.5, 0.9)) ## [1] 0 1 3 set.seed(0) random(Y, 5) ## [1] 3 1 1 2 3 plot(Poisson(0.5), main = expression(lambda == 0.5), xlim = c(0, 15)) plot(Poisson(2), main = expression(lambda == 2), xlim = c(0, 15)) plot(Poisson(5), main = expression(lambda == 5), xlim = c(0, 15)) plot(Poisson(10), main = expression(lambda == 10), xlim = c(0, 15))"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"goals-in-the-2018-fifa-world-cup","dir":"Articles","previous_headings":"","what":"Goals in the 2018 FIFA World Cup","title":"The Poisson distribution: From basic probability theory to regression models","text":"investigate number goals scored per match 2018 FIFA World Cup, FIFA2018 data set provides two rows, one team, 64 matches tournament. following, treat goals scored two teams match independent realistic assumption particular data set. just remark briefly also bivariate generalizations Poisson distribution allow correlated observations considered . addition goals, data set provides basic meta-information matches (ID, team name abbreviations, type match, group vs. knockout stage) well covariates revisit later document. data looks like : now, focus goals variable . brief summary yields showing teams scored 00 66 goals per match average y‾=1.297\\bar y = 1.297 observations yiy_i (=1,…,128i = 1, \\dots, 128). corresponding table observed relative frequencies : (Note recent versions R using proportions() rather prop.table() recommended.) confirms goals relatively rare events soccer game team scoring zero two goals per match almost 90 percent matches. show observed frequency distribution can approximated well Poisson distribution can subsequently used obtain predicted probabilities goals scored match.","code":"data(\"FIFA2018\", package = \"distributions3\") head(FIFA2018) ## goals team match type stage logability difference ## 1 5 RUS 1 A group 0.1530732 0.8638406 ## 2 0 KSA 1 A group -0.7107673 -0.8638406 ## 3 0 EGY 2 A group -0.2066409 -0.4438080 ## 4 1 URU 2 A group 0.2371671 0.4438080 ## 5 3 RUS 3 A group 0.1530732 0.3597142 ## 6 1 EGY 3 A group -0.2066409 -0.3597142 summary(FIFA2018$goals) ## Min. 1st Qu. Median Mean 3rd Qu. Max. ## 0.000 0.000 1.000 1.297 2.000 6.000 observed <- prop.table(table(FIFA2018$goals)) observed ## ## 0 1 2 3 4 5 6 ## 0.2578125 0.3750000 0.2500000 0.0781250 0.0156250 0.0156250 0.0078125"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"basic-fitted-distribution","dir":"Articles","previous_headings":"","what":"Basic fitted distribution","title":"The Poisson distribution: From basic probability theory to regression models","text":"first step, simply assume goals scored constant mean teams matches hence just fit single Poisson distribution number goals. , obtain point estimate Poisson parameter using empirical mean λ̂=y‾=1.297\\hat \\lambda = \\bar y = 1.297 set corresponding distribution object: technical details show actually corresponds maximum likelihood estimation distribution. already illustrated , expected probabilities observing counts 0,1,…,60, 1, \\dots, 6 goals Poisson distribution can extracted using pdf() method. comparison observed empirical frequencies yields large, observed expected frequencies rather close. However, reasonable teams score goals probabilities, imply winning losing just attributed “luck” “random variation” alone. Therefore, certain level randomness certainly remain, also consider stronger weaker teams tournament.","code":"p_const <- Poisson(lambda = mean(FIFA2018$goals)) p_const ## [1] \"Poisson(lambda = 1.297)\" expected <- pdf(p_const, 0:6) cbind(observed, expected) ## observed expected ## 0 0.2578125 0.273384787 ## 1 0.3750000 0.354545896 ## 2 0.2500000 0.229900854 ## 3 0.0781250 0.099384223 ## 4 0.0156250 0.032222229 ## 5 0.0156250 0.008357641 ## 6 0.0078125 0.001806469"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"poisson-regression-and-probabilistic-forecasting","dir":"Articles","previous_headings":"","what":"Poisson regression and probabilistic forecasting","title":"The Poisson distribution: From basic probability theory to regression models","text":"account different expected performances teams 2018 FIFA World Cup, FIFA2018 data provides estimated logability team. estimated Zeileis, Leitner, Hornik (2018) prior start tournament (2018-05-20) based quoted odds 26 online bookmakers using bookmaker consensus model Leitner, Zeileis, Hornik (2010). difference logability team opponent useful predictor number goals scored. Consequently, fit generalized linear model (GLM) data links expected number goals per team/match λi\\lambda_i linear predictor xi⊤βx_i^\\top \\beta regressor vector xi⊤=(1,𝚍𝚒𝚏𝚏𝚎𝚛𝚎𝚗𝚌𝚎i)x_i^\\top = (1, \\mathtt{difference}_i) corresponding coefficient vector β\\beta using log-link: log(λi)=xi⊤β\\log(\\lambda_i) = x_i^\\top \\beta. maximum likelihood estimator β̂\\hat \\beta corresponding inference, predictions, residuals, etc. can obtained using glm() function base R family = poisson: parameters can interpreted. First, intercept corresponds expected log-goals per team match two equally strong teams, .e., zero difference log-abilities. corresponding prediction number goals can either obtained manually extracted coef() applying exp() (inverse log-link). equivalently predict() function can used type = \"response\" order get expected λ̂\\hat \\lambda_i (rather just linear predictor xi⊤β̂x_i^\\top \\hat \\beta predicted default). , can also set Poisson() distribution object obtain associated expected probability distribution zero six goals mathc two equally strong teams: Second, slope 0.4130.413 can interpreted ability elasticity number goals scored. difference log-abilities can also understood log ability ratio. Thus, ability ratio increases 11 percent, expected number goals increases approximately 0.4130.413 percent. yields different predicted Poisson distribution team/match tournament. can set vector 128128Poisson() distribution objects extracting vector fitted point estimates (λ̂1,…,λ̂128)⊤(\\hat \\lambda_1, \\dots, \\hat \\lambda_{128})^\\top: Note specific elements vector p_reg Poisson distributions can extracted usual, e.g., index like p_reg[] using head() tail() functions etc. illustration, following goal distributions expected FIFA World Cup final (last two rows data) France won 4-2 Croatia: shows France expected score goals Croatia teams scored goals expected, albeit unlikely many.","code":"m <- glm(goals ~ difference, data = FIFA2018, family = poisson) summary(m) ## ## Call: ## glm(formula = goals ~ difference, family = poisson, data = FIFA2018) ## ## Coefficients: ## Estimate Std. Error z value Pr(>|z|) ## (Intercept) 0.21272 0.08125 2.618 0.00885 ** ## difference 0.41344 0.10579 3.908 9.31e-05 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## (Dispersion parameter for poisson family taken to be 1) ## ## Null deviance: 144.20 on 127 degrees of freedom ## Residual deviance: 128.69 on 126 degrees of freedom ## AIC: 359.39 ## ## Number of Fisher Scoring iterations: 5 lambda_zero <- exp(coef(m)[1]) lambda_zero ## (Intercept) ## 1.23704 predict(m, newdata = data.frame(difference = 0), type = \"response\") ## 1 ## 1.23704 p_zero <- Poisson(lambda = lambda_zero) pdf(p_zero, 0:6) ## [1] 0.290242139 0.359041061 0.222074031 0.091571467 0.028319386 0.007006441 ## [7] 0.001444541 p_reg <- Poisson(lambda = fitted(m)) length(p_reg) ## [1] 128 head(p_reg) ## 1 2 ## \"Poisson(lambda = 1.7680)\" \"Poisson(lambda = 0.8655)\" ## 3 4 ## \"Poisson(lambda = 1.0297)\" \"Poisson(lambda = 1.4862)\" ## 5 6 ## \"Poisson(lambda = 1.4354)\" \"Poisson(lambda = 1.0661)\" tail(FIFA2018, 2) ## goals team match type stage logability difference ## 127 4 FRA 64 Final knockout 0.8865638 0.6289619 ## 128 2 CRO 64 Final knockout 0.2576019 -0.6289619 p_final <- tail(p_reg, 2) p_final ## 127 128 ## \"Poisson(lambda = 1.6044)\" \"Poisson(lambda = 0.9538)\" pdf(p_final, 0:6) ## d_0 d_1 d_2 d_3 d_4 d_5 ## 127 0.2010078 0.3224993 0.2587107 0.13835949 0.05549639 0.017807808 ## 128 0.3852791 0.3674743 0.1752462 0.05571586 0.01328527 0.002534265 ## d_6 ## 127 0.0047618419 ## 128 0.0004028582"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"further-details-and-extensions","dir":"Articles","previous_headings":"","what":"Further details and extensions","title":"The Poisson distribution: From basic probability theory to regression models","text":"Assuming independence number goals scored, can obtain table possible match results (normal time) multiplying marginal probabilities (six goals). R done using outer() function default performs multiplication arguments. example, can see table expected probability France winning Croatia 1-0 12.4312.43 percent probability France loses 0-1 7.397.39 percent. advantage France can also brought clearly aggregating probabilities winning (lower triangular matrix), draw (diagonal), losing (upper triangular matrix). R can computed : Note probabilities sum 11 considered six goals per team goals can actually occur small probability. Next, update expected frequencies table averaging across expectations per team/match regression model. , observed expected frequencies reasonably close, emphasizing model good marginal fit data. bring discrepancies graphically show frequencies square root scale using -called hanging rootogram (Kleiber Zeileis 2016). gray bars represent square-root observed frequencies “hanging” square-root expected frequencies red line. offset around x-axis thus shows difference two frequencies reasonably close zero. Finally, want point log-abilities (thus differences) obtained based bookmakers odds prior tournament, calibration intercept slope coefficients done “-sample”. means used data tournament estimating GLM evaluation can made ex post. Alternatively, one used previous FIFA World Cups calibrating coefficients probabilistic forecasts outcome matches (thus entire tournament) obtained ex ante. approach used Groll et al. (2019) Groll et al. (2021) additionally added explanatory variables used flexible machine learning regression techniques rather simple Poisson GLM.","code":"res <- outer(pdf(p_final[1], 0:6), pdf(p_final[2], 0:6)) round(100 * res, digits = 2) ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] ## [1,] 7.74 7.39 3.52 1.12 0.27 0.05 0.01 ## [2,] 12.43 11.85 5.65 1.80 0.43 0.08 0.01 ## [3,] 9.97 9.51 4.53 1.44 0.34 0.07 0.01 ## [4,] 5.33 5.08 2.42 0.77 0.18 0.04 0.01 ## [5,] 2.14 2.04 0.97 0.31 0.07 0.01 0.00 ## [6,] 0.69 0.65 0.31 0.10 0.02 0.00 0.00 ## [7,] 0.18 0.17 0.08 0.03 0.01 0.00 0.00 sum(res[lower.tri(res)]) ## France wins ## [1] 0.5245018 sum(diag(res)) ## draw ## [1] 0.2497855 sum(res[upper.tri(res)]) ## France loses ## [1] 0.2242939 expected <- pdf(p_reg, 0:6) head(expected) ## d_0 d_1 d_2 d_3 d_4 d_5 d_6 ## 1 0.1706693 0.3017480 0.2667494 0.15720674 0.069486450 0.024570788 0.0072403041 ## 2 0.4208316 0.3642392 0.1576286 0.04547703 0.009840349 0.001703409 0.0002457231 ## 3 0.3571261 0.3677207 0.1893148 0.06497703 0.016726166 0.003444474 0.0005911098 ## 4 0.2262357 0.3362265 0.2498462 0.12377196 0.045986787 0.013668909 0.0033857384 ## 5 0.2380213 0.3416546 0.2452047 0.11732187 0.042100811 0.012086260 0.0028914265 ## 6 0.3443506 0.3671104 0.1956873 0.06954039 0.018534163 0.003951835 0.0007021718 expected <- colMeans(expected) cbind(observed, expected) ## observed expected ## 0 0.2578125 0.294374450 ## 1 0.3750000 0.340171469 ## 2 0.2500000 0.214456075 ## 3 0.0781250 0.098236077 ## 4 0.0156250 0.036594546 ## 5 0.0156250 0.011726654 ## 6 0.0078125 0.003332718 bp <- barplot(sqrt(observed), offset = sqrt(expected) - sqrt(observed), xlab = \"Goals\", ylab = \"sqrt(Frequency)\") lines(bp, sqrt(expected), type = \"o\", pch = 19, lwd = 2, col = 2) abline(h = 0, lty = 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"technical-details-maximum-likelihood-estimation-of-lambda","dir":"Articles","previous_headings":"","what":"Technical details: Maximum likelihood estimation of λ\\lambda","title":"The Poisson distribution: From basic probability theory to regression models","text":"Fitting single Poisson distribution constant λ\\lambda nn independent observations y1,…,yny_1, \\dots, y_n using maximum likelihood estimation can done analytically using basic algebra. First, set log-likelihood function ℓ\\ell sum log-densities per observation: ℓ(λ;y1,…,yn)=∑=1nlogf(yi;λ) \\begin{align*} \\ell(\\lambda; y_1, \\dots, y_n) & = \\sum_{= 1}^n \\log f(y_i; \\lambda) \\\\ \\end{align*} solving first-order condition analytically need score function, .e., derivative log-likelihood respect parameter λ\\lambda. derivative sum simply sum derivatives: ℓ′(λ;y1,…,yn)=∑=1n{logf(yi;λ)}′=∑=1n{−λ+yi⋅log(λ)−log(yi!)}′=∑=1n{−1+yi⋅1λ}=−n+1λ∑=1nyi \\begin{align*} \\ell^\\prime(\\lambda; y_1, \\dots, y_n) & = \\sum_{= 1}^n \\left\\{ \\log f(y_i; \\lambda) \\right\\}^\\prime \\\\ & = \\sum_{= 1}^n \\left\\{ -\\lambda + y_i \\cdot \\log(\\lambda) - \\log(y_i!) \\right\\}^\\prime \\\\ & = \\sum_{= 1}^n \\left\\{ -1 + y_i \\cdot \\frac{1}{\\lambda} \\right\\} \\\\ & = -n + \\frac{1}{\\lambda} \\sum_{= 1}^n y_i \\end{align*} first-order condition maximizing log-likelihood sets derivative zero. can solved follows: ℓ′(λ;y1,…,yn)=0−n+1λ∑=1nyi=0n⋅λ=∑=1nyiλ=1n∑=1nyi=y‾ \\begin{align*} \\ell^\\prime(\\lambda; y_1, \\dots, y_n) & = 0 \\\\ -n + \\frac{1}{\\lambda} \\sum_{= 1}^n y_i & = 0 \\\\ n \\cdot \\lambda & = \\sum_{= 1}^n y_i \\\\ \\lambda & = \\frac{1}{n} \\sum_{= 1}^n y_i = \\bar y \\end{align*} Thus, maximum likelihood estimator simply empirical mean λ̂=y‾.\\hat \\lambda = \\bar y. Unfortunately, parameter λ\\lambda constant depends linear predictor log link log(λi)=xi⊤β\\log(\\lambda_i) = x_i^\\top \\beta, corresponding log-likelihood regression coefficients β\\beta can maximized easily. closed-form solution maximum likelihood estimator β̂\\hat \\beta glm() function employs iterative numerical algorithm (-called iteratively weighted least squares) fitting model.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"Two sample Z-tests","text":"Let’s suppose student wants figure biology professors English professors know memes. student writes meme quiz springs 14 unsuspecting biology professors 18 unsuspecting English professors office hours. biology professors get following scores: 3,7,11,0,7,0,4,5,6,2,4,7,2,9 3, 7, 11, 0, 7, 0, 4, 5, 6, 2, 4, 7, 2, 9 English professors score: 5,5,4,5,4,5,7,2,6,2,2,7,2,6,4,2,5,2 5, 5, 4, 5, 4, 5, 7, 2, 6, 2, 2, 7, 2, 6, 4, 2, 5, 2 ’ll assume population variance biology professor scores σ12=3\\sigma^2_1 = 3 population variance English professor scores σ22=2\\sigma^2_2 = 2.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"Two sample Z-tests","text":"can Z-test, need make check can reasonably treat means sample normally distributed. happens case either following hold: data comes normal distribution. lots data. much? Many textbooks use 30 data points rule thumb. Since samples less 30 data points, need check plausibly normal distributions. check biology professor scores first using normal quantile-quantile plot. Since biology scores lies close line y=xy = x, notable systematic deviations line, ’s safe treat sample coming normal distribution. Honestly quantile-quantile plot good ’s suspicious. Anyway, next check English scores seems fine well. can also create side--side boxplots data using ggplot2 package get nice comparison two groups. requires little bit data manipulation: Based eye-balling data, ’d pretty surprised rejected null hypothesis equal means two groups.","code":"biology <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2, 4, 7, 2, 9) english <- c(8, 5, 4, 10, 4, 5, 7, 2, 6, 1, 2, 7, 0, 6, 4, 12, 5, 2) qqnorm(biology) qqline(biology) qqnorm(english) qqline(english) library(ggplot2) # make a data frame in long format for plotting test_results <- data.frame( score = c(biology, english), department = c( rep(\"biology\", length(biology)), rep(\"english\", length(english)) ) ) ggplot(test_results, aes(x = department, y = score, color = department)) + geom_boxplot() + geom_jitter() + scale_color_brewer(type = \"qual\", palette = 2) + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"Two sample Z-tests","text":"Let’s write null hypothesis (treat biology professors group 1 English professors group 2): H0:μ1−μ2=0HA:μ1−μ2≠0 H_0: \\mu_1 - \\mu_2 = 0 \\qquad H_A: \\mu_1 - \\mu_2 \\neq 0 First need calculate Z-statistic. Let’s use R. Remember Z-statistic defined Z=x‾1−x‾2−δ0σ12/n1+σ22/n2∼Normal(0,1) Z = \\frac{\\bar x_1 - \\bar x_2 - \\delta_0} {\\sqrt{\\sigma_1^2 / n_1 + \\sigma_2^2 / n_2}} \\sim \\mathrm{Normal}(0, 1) R looks like:","code":"delta_0 <- 0 # by assumption sigma_sq_1 <- 3 sigma_sq_2 <- 2 n_1 <- length(biology) n_2 <- length(english) # calculate the z-statistic z_stat <- (mean(biology) - mean(english) - delta_0) / sqrt(sigma_sq_1 / n_1 + sigma_sq_2 / n_2) z_stat #> [1] -0.3756527"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"Two sample Z-tests","text":"calculate two-sided p-value, need find P(|Z|≥|−0.376|)=P(Z≥0.376)+P(Z≤−0.376)=1−P(Z≤0.376)+P(Z≤−0.376)=1−Φ(0.376)+Φ(0.376) \\begin{align} P(|Z| \\ge |-0.376|) &= P(Z \\ge 0.376) + P(Z \\le -0.376) \\\\ &= 1 - P(Z \\le 0.376) + P(Z \\le -0.376) \\\\ &= 1 - \\Phi(0.376) + \\Phi(0.376) \\end{align} need c.d.f. standard normal Note saved z_stat also done slightly accurate since rounding error. p-value 0.71. verify Z-table. Note get value cdf(Z, -0.376) looking -0.376 Z-table. may also seen different formula p-value two-sided Z-test, makes use fact normal distribution symmetric: P(|Z|≥|−0.376|)=2⋅P(Z≤−|−0.376|)=2⋅Φ(−0.376) \\begin{align} P(|Z| \\ge |-0.376|) &= 2 \\cdot P(Z \\le -|-0.376|) &= 2 \\cdot \\Phi(-0.376) \\end{align} Using formula get result: Finally, sometimes interest one sided Z-tests. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} p-value given P(Z>−0.376) P(Z > -0.376) calculate test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 p-value given P(Z<−0.376) P(Z < -0.376) calculate ","code":"library(distributions3) Z <- Normal(0, 1) # make a standard normal r.v. 1 - cdf(Z, 0.376) + cdf(Z, -0.376) #> [1] 0.7069169 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.7071751 2 * cdf(Z, -0.376) #> [1] 0.7069169 1 - cdf(Z, -0.376) #> [1] 0.6465416 cdf(Z, -0.376) #> [1] 0.3534584"},{"path":"https://alexpghayes.github.io/distributions3/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Alex Hayes. Author, maintainer. Ralph Moller-Trane. Author. Emil Hvitfeldt. Contributor. Daniel Jordan. Author. Paul Northrop. Author. Moritz N. Lang. Author. Achim Zeileis. Author. Bruna Wundervald. Contributor. Alessandro Gasparini. Contributor.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Hayes , Moller-Trane R, Jordan D, Northrop P, Lang M, Zeileis (2024). distributions3: Probability Distributions S3 Objects. R package version 0.2.1.9000, https://alexpghayes.github.io/distributions3/, https://github.com/alexpghayes/distributions3.","code":"@Manual{, title = {distributions3: Probability Distributions as S3 Objects}, author = {Alex Hayes and Ralph Moller-Trane and Daniel Jordan and Paul Northrop and Moritz N. Lang and Achim Zeileis}, year = {2024}, note = {R package version 0.2.1.9000, https://alexpghayes.github.io/distributions3/}, url = {https://github.com/alexpghayes/distributions3}, }"},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"distributions3","dir":"","previous_headings":"","what":"Probability Distributions as S3 Objects","title":"Probability Distributions as S3 Objects","text":"distributions3, inspired eponynmous Julia package, provides generic function interface probability distributions. distributions3 two goals: Replace rnorm(), pnorm(), etc, family functions S3 methods distribution objects extremely well documented friendly students intro stat classes. main generics : random(): Draw samples distribution. pdf(): Evaluate probability density (mass) point. cdf(): Evaluate cumulative probability point. quantile(): Determine quantile given probability. Inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Probability Distributions as S3 Objects","text":"can install distributions3 : can install development version :","code":"install.packages(\"distributions3\") install.packages(\"devtools\") devtools::install_github(\"alexpghayes/distributions3\")"},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"basic-usage","dir":"","previous_headings":"","what":"Basic Usage","title":"Probability Distributions as S3 Objects","text":"basic usage distributions3 looks like: Note quantile() always returns lower tail probabilities. aren’t sure means, please read last several paragraphs vignette(\"one-sample-z-confidence-interval\") gander plot.","code":"library(\"distributions3\") X <- Bernoulli(0.1) random(X, 10) #> [1] 0 0 0 0 0 0 0 0 0 0 pdf(X, 1) #> [1] 0.1 cdf(X, 0) #> [1] 0.9 quantile(X, 0.5) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Probability Distributions as S3 Objects","text":"interested contributing distributions3, please reach Github! happy review PRs contributing bug fixes. Please note distributions3 released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"related-work","dir":"","previous_headings":"","what":"Related work","title":"Probability Distributions as S3 Objects","text":"comprehensive overview many packages providing various distribution related functionality see CRAN Task View. distributional provides distribution objects vectorized S3 objects distr6 builds distr, uses R6 objects distr quite similar distributions, uses S4 objects less focused documentation. fitdistrplus provides extensive functionality fitting various distributions treat distributions objects","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Bernoulli distribution — Bernoulli","title":"Create a Bernoulli distribution — Bernoulli","text":"Bernoulli distributions used represent events like coin flips single trial either successful unsuccessful. Bernoulli distribution special case Binomial() distribution n = 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Bernoulli distribution — Bernoulli","text":"","code":"Bernoulli(p = 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Bernoulli distribution — Bernoulli","text":"p success probability distribution. p can value [0, 1], defaults 0.5.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Bernoulli distribution — Bernoulli","text":"Bernoulli object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Bernoulli distribution — Bernoulli","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Bernoulli random variable parameter p = \\(p\\). textbooks also define \\(q = 1 - p\\), use \\(\\pi\\) instead \\(p\\). Bernoulli probability distribution widely used model binary variables, 'failure' 'success'. typical example flip coin, \\(p\\) thought probability flipping head, \\(q = 1 - p\\) probability flipping tail. Support: \\(\\{0, 1\\}\\) Mean: \\(p\\) Variance: \\(p \\cdot (1 - p) = p \\cdot q\\) Probability mass function (p.m.f): $$ P(X = x) = p^x (1 - p)^{1-x} = p^x q^{1-x} $$ Cumulative distribution function (c.d.f): $$ P(X \\le x) = \\left \\{ \\begin{array}{ll} 0 & x < 0 \\\\ 1 - p & 0 \\leq x < 1 \\\\ 1 & x \\geq 1 \\end{array} \\right. $$ Moment generating function (m.g.f): $$ E(e^{tX}) = (1 - p) + p e^t $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Bernoulli distribution — Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Beta distribution — Beta","title":"Create a Beta distribution — Beta","text":"Create Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Beta distribution — Beta","text":"","code":"Beta(alpha = 1, beta = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Beta distribution — Beta","text":"alpha alpha parameter. alpha can value strictly greater zero. Defaults 1. beta beta parameter. beta can value strictly greater zero. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Beta distribution — Beta","text":"beta object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Beta distribution — Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Binomial distribution — Binomial","title":"Create a Binomial distribution — Binomial","text":"Binomial distributions used represent situations can can thought result \\(n\\) Bernoulli experiments (\\(n\\) defined size experiment). classical example \\(n\\) independent coin flips, coin flip probability p success. case, individual probability flipping heads tails given Bernoulli(p) distribution, probability \\(x\\) equal results (\\(x\\) heads, example), \\(n\\) trials given Binomial(n, p) distribution. equation Binomial distribution directly derived equation Bernoulli distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Binomial distribution — Binomial","text":"","code":"Binomial(size, p = 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Binomial distribution — Binomial","text":"size number trials. Must integer greater equal one. size = 1L, Binomial distribution reduces bernoulli distribution. Often called n textbooks. p success probability given trial. p can value [0, 1], defaults 0.5.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Binomial distribution — Binomial","text":"Binomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Binomial distribution — Binomial","text":"Binomial distribution comes interested portion people thing. Binomial distribution also comes sign test, sometimes called Binomial test (see stats::binom.test()), may need Binomial C.D.F. compute p-values. recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Binomial random variable parameter size = \\(n\\) p = \\(p\\). textbooks define \\(q = 1 - p\\), called \\(\\pi\\) instead \\(p\\). Support: \\(\\{0, 1, 2, ..., n\\}\\) Mean: \\(np\\) Variance: \\(np \\cdot (1 - p) = np \\cdot q\\) Probability mass function (p.m.f): $$ P(X = k) = {n \\choose k} p^k (1 - p)^{n-k} $$ Cumulative distribution function (c.d.f): $$ P(X \\le k) = \\sum_{=0}^{\\lfloor k \\rfloor} {n \\choose } p^(1 - p)^{n-} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = (1 - p + p e^t)^n $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Binomial distribution — Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Categorical distribution — Categorical","title":"Create a Categorical distribution — Categorical","text":"Create Categorical distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Categorical distribution — Categorical","text":"","code":"Categorical(outcomes, p = NULL)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Categorical distribution — Categorical","text":"outcomes vector specifying elements sample space. Can numeric, factor, character, logical. p vector success probabilities outcome. element p can positive value – vector gets normalized internally. Defaults NULL, case distribution assumed uniform.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Categorical distribution — Categorical","text":"Categorical object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Categorical distribution — Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Cauchy distribution — Cauchy","title":"Create a Cauchy distribution — Cauchy","text":"Note Cauchy distribution student's t distribution one degree freedom. Cauchy distribution well defined mean variance. Cauchy distributions often appear priors Bayesian contexts due heavy tails.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Cauchy distribution — Cauchy","text":"","code":"Cauchy(location = 0, scale = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Cauchy distribution — Cauchy","text":"location location parameter. Can real number. Defaults 0. scale scale parameter. Must greater zero (?). Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Cauchy distribution — Cauchy","text":"Cauchy object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Cauchy distribution — Cauchy","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Cauchy variable mean location = \\(x_0\\) scale = \\(\\gamma\\). Support: \\(R\\), set real numbers Mean: Undefined. Variance: Undefined. Probability density function (p.d.f): $$ f(x) = \\frac{1}{\\pi \\gamma \\left[1 + \\left(\\frac{x - x_0}{\\gamma} \\right)^2 \\right]} $$ Cumulative distribution function (c.d.f): $$ F(t) = \\frac{1}{\\pi} \\arctan \\left( \\frac{t - x_0}{\\gamma} \\right) + \\frac{1}{2} $$ Moment generating function (m.g.f): exist.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Cauchy distribution — Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Chi-Square distribution — ChiSquare","title":"Create a Chi-Square distribution — ChiSquare","text":"Chi-square distributions show often frequentist settings sampling distribution test statistics, especially maximum likelihood estimation settings.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Chi-Square distribution — ChiSquare","text":"","code":"ChiSquare(df)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Chi-Square distribution — ChiSquare","text":"df Degrees freedom. Must positive.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Chi-Square distribution — ChiSquare","text":"ChiSquare object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Chi-Square distribution — ChiSquare","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) \\(\\chi^2\\) random variable df = \\(k\\). Support: \\(R^+\\), set positive real numbers Mean: \\(k\\) Variance: \\(2k\\) Probability density function (p.d.f): $$ f(x) = \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} $$ Cumulative distribution function (c.d.f): cumulative distribution function form $$ F(t) = \\int_{-\\infty}^t \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} dx $$ integral closed form solution must approximated numerically. c.d.f. standard normal sometimes called \"error function\". notation \\(\\Phi(t)\\) also stands c.d.f. standard normal evaluated \\(t\\). Z-tables list value \\(\\Phi(t)\\) various \\(t\\). Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\mu t + \\sigma^2 t^2 / 2} $$","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"transformations","dir":"Reference","previous_headings":"","what":"Transformations","title":"Create a Chi-Square distribution — ChiSquare","text":"squared standard Normal() distribution equivalent \\(\\chi^2_1\\) distribution one degree freedom. \\(\\chi^2\\) distribution special case Gamma() distribution shape (TODO: check ) parameter equal half. Sums \\(\\chi^2\\) distributions also distributed \\(\\chi^2\\) distributions, degrees freedom contributing distributions get summed. ratio two \\(\\chi^2\\) distributions FisherF() distribution. ratio Normal() square root scaled ChiSquare() StudentsT() distribution.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Chi-Square distribution — ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an Erlang distribution — Erlang","title":"Create an Erlang distribution — Erlang","text":"Erlang distribution two-parameter family continuous probability distributions support \\(x \\[0,\\infty)\\). two parameters positive integer shape parameter \\(k\\) positive real rate parameter \\(\\lambda\\). Erlang distribution shape parameter \\(k = 1\\) simplifies exponential distribution, special case gamma distribution. corresponds sum \\(k\\) independent exponential variables mean \\(1 / \\lambda\\) .","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an Erlang distribution — Erlang","text":"","code":"Erlang(k, lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an Erlang distribution — Erlang","text":"k shape parameter. Can positive integer number. lambda rate parameter. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an Erlang distribution — Erlang","text":"Erlang object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an Erlang distribution — Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an Exponential distribution — Exponential","title":"Create an Exponential distribution — Exponential","text":"Exponential distributions frequently used modeling amount time passes specific event occurs. example, exponential distributions used model time two earthquakes, amount delay internet packets, amount time piece machinery can run needing repair.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an Exponential distribution — Exponential","text":"","code":"Exponential(rate = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an Exponential distribution — Exponential","text":"rate rate parameter, written \\(\\lambda\\) textbooks. Can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an Exponential distribution — Exponential","text":"Exponential object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an Exponential distribution — Exponential","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Exponential random variable rate parameter rate = \\(\\lambda\\). Support: \\(x \\(0, \\infty)\\) Mean: \\(\\frac{1}{\\lambda}\\) Variance: \\(\\frac{1}{\\lambda^2}\\) Probability density function (p.d.f): $$ f(x) = \\lambda e^{-\\lambda x} $$ Cumulative distribution function (c.d.f): $$ F(x) = 1 - e^{-\\lambda x} $$ Moment generating function (m.g.f): $$ \\frac{\\lambda}{\\lambda - t}, t < \\lambda $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an Exponential distribution — Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":null,"dir":"Reference","previous_headings":"","what":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"Data 64 matches 2018 FIFA World Cup along predicted ability differences based bookmakers odds.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"","code":"data(\"FIFA2018\", package = \"distributions3\")"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"data frame 128 rows 7 columns. goals integer. Number goals scored normal time (90 minutes), \\ .e., excluding potential extra time penalties knockout matches. team character. 3-letter FIFA code team. match integer. Match ID ranging 1 (opening match) 64 (final). type factor. Type match groups H, round 16 (R16), quarter final, semi-final, match 3rd place, final. stage factor. Group vs. knockout tournament stage. logability numeric. Estimated log-ability team based bookmaker consensus model. difference numeric. Difference estimated log-abilities team opponent match.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"goals match obtained Wikipedia (https://en.wikipedia.org/wiki/2018_FIFA_World_Cup) log-abilities Zeileis et al. (2018) based quoted odds Oddschecker.com Bwin.com.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"investigate number goals scored per match 2018 FIFA World Cup, FIFA2018 provides two rows, one team, matches tournament. addition basic meta-information matches (ID, team name abbreviations, type match, group vs. knockout stage), information estimated log-ability team provided. estimated Zeileis et al. (2018) prior start tournament (2018-05-20) based quoted odds 26 online bookmakers using bookmaker consensus model Leitner et al. (2010). difference log-ability team opponent useful predictor number goals scored. model data basic Poisson regression model provides good fit. treats number goals two teams independent given ability difference reasonable assumption data set.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"Leitner C, Zeileis , Hornik K (2010). Forecasting Sports Tournaments Ratings (Prob)abilities: Comparison EURO 2008. International Journal Forecasting, 26(3), 471-481. doi:10.1016/j.ijforecast.2009.10.001 Zeileis , Leitner C, Hornik K (2018). Probabilistic Forecasts 2018 FIFA World Cup Based Bookmaker Consensus Model. Working Paper 2018-09, Working Papers Economics Statistics, Research Platform Empirical Experimental Economics, University Innsbruck. https://EconPapers.RePEc.org/RePEc:inn:wpaper:2018-09","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"","code":"## load data data(\"FIFA2018\", package = \"distributions3\") ## observed relative frequencies of goals in all matches obsrvd <- prop.table(table(FIFA2018$goals)) ## expected probabilities assuming a simple Poisson model, ## using the average number of goals across all teams/matches ## as the point estimate for the mean (lambda) of the distribution p_const <- Poisson(lambda = mean(FIFA2018$goals)) p_const #> [1] \"Poisson(lambda = 1.297)\" expctd <- pdf(p_const, 0:6) ## comparison: observed vs. expected frequencies ## frequencies for 3 and 4 goals are slightly overfitted ## while 5 and 6 goals are slightly underfitted cbind(\"observed\" = obsrvd, \"expected\" = expctd) #> observed expected #> 0 0.2578125 0.273384787 #> 1 0.3750000 0.354545896 #> 2 0.2500000 0.229900854 #> 3 0.0781250 0.099384223 #> 4 0.0156250 0.032222229 #> 5 0.0156250 0.008357641 #> 6 0.0078125 0.001806469 ## instead of fitting the same average Poisson model to all ## teams/matches, take ability differences into account m <- glm(goals ~ difference, data = FIFA2018, family = poisson) summary(m) #> #> Call: #> glm(formula = goals ~ difference, family = poisson, data = FIFA2018) #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) 0.21272 0.08125 2.618 0.00885 ** #> difference 0.41344 0.10579 3.908 9.31e-05 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for poisson family taken to be 1) #> #> Null deviance: 144.20 on 127 degrees of freedom #> Residual deviance: 128.69 on 126 degrees of freedom #> AIC: 359.39 #> #> Number of Fisher Scoring iterations: 5 #> ## when the ratio of abilities increases by 1 percent, the ## expected number of goals increases by around 0.4 percent ## this yields a different predicted Poisson distribution for ## each team/match p_reg <- Poisson(lambda = fitted(m)) head(p_reg) #> 1 2 #> \"Poisson(lambda = 1.7680)\" \"Poisson(lambda = 0.8655)\" #> 3 4 #> \"Poisson(lambda = 1.0297)\" \"Poisson(lambda = 1.4862)\" #> 5 6 #> \"Poisson(lambda = 1.4354)\" \"Poisson(lambda = 1.0661)\" ## as an illustration, the following goal distributions ## were expected for the final (that France won 4-2 against Croatia) p_final <- tail(p_reg, 2) p_final #> 127 128 #> \"Poisson(lambda = 1.6044)\" \"Poisson(lambda = 0.9538)\" pdf(p_final, 0:6) #> d_0 d_1 d_2 d_3 d_4 d_5 #> 127 0.2010078 0.3224993 0.2587107 0.13835949 0.05549639 0.017807808 #> 128 0.3852791 0.3674743 0.1752462 0.05571586 0.01328527 0.002534265 #> d_6 #> 127 0.0047618419 #> 128 0.0004028582 ## clearly France was expected to score more goals than Croatia ## but both teams scored more goals than expected, albeit not unlikely many ## assuming independence of the number of goals scored, obtain ## table of possible match results (after normal time), along with ## overall probabilities of win/draw/lose res <- outer(pdf(p_final[1], 0:6), pdf(p_final[2], 0:6)) sum(res[lower.tri(res)]) ## France wins #> [1] 0.5245018 sum(diag(res)) ## draw #> [1] 0.2497855 sum(res[upper.tri(res)]) ## France loses #> [1] 0.2242939 ## update expected frequencies table based on regression model expctd <- pdf(p_reg, 0:6) head(expctd) #> d_0 d_1 d_2 d_3 d_4 d_5 d_6 #> 1 0.1706693 0.3017480 0.2667494 0.15720674 0.069486450 0.024570788 0.0072403041 #> 2 0.4208316 0.3642392 0.1576286 0.04547703 0.009840349 0.001703409 0.0002457231 #> 3 0.3571261 0.3677207 0.1893148 0.06497703 0.016726166 0.003444474 0.0005911098 #> 4 0.2262357 0.3362265 0.2498462 0.12377196 0.045986787 0.013668909 0.0033857384 #> 5 0.2380213 0.3416546 0.2452047 0.11732187 0.042100811 0.012086260 0.0028914265 #> 6 0.3443506 0.3671104 0.1956873 0.06954039 0.018534163 0.003951835 0.0007021718 expctd <- colMeans(expctd) cbind(\"observed\" = obsrvd, \"expected\" = expctd) #> observed expected #> 0 0.2578125 0.294374450 #> 1 0.3750000 0.340171469 #> 2 0.2500000 0.214456075 #> 3 0.0781250 0.098236077 #> 4 0.0156250 0.036594546 #> 5 0.0156250 0.011726654 #> 6 0.0078125 0.003332718"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an F distribution — FisherF","title":"Create an F distribution — FisherF","text":"Create F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an F distribution — FisherF","text":"","code":"FisherF(df1, df2, lambda = 0)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an F distribution — FisherF","text":"df1 Numerator degrees freedom. Can positive number. df2 Denominator degrees freedom. Can positive number. lambda Non-centrality parameter. Can positive number. Defaults 0.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an F distribution — FisherF","text":"FisherF object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an F distribution — FisherF","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. TODO","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an F distribution — FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Frechet distribution — Frechet","title":"Create a Frechet distribution — Frechet","text":"Frechet distribution special case \\link{GEV} distribution, obtained GEV shape parameter \\(\\xi\\) positive. may referred type II extreme value distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Frechet distribution — Frechet","text":"","code":"Frechet(location = 0, scale = 1, shape = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Frechet distribution — Frechet","text":"location location (minimum) parameter \\(m\\). location can real number. Defaults 0. scale scale parameter \\(s\\). scale can positive number. Defaults 1. shape shape parameter \\(\\alpha\\). shape can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Frechet distribution — Frechet","text":"Frechet object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Frechet distribution — Frechet","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Frechet random variable location parameter location = \\(m\\), scale parameter scale = \\(s\\), shape parameter shape = \\(\\alpha\\). Frechet(\\(m, s, \\alpha\\)) distribution equivalent \\link{GEV}(\\(m + s, s / \\alpha, 1 / \\alpha\\)) distribution. Support: \\((m, \\infty)\\). Mean: \\(m + s\\Gamma(1 - 1/\\alpha)\\), \\(\\alpha > 1\\); undefined otherwise. Median: \\(m + s(\\ln 2)^{-1/\\alpha}\\). Variance: \\(s^2 [\\Gamma(1 - 2 / \\alpha) - \\Gamma(1 - 1 / \\alpha)^2]\\) \\(\\alpha > 2\\); undefined otherwise. Probability density function (p.d.f): $$f(x) = \\alpha s ^ {-1} [(x - m) / s] ^ {-(1 + \\alpha)}% \\exp\\{-[(x - m) / s] ^ {-\\alpha} \\}$$ \\(x > m\\). p.d.f. 0 \\(x \\leq m\\). Cumulative distribution function (c.d.f): $$F(x) = \\exp\\{-[(x - m) / s] ^ {-\\alpha} \\}$$ \\(x > m\\). c.d.f. 0 \\(x \\leq m\\).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Frechet distribution — Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Generalised Extreme Value (GEV) distribution — GEV","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"GEV distribution arises Extremal Types Theorem, rather like Central Limit Theorem (see \\link{Normal}) relates maximum \\(n\\) ..d. random variables rather sum. , suitable linear rescaling, distribution maximum tends non-degenerate limit \\(n\\) tends infinity limit must GEV distribution. requirement variables independent can relaxed substantially. Therefore, GEV distribution often used model maximum large number random variables.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"","code":"GEV(mu = 0, sigma = 1, xi = 0)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"mu location parameter, written \\(\\mu\\) textbooks. mu can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks. sigma can positive number. Defaults 1. xi shape parameter, written \\(\\xi\\) textbooks. xi can real number. Defaults 0, corresponds Gumbel distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"GEV object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) GEV random variable location parameter mu = \\(\\mu\\), scale parameter sigma = \\(\\sigma\\) shape parameter xi = \\(\\xi\\). Support: \\((-\\infty, \\mu - \\sigma / \\xi)\\) \\(\\xi < 0\\); \\((\\mu - \\sigma / \\xi, \\infty)\\) \\(\\xi > 0\\); \\(R\\), set real numbers, \\(\\xi = 0\\). Mean: \\(\\mu + \\sigma[\\Gamma(1 - \\xi) - 1]/\\xi\\) \\(\\xi < 1, \\xi \\neq 0\\); \\(\\mu + \\sigma\\gamma\\) \\(\\xi = 0\\), \\(\\gamma\\) Euler's constant, approximately equal 0.57722; undefined otherwise. Median: \\(\\mu + \\sigma[(\\ln 2) ^ {-\\xi} - 1]/\\xi\\) \\(\\xi \\neq 0\\); \\(\\mu - \\sigma\\ln(\\ln 2)\\) \\(\\xi = 0\\). Variance: \\(\\sigma^2 [\\Gamma(1 - 2 \\xi) - \\Gamma(1 - \\xi)^2] / \\xi^2\\) \\(\\xi < 1 / 2, \\xi \\neq 0\\); \\(\\sigma^2 \\pi^2 / 6\\) \\(\\xi = 0\\); undefined otherwise. Probability density function (p.d.f): \\(\\xi \\neq 0\\) $$f(x) = \\sigma ^ {-1} [1 + \\xi (x - \\mu) / \\sigma] ^ {-(1 + 1/\\xi)}% \\exp\\{-[1 + \\xi (x - \\mu) / \\sigma] ^ {-1/\\xi} \\}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). p.d.f. 0 outside support. \\(\\xi = 0\\) (Gumbel) special case $$f(x) = \\sigma ^ {-1} \\exp[-(x - \\mu) / \\sigma]% \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers. Cumulative distribution function (c.d.f): \\(\\xi \\neq 0\\) $$F(x) = \\exp\\{-[1 + \\xi (x - \\mu) / \\sigma] ^ {-1/\\xi} \\}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). c.d.f. 0 support 1 support. \\(\\xi = 0\\) (Gumbel) special case $$F(x) = \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Generalised Pareto (GP) distribution — GP","title":"Create a Generalised Pareto (GP) distribution — GP","text":"GP distribution link \\link{GEV} distribution. Suppose maximum \\(n\\) ..d. random variables approximately GEV distribution. sufficiently large threshold \\(u\\), conditional distribution amount (threshold excess) variable exceeds \\(u\\) given exceeds \\(u\\) approximately GP distribution. Therefore, GP distribution often used model threshold excesses high threshold \\(u\\). requirement variables independent can relaxed substantially, exceedances \\(u\\) may cluster.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Generalised Pareto (GP) distribution — GP","text":"","code":"GP(mu = 0, sigma = 1, xi = 0)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Generalised Pareto (GP) distribution — GP","text":"mu location parameter, written \\(\\mu\\) textbooks. mu can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks. sigma can positive number. Defaults 1. xi shape parameter, written \\(\\xi\\) textbooks. xi can real number. Defaults 0, corresponds Gumbel distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Generalised Pareto (GP) distribution — GP","text":"GP object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Generalised Pareto (GP) distribution — GP","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) GP random variable location parameter mu = \\(\\mu\\), scale parameter sigma = \\(\\sigma\\) shape parameter xi = \\(\\xi\\). Support: \\([\\mu, \\mu - \\sigma / \\xi]\\) \\(\\xi < 0\\); \\([\\mu, \\infty)\\) \\(\\xi \\geq 0\\). Mean: \\(\\mu + \\sigma/(1 - \\xi)\\) \\(\\xi < 1\\); undefined otherwise. Median: \\(\\mu + \\sigma[2 ^ \\xi - 1]/\\xi\\) \\(\\xi \\neq 0\\); \\(\\mu + \\sigma\\ln 2\\) \\(\\xi = 0\\). Variance: \\(\\sigma^2 / (1 - \\xi)^2 (1 - 2\\xi)\\) \\(\\xi < 1 / 2\\); undefined otherwise. Probability density function (p.d.f): \\(\\xi \\neq 0\\) $$f(x) = \\sigma^{-1} [1 + \\xi (x - \\mu) / \\sigma] ^ {-(1 + 1/\\xi)}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). p.d.f. 0 outside support. \\(\\xi = 0\\) special case $$f(x) = \\sigma ^ {-1} \\exp[-(x - \\mu) / \\sigma]$$ \\(x\\) [\\(\\mu, \\infty\\)). p.d.f. 0 outside support. Cumulative distribution function (c.d.f): \\(\\xi \\neq 0\\) $$F(x) = 1 - \\exp\\{-[1 + \\xi (x - \\mu) / \\sigma] ^ {-1/\\xi} \\}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). c.d.f. 0 support 1 support. \\(\\xi = 0\\) special case $$F(x) = 1 - \\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Generalised Pareto (GP) distribution — GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Gamma distribution — Gamma","title":"Create a Gamma distribution — Gamma","text":"Several important distributions special cases Gamma distribution. shape parameter 1, Gamma exponential distribution parameter \\(1/\\beta\\). \\(shape = n/2\\) \\(rate = 1/2\\), Gamma equivalent chi squared distribution n degrees freedom. Moreover, \\(X_1\\) \\(Gamma(\\alpha_1, \\beta)\\) \\(X_2\\) \\(Gamma(\\alpha_2, \\beta)\\), function two variables form \\(\\frac{X_1}{X_1 + X_2}\\) \\(Beta(\\alpha_1, \\alpha_2)\\). last property frequently appears another distributions, extensively used multivariate methods. Gamma distribution added soon.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Gamma distribution — Gamma","text":"","code":"Gamma(shape, rate = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Gamma distribution — Gamma","text":"shape shape parameter. Can positive number. rate rate parameter. Can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Gamma distribution — Gamma","text":"Gamma object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Gamma distribution — Gamma","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Gamma random variable parameters shape = \\(\\alpha\\) rate = \\(\\beta\\). Support: \\(x \\(0, \\infty)\\) Mean: \\(\\frac{\\alpha}{\\beta}\\) Variance: \\(\\frac{\\alpha}{\\beta^2}\\) Probability density function (p.m.f): $$ f(x) = \\frac{\\beta^{\\alpha}}{\\Gamma(\\alpha)} x^{\\alpha - 1} e^{-\\beta x} $$ Cumulative distribution function (c.d.f): $$ f(x) = \\frac{\\Gamma(\\alpha, \\beta x)}{\\Gamma{\\alpha}} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = \\Big(\\frac{\\beta}{ \\beta - t}\\Big)^{\\alpha}, \\thinspace t < \\beta $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Gamma distribution — Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Geometric distribution — Geometric","title":"Create a Geometric distribution — Geometric","text":"Geometric distribution can thought generalization Bernoulli() distribution ask: \"keep flipping coin probability p heads, probability need \\(k\\) flips get first heads?\" Geometric distribution special case Negative Binomial distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Geometric distribution — Geometric","text":"","code":"Geometric(p = 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Geometric distribution — Geometric","text":"p success probability distribution. p can value [0, 1], defaults 0.5.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Geometric distribution — Geometric","text":"Geometric object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Geometric distribution — Geometric","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Geometric random variable success probability p = \\(p\\). Note multiple parameterizations Geometric distribution. Support: 0 < p < 1, \\(x = 0, 1, \\dots\\) Mean: \\(\\frac{1-p}{p}\\) Variance: \\(\\frac{1-p}{p^2}\\) Probability mass function (p.m.f): $$ P(X = x) = p(1-p)^x, $$ Cumulative distribution function (c.d.f): $$ P(X \\le x) = 1 - (1-p)^{x+1} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = \\frac{pe^t}{1 - (1-p)e^t} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Geometric distribution — Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Gumbel distribution — Gumbel","title":"Create a Gumbel distribution — Gumbel","text":"Gumbel distribution special case \\link{GEV} distribution, obtained GEV shape parameter \\(\\xi\\) equal 0. may referred type extreme value distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Gumbel distribution — Gumbel","text":"","code":"Gumbel(mu = 0, sigma = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Gumbel distribution — Gumbel","text":"mu location parameter, written \\(\\mu\\) textbooks. mu can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks. sigma can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Gumbel distribution — Gumbel","text":"Gumbel object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Gumbel distribution — Gumbel","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Gumbel random variable location parameter mu = \\(\\mu\\), scale parameter sigma = \\(\\sigma\\). Support: \\(R\\), set real numbers. Mean: \\(\\mu + \\sigma\\gamma\\), \\(\\gamma\\) Euler's constant, approximately equal 0.57722. Median: \\(\\mu - \\sigma\\ln(\\ln 2)\\). Variance: \\(\\sigma^2 \\pi^2 / 6\\). Probability density function (p.d.f): $$f(x) = \\sigma ^ {-1} \\exp[-(x - \\mu) / \\sigma]% \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers. Cumulative distribution function (c.d.f): \\(\\xi = 0\\) (Gumbel) special case $$F(x) = \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Gumbel distribution — Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"Hurdle negative binomial distributions frequently used model counts overdispersion many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"","code":"HurdleNegativeBinomial(mu, theta, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"mu Location parameter negative binomial component distribution. Can positive number. theta Overdispersion parameter negative binomial component distribution. Can positive number. pi Zero-hurdle probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"HurdleNegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) hurdle negative binomial random variable parameters mu = \\(\\mu\\) theta = \\(\\theta\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: $$ \\mu \\cdot \\frac{\\pi}{1 - F(0; \\mu, \\theta)} $$ \\(F(k; \\mu)\\) c.d.f. NegativeBinomial distribution. Variance: $$ m \\cdot \\left(1 + \\frac{\\mu}{\\theta} + \\mu - m \\right) $$ \\(m\\) mean . Probability mass function (p.m.f.): \\(P(X = 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X = k) = \\pi \\cdot \\frac{f(k; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ \\(f(k; \\mu, \\theta)\\) p.m.f. NegativeBinomial distribution. Cumulative distribution function (c.d.f.): \\(P(X \\le 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X \\le k) = 1 - \\pi + \\pi \\cdot \\frac{F(k; \\mu, \\theta) - F(0; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a hurdle Poisson distribution — HurdlePoisson","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"Hurdle Poisson distributions frequently used model counts many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"","code":"HurdlePoisson(lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"lambda Parameter Poisson component distribution. Can positive number. pi Zero-hurdle probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"HurdlePoisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) hurdle Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: $$ \\lambda \\cdot \\frac{\\pi}{1 - e^{-\\lambda}} $$ Variance: \\(m \\cdot (\\lambda + 1 - m)\\), \\(m\\) mean . Probability mass function (p.m.f.): \\(P(X = 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X = k) = \\pi \\cdot \\frac{f(k; \\lambda)}{1 - f(0; \\lambda)} $$ \\(f(k; \\lambda)\\) p.m.f. Poisson distribution. Cumulative distribution function (c.d.f.): \\(P(X \\le 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X \\le k) = 1 - \\pi + \\pi \\cdot \\frac{F(k; \\lambda) - F(0; \\lambda)}{1 - F(0; \\lambda)} $$ \\(F(k; \\lambda)\\) c.d.f. Poisson distribution. Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a HyperGeometric distribution — HyperGeometric","title":"Create a HyperGeometric distribution — HyperGeometric","text":"understand HyperGeometric distribution, consider set \\(r\\) objects, \\(m\\) type \\(n\\) type II. sample size \\(k\\) (\\(k [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a LogNormal distribution — LogNormal","title":"Create a LogNormal distribution — LogNormal","text":"random variable created exponentiating Normal() distribution. Taking log LogNormal data returns Normal() data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a LogNormal distribution — LogNormal","text":"","code":"LogNormal(log_mu = 0, log_sigma = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a LogNormal distribution — LogNormal","text":"log_mu location parameter, written \\(\\mu\\) textbooks. Can real number. Defaults 0. log_sigma scale parameter, written \\(\\sigma\\) textbooks. Can positive real number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a LogNormal distribution — LogNormal","text":"LogNormal object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a LogNormal distribution — LogNormal","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) LogNormal random variable success probability p = \\(p\\). Support: \\(R^+\\) Mean: \\(\\exp(\\mu + \\sigma^2/2)\\) Variance: \\([\\exp(\\sigma^2)-1]\\exp(2\\mu+\\sigma^2)\\) Probability density function (p.d.f): $$ f(x) = \\frac{1}{x \\sigma \\sqrt{2 \\pi}} \\exp \\left(-\\frac{(\\log x - \\mu)^2}{2 \\sigma^2} \\right) $$ Cumulative distribution function (c.d.f): $$F(x) = \\frac{1}{2} + \\frac{1}{2\\sqrt{pi}}\\int_{-x}^x e^{-t^2} dt$$ Moment generating function (m.g.f): Undefined.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a LogNormal distribution — LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Logistic distribution — Logistic","title":"Create a Logistic distribution — Logistic","text":"continuous distribution real line. binary outcomes model given \\(P(Y = 1 | X) = F(X \\beta)\\) \\(F\\) Logistic cdf() called logistic regression.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Logistic distribution — Logistic","text":"","code":"Logistic(location = 0, scale = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Logistic distribution — Logistic","text":"location location parameter distribution. Logistic distributions, location parameter mean, median also mode. Defaults zero. scale scale parameter distribution. Defaults one.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Logistic distribution — Logistic","text":"Logistic object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Logistic distribution — Logistic","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Logistic random variable location = \\(\\mu\\) scale = \\(s\\). Support: \\(R\\), set real numbers Mean: \\(\\mu\\) Variance: \\(s^2 \\pi^2 / 3\\) Probability density function (p.d.f): $$ f(x) = \\frac{e^{-(\\frac{x - \\mu}{s})}}{s [1 + \\exp(-(\\frac{x - \\mu}{s})) ]^2} $$ Cumulative distribution function (c.d.f): $$ F(t) = \\frac{1}{1 + e^{-(\\frac{t - \\mu}{s})}} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\mu t} \\beta(1 - st, 1 + st) $$ \\(\\beta(x, y)\\) Beta function.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Logistic distribution — Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Multinomial distribution — Multinomial","title":"Create a Multinomial distribution — Multinomial","text":"multinomial distribution generalization binomial distribution multiple categories. perhaps easiest think first extend Bernoulli() distribution include two categories, resulting Categorical() distribution. extend repeat Categorical experiment several (\\(n\\)) times.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Multinomial distribution — Multinomial","text":"","code":"Multinomial(size, p)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Multinomial distribution — Multinomial","text":"size number trials. Must integer greater equal one. size = 1L, Multinomial distribution reduces categorical distribution (also called discrete uniform). Often called n textbooks. p vector success probabilities trial. p can take positive value, vector normalized internally.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Multinomial distribution — Multinomial","text":"Multinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Multinomial distribution — Multinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X = (X_1, ..., X_k)\\) Multinomial random variable success probability p = \\(p\\). Note \\(p\\) vector \\(k\\) elements sum one. Assume repeat Categorical experiment size = \\(n\\) times. Support: \\(X_i\\) \\({0, 1, 2, ..., n}\\). Mean: mean \\(X_i\\) \\(n p_i\\). Variance: variance \\(X_i\\) \\(n p_i (1 - p_i)\\). \\(\\neq j\\), covariance \\(X_i\\) \\(X_j\\) \\(-n p_i p_j\\). Probability mass function (p.m.f): $$ P(X_1 = x_1, ..., X_k = x_k) = \\frac{n!}{x_1! x_2! ... x_k!} p_1^{x_1} \\cdot p_2^{x_2} \\cdot ... \\cdot p_k^{x_k} $$ Cumulative distribution function (c.d.f): Omitted multivariate random variables time . Moment generating function (m.g.f): $$ E(e^{tX}) = \\left(\\sum_{=1}^k p_i e^{t_i}\\right)^n $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Multinomial distribution — Multinomial","text":"","code":"set.seed(27) X <- Multinomial(size = 5, p = c(0.3, 0.4, 0.2, 0.1)) X #> Multinomial distribution (size = 5, p = [0.3, 0.4, ..., 0.1]) random(X, 10) #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 4 3 1 0 2 2 4 2 0 1 #> [2,] 1 1 4 4 1 1 1 3 1 1 #> [3,] 0 1 0 1 1 1 0 0 3 3 #> [4,] 0 0 0 0 1 1 0 0 1 0 # pdf(X, 2) # log_pdf(X, 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a negative binomial distribution — NegativeBinomial","title":"Create a negative binomial distribution — NegativeBinomial","text":"generalization geometric distribution. number failures sequence ..d. Bernoulli trials specified target number (\\(r\\)) successes occurs.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a negative binomial distribution — NegativeBinomial","text":"","code":"NegativeBinomial(size, p = 0.5, mu = size)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a negative binomial distribution — NegativeBinomial","text":"size target number successes (greater \\(0\\)) experiment stopped. Denoted \\(r\\) . p success probability given trial. p can value [0, 1], defaults 0.5. mu Alternative parameterization via non-negative mean distribution (instead probability p), defaults size.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a negative binomial distribution — NegativeBinomial","text":"NegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a negative binomial distribution — NegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) negative binomial random variable success probability p = \\(p\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\(\\frac{(1 - p) r}{p} = \\mu\\) Variance: \\(\\frac{(1 - p) r}{p^2}\\) Probability mass function (p.m.f.): $$ f(k) = {k + r - 1 \\choose k} \\cdot p^r (1-p)^k $$ Cumulative distribution function (c.d.f.): Omitted now. Moment generating function (m.g.f.): $$ \\left(\\frac{p}{1 - (1 -p) e^t}\\right)^r, t < -\\log (1-p) $$ Alternative parameterization: Sometimes, especially used regression models, negative binomial distribution parameterized mean \\(\\mu\\) (listed ) plus size parameter \\(r\\). implies success probability \\(p = r/(r + \\mu)\\). can also seen generalization Poisson distribution assumption equidispersion (.e., variance equal mean) relaxed. negative binomial distribution overdispersed (.e., variance greater mean) variance can also written \\(\\mu + 1/r \\mu^2\\). Poisson distribution obtained \\(r\\) goes infinity. Note view natural also allow non-integer \\(r\\) parameters. factorials equations expressed terms gamma function.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a negative binomial distribution — NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Normal distribution — Normal","title":"Create a Normal distribution — Normal","text":"Normal distribution ubiquitous statistics, partially central limit theorem, states sums ..d. random variables eventually become Normal. Linear transformations Normal random variables result new random variables also Normal. taking intro stats course, likely use Normal distribution Z-tests simple linear regression. regularity conditions, maximum likelihood estimators asymptotically Normal. Normal distribution also called gaussian distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Normal distribution — Normal","text":"","code":"Normal(mu = 0, sigma = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Normal distribution — Normal","text":"mu location parameter, written \\(\\mu\\) textbooks, also mean distribution. Can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks, also standard deviation distribution. Can positive number. Defaults 1. like Normal distribution variance \\(\\sigma^2\\), sure take square root, common source errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Normal distribution — Normal","text":"Normal object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Normal distribution — Normal","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Normal random variable mean mu = \\(\\mu\\) standard deviation sigma = \\(\\sigma\\). Support: \\(R\\), set real numbers Mean: \\(\\mu\\) Variance: \\(\\sigma^2\\) Probability density function (p.d.f): $$ f(x) = \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} $$ Cumulative distribution function (c.d.f): cumulative distribution function form $$ F(t) = \\int_{-\\infty}^t \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} dx $$ integral closed form solution must approximated numerically. c.d.f. standard Normal sometimes called \"error function\". notation \\(\\Phi(t)\\) also stands c.d.f. standard Normal evaluated \\(t\\). Z-tables list value \\(\\Phi(t)\\) various \\(t\\). Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\mu t + \\sigma^2 t^2 / 2} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Normal distribution — Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Poisson distribution — Poisson","title":"Create a Poisson distribution — Poisson","text":"Poisson distributions frequently used model counts.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Poisson distribution — Poisson","text":"","code":"Poisson(lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Poisson distribution — Poisson","text":"lambda shape parameter, also mean variance distribution. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Poisson distribution — Poisson","text":"Poisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Poisson distribution — Poisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\(\\lambda\\) Variance: \\(\\lambda\\) Probability mass function (p.m.f): $$ P(X = k) = \\frac{\\lambda^k e^{-\\lambda}}{k!} $$ Cumulative distribution function (c.d.f): $$ P(X \\le k) = e^{-\\lambda} \\sum_{= 0}^{\\lfloor k \\rfloor} \\frac{\\lambda^}{!} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\lambda (e^t - 1)} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Poisson distribution — Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Poisson binomial distribution — PoissonBinomial","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"Poisson binomial distribution generalization Binomial distribution. also sum \\(n\\) independent Bernoulli experiments. However, success probabilities can vary experiments identically distributed.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"","code":"PoissonBinomial(...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"... arbitrary number numeric vectors matrices success probabilities [0, 1] (matching number rows).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"PoissonBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"Poisson binomial distribution comes consider number successes independent binomial experiments (coin flips) potentially varying success probabilities. PoissonBinomial distribution class distributions3 mostly based PoissonBinomial package, providing fast Rcpp implementations efficient algorithms. Hence, recommended install PoissonBinomial package working distribution. However, fallback PoissonBinomial package installed methods PoissonBinomial distribution employ normal approximation. recommend reading following documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Poisson binomial random variable success probabilities \\(p_1\\) \\(p_n\\). Support: \\(\\{0, 1, 2, ..., n\\}\\) Mean: \\(p_1 + \\dots + p_n\\) Variance: \\(p_1 \\cdot (1 - p_1) + \\dots + p_1 \\cdot (1 - p_1)\\) Probability mass function (p.m.f): $$ P(X = k) = \\sum_A \\prod_{\\} p_i \\prod_{j \\^C} (1 - p_j) $$ sum taken sets \\(\\) \\(k\\) elements \\(\\{0, 1, 2, ..., n\\}\\). \\(^C\\) complement \\(\\). Cumulative distribution function (c.d.f): $$ P(X \\le k) = \\sum_{=0}^{\\lfloor k \\rfloor} P(X = ) $$ Moment generating function (m.g.f): $$ E(e^{tX}) = \\prod_{= 1}^n (1 - p_i + p_i e^t) $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> Loading required namespace: PoissonBinomial #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a reversed Weibull distribution — RevWeibull","title":"Create a reversed Weibull distribution — RevWeibull","text":"reversed (negated) Weibull distribution special case \\link{GEV} distribution, obtained GEV shape parameter \\(\\xi\\) negative. may referred type III extreme value distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a reversed Weibull distribution — RevWeibull","text":"","code":"RevWeibull(location = 0, scale = 1, shape = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a reversed Weibull distribution — RevWeibull","text":"location location (maximum) parameter \\(m\\). location can real number. Defaults 0. scale scale parameter \\(s\\). scale can positive number. Defaults 1. shape scale parameter \\(\\alpha\\). shape can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a reversed Weibull distribution — RevWeibull","text":"RevWeibull object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a reversed Weibull distribution — RevWeibull","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) reversed Weibull random variable location parameter location = \\(m\\), scale parameter scale = \\(s\\), shape parameter shape = \\(\\alpha\\). RevWeibull(\\(m, s, \\alpha\\)) distribution equivalent \\link{GEV}(\\(m - s, s / \\alpha, -1 / \\alpha\\)) distribution. \\(X\\) RevWeibull(\\(m, \\lambda, k\\)) distribution \\(m - X\\) \\link{Weibull}(\\(k, \\lambda\\)) distribution, , Weibull distribution shape parameter \\(k\\) scale parameter \\(\\lambda\\). Support: \\((-\\infty, m)\\). Mean: \\(m + s\\Gamma(1 + 1/\\alpha)\\). Median: \\(m + s(\\ln 2)^{1/\\alpha}\\). Variance: \\(s^2 [\\Gamma(1 + 2 / \\alpha) - \\Gamma(1 + 1 / \\alpha)^2]\\). Probability density function (p.d.f): $$f(x) = \\alpha s ^ {-1} [-(x - m) / s] ^ {\\alpha - 1}% \\exp\\{-[-(x - m) / s] ^ {\\alpha} \\}$$ \\(x < m\\). p.d.f. 0 \\(x \\geq m\\). Cumulative distribution function (c.d.f): $$F(x) = \\exp\\{-[-(x - m) / s] ^ {\\alpha} \\}$$ \\(x < m\\). c.d.f. 1 \\(x \\geq m\\).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a reversed Weibull distribution — RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Student's T distribution — StudentsT","title":"Create a Student's T distribution — StudentsT","text":"Student's T distribution closely related Normal() distribution, heavier tails. \\(\\nu\\) increases \\(\\infty\\), Student's T converges Normal. T distribution appears repeatedly throughout classic frequentist hypothesis testing comparing group means.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Student's T distribution — StudentsT","text":"","code":"StudentsT(df)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Student's T distribution — StudentsT","text":"df Degrees freedom. Can positive number. Often called \\(\\nu\\) textbooks.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Student's T distribution — StudentsT","text":"StudentsT object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Student's T distribution — StudentsT","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Students T random variable df = \\(\\nu\\). Support: \\(R\\), set real numbers Mean: Undefined unless \\(\\nu \\ge 2\\), case mean zero. Variance: $$ \\frac{\\nu}{\\nu - 2} $$ Undefined \\(\\nu < 1\\), infinite \\(1 < \\nu \\le 2\\). Probability density function (p.d.f): $$ f(x) = \\frac{\\Gamma(\\frac{\\nu + 1}{2})}{\\sqrt{\\nu \\pi} \\Gamma(\\frac{\\nu}{2})} (1 + \\frac{x^2}{\\nu} )^{- \\frac{\\nu + 1}{2}} $$ Cumulative distribution function (c.d.f): Nasty, omitted. Moment generating function (m.g.f): Undefined.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Student's T distribution — StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Tukey distribution — Tukey","title":"Create a Tukey distribution — Tukey","text":"Tukey's studentized range distribution, used Tukey's honestly significant differences test ANOVA.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Tukey distribution — Tukey","text":"","code":"Tukey(nmeans, df, nranges)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Tukey distribution — Tukey","text":"nmeans Sample size range. df Degrees freedom. nranges Number groups compared.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Tukey distribution — Tukey","text":"Tukey object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Tukey distribution — Tukey","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. Support: \\(R^+\\), set positive real numbers. properties Tukey's Studentized Range Distribution omitted, largely distribution fun work .","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Tukey distribution — Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Continuous Uniform distribution — Uniform","title":"Create a Continuous Uniform distribution — Uniform","text":"distribution constant density interval. continuous analogue Categorical() distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Continuous Uniform distribution — Uniform","text":"","code":"Uniform(a = 0, b = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Continuous Uniform distribution — Uniform","text":"parameter. can value set real numbers. Defaults 0. b parameter. b can value set real numbers. strictly bigger , , order parameters inverted. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Continuous Uniform distribution — Uniform","text":"Uniform object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Continuous Uniform distribution — Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Weibull distribution — Weibull","title":"Create a Weibull distribution — Weibull","text":"Generalization gamma distribution. Often used survival time--event analyses.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Weibull distribution — Weibull","text":"","code":"Weibull(shape, scale)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Weibull distribution — Weibull","text":"shape shape parameter \\(k\\). Can positive real number. scale scale parameter \\(\\lambda\\). Can positive real number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Weibull distribution — Weibull","text":"Weibull object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Weibull distribution — Weibull","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Weibull random variable success probability p = \\(p\\). Support: \\(R^+\\) zero. Mean: \\(\\lambda \\Gamma(1+1/k)\\), \\(\\Gamma\\) gamma function. Variance: \\(\\lambda [ \\Gamma (1 + \\frac{2}{k} ) - (\\Gamma(1+ \\frac{1}{k}))^2 ]\\) Probability density function (p.d.f): $$ f(x) = \\frac{k}{\\lambda}(\\frac{x}{\\lambda})^{k-1}e^{-(x/\\lambda)^k}, x \\ge 0 $$ Cumulative distribution function (c.d.f): $$F(x) = 1 - e^{-(x/\\lambda)^k}, x \\ge 0$$ Moment generating function (m.g.f): $$\\sum_{n=0}^\\infty \\frac{t^n\\lambda^n}{n!} \\Gamma(1+n/k), k \\ge 1$$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Weibull distribution — Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"Zero-inflated negative binomial distributions frequently used model counts overdispersion many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"","code":"ZINegativeBinomial(mu, theta, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"mu Location parameter negative binomial component distribution. Can positive number. theta Overdispersion parameter negative binomial component distribution. Can positive number. pi Zero-inflation probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"ZINegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-inflated negative binomial random variable parameters mu = \\(\\mu\\) theta = \\(\\theta\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\((1 - \\pi) \\cdot \\mu\\) Variance: \\((1 - \\pi) \\cdot \\mu \\cdot (1 + (\\pi + 1/\\theta) \\cdot \\mu)\\) Probability mass function (p.m.f.): $$ P(X = k) = \\pi \\cdot I_{0}(k) + (1 - \\pi) \\cdot f(k; \\mu, \\theta) $$ \\(I_{0}(k)\\) indicator function zero \\(f(k; \\mu, \\theta)\\) p.m.f. NegativeBinomial distribution. Cumulative distribution function (c.d.f.): $$ P(X \\le k) = \\pi + (1 - \\pi) \\cdot F(k; \\mu, \\theta) $$ \\(F(k; \\mu, \\theta)\\) c.d.f. NegativeBinomial distribution. Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-inflated Poisson distribution — ZIPoisson","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"Zero-inflated Poisson distributions frequently used model counts many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"","code":"ZIPoisson(lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"lambda Parameter Poisson component distribution. Can positive number. pi Zero-inflation probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"ZIPoisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-inflated Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\((1 - \\pi) \\cdot \\lambda\\) Variance: \\((1 - \\pi) \\cdot \\lambda \\cdot (1 + \\pi \\cdot \\lambda)\\) Probability mass function (p.m.f.): $$ P(X = k) = \\pi \\cdot I_{0}(k) + (1 - \\pi) \\cdot f(k; \\lambda) $$ \\(I_{0}(k)\\) indicator function zero \\(f(k; \\lambda)\\) p.m.f. Poisson distribution. Cumulative distribution function (c.d.f.): $$ P(X \\le k) = \\pi + (1 - \\pi) \\cdot F(k; \\lambda) $$ \\(F(k; \\lambda)\\) c.d.f. Poisson distribution. Moment generating function (m.g.f.): $$ E(e^{tX}) = \\pi + (1 - \\pi) \\cdot e^{\\lambda (e^t - 1)} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"Zero-truncated negative binomial distributions frequently used model counts zero observations occur excluded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"","code":"ZTNegativeBinomial(mu, theta)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"mu Location parameter negative binomial component distribution. Can positive number. theta Overdispersion parameter negative binomial component distribution. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"ZTNegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-truncated negative binomial random variable parameter mu = \\(\\mu\\). Support: \\(\\{1, 2, 3, ...\\}\\) Mean: $$ \\mu \\cdot \\frac{1}{1 - F(0; \\mu, \\theta)} $$ \\(F(k; \\mu, \\theta)\\) c.d.f. NegativeBinomial distribution. Variance: \\(m \\cdot (\\mu + 1 - m)\\), \\(m\\) mean . Probability mass function (p.m.f.): $$ P(X = k) = \\frac{f(k; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ \\(f(k; \\mu, \\theta)\\) p.m.f. NegativeBinomial distribution. Cumulative distribution function (c.d.f.): $$ P(X = k) = \\frac{F(k; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-truncated Poisson distribution — ZTPoisson","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"Zero-truncated Poisson distributions frequently used model counts zero observations occur excluded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"","code":"ZTPoisson(lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"lambda Parameter underlying untruncated Poisson distribution. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"ZTPoisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-truncated Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{1, 2, 3, ...\\}\\) Mean: $$ \\lambda \\cdot \\frac{1}{1 - e^{-\\lambda}} $$ Variance: \\(m \\cdot (\\lambda + 1 - m)\\), \\(m\\) mean . Probability mass function (p.m.f.): $$ P(X = k) = \\frac{f(k; \\lambda)}{1 - f(0; \\lambda)} $$ \\(f(k; \\lambda)\\) p.m.f. Poisson distribution. Cumulative distribution function (c.d.f.): $$ P(X = k) = \\frac{F(k; \\lambda)}{1 - F(0; \\lambda)} $$ \\(F(k; \\lambda)\\) c.d.f. Poisson distribution. Moment generating function (m.g.f.): $$ E(e^{tX}) = \\frac{1}{1 - e^{-\\lambda}} \\cdot e^{\\lambda (e^t - 1)} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":null,"dir":"Reference","previous_headings":"","what":"Utilities for distributions3 objects — apply_dpqr","title":"Utilities for distributions3 objects — apply_dpqr","text":"Various utility functions implement methods distributions unified workflow, particular facilitate working vectorized distributions3 objects. particularly useful computation densities, probabilities, quantiles, random samples classical d/p/q/r functions readily available distribution interest.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Utilities for distributions3 objects — apply_dpqr","text":"","code":"apply_dpqr(d, FUN, at, elementwise = NULL, drop = TRUE, type = NULL, ...) make_support(min, max, d, drop = TRUE) make_positive_integer(n)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Utilities for distributions3 objects — apply_dpqr","text":"d distributions3 object. FUN Function computed. Function type FUN(, d), argument function evaluated (e.g., quantile, probability, sample size) d distributions3 object. Specification values FUN evaluated, typically numeric vector (e.g., quantiles, probabilities, etc.) possibly also matrix data frame. elementwise logical. element d evaluated corresponding element (elementwise = TRUE) elements (elementwise = FALSE). Elementwise evaluation possible length d case vector length returned. Otherwise matrix returned. default use elementwise = TRUE possible, otherwise elementwise = FALSE. drop logical. result simplified vector possible (dropping dimension attribute)? FALSE matrix always returned. type Character string used naming, typically one \"density\", \"logLik\", \"probability\", \"quantile\", \"random\". Note \"random\" case processed differently internally order vectorize random number generation efficiently. ... Arguments passed FUN. min, max Numeric vectors. Minima maxima supports distributions3 object. n numeric. Number observations computing random draws. length(n) > 1, length taken number required (consistent base R , e.g., rnorm()).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Utilities for distributions3 objects — apply_dpqr","text":"","code":"## Implementing a new distribution based on the provided utility functions ## Illustration: Gaussian distribution ## Note: Gaussian() is really just a copy of Normal() with a different class/distribution name ## Generator function for the distribution object. Gaussian <- function(mu = 0, sigma = 1) { stopifnot( \"parameter lengths do not match (only scalars are allowed to be recycled)\" = length(mu) == length(sigma) | length(mu) == 1 | length(sigma) == 1 ) d <- data.frame(mu = mu, sigma = sigma) class(d) <- c(\"Gaussian\", \"distribution\") d } ## Set up a vector Y containing four Gaussian distributions: Y <- Gaussian(mu = 1:4, sigma = c(1, 1, 2, 2)) Y #> [1] \"Gaussian(mu = 1, sigma = 1)\" \"Gaussian(mu = 2, sigma = 1)\" #> [3] \"Gaussian(mu = 3, sigma = 2)\" \"Gaussian(mu = 4, sigma = 2)\" ## Extract the underlying parameters: as.matrix(Y) #> mu sigma #> [1,] 1 1 #> [2,] 2 1 #> [3,] 3 2 #> [4,] 4 2 ## Extractor functions for moments of the distribution include ## mean(), variance(), skewness(), kurtosis(). ## These can be typically be defined as functions of the list of parameters. mean.Gaussian <- function(x, ...) { rlang::check_dots_used() setNames(x$mu, names(x)) } ## Analogously for other moments, see distributions3:::variance.Normal etc. mean(Y) #> [1] 1 2 3 4 ## The support() method should return a matrix of \"min\" and \"max\" for the ## distribution. The make_support() function helps to set the right names and ## dimension. support.Gaussian <- function(d, drop = TRUE, ...) { min <- rep(-Inf, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) } support(Y) #> min max #> [1,] -Inf Inf #> [2,] -Inf Inf #> [3,] -Inf Inf #> [4,] -Inf Inf ## Evaluating certain functions associated with the distribution, e.g., ## pdf(), log_pdf(), cdf() quantile(), random(), etc. The apply_dpqr() ## function helps to call the typical d/p/q/r functions (like dnorm, ## pnorm, etc.) and set suitable names and dimension. pdf.Gaussian <- function(d, x, elementwise = NULL, drop = TRUE, ...) { FUN <- function(at, d) dnorm(x = at, mean = d$mu, sd = d$sigma, ...) apply_dpqr(d = d, FUN = FUN, at = x, type = \"density\", elementwise = elementwise, drop = drop) } ## Evaluate all densities at the same argument (returns vector): pdf(Y, 0) #> [1] 0.24197072 0.05399097 0.06475880 0.02699548 ## Evaluate all densities at several arguments (returns matrix): pdf(Y, c(0, 5)) #> d_0 d_5 #> [1,] 0.24197072 0.0001338302 #> [2,] 0.05399097 0.0044318484 #> [3,] 0.06475880 0.1209853623 #> [4,] 0.02699548 0.1760326634 ## Evaluate each density at a different argument (returns vector): pdf(Y, 4:1) #> [1] 0.004431848 0.241970725 0.176032663 0.064758798 ## Force evaluation of each density at a different argument (returns vector) ## or at all arguments (returns matrix): pdf(Y, 4:1, elementwise = TRUE) #> [1] 0.004431848 0.241970725 0.176032663 0.064758798 pdf(Y, 4:1, elementwise = FALSE) #> d_4 d_3 d_2 d_1 #> [1,] 0.004431848 0.05399097 0.2419707 0.3989423 #> [2,] 0.053990967 0.24197072 0.3989423 0.2419707 #> [3,] 0.176032663 0.19947114 0.1760327 0.1209854 #> [4,] 0.199471140 0.17603266 0.1209854 0.0647588 ## Drawing random() samples also uses apply_dpqr() with the argument ## n assured to be a positive integer. random.Gaussian <- function(x, n = 1L, drop = TRUE, ...) { n <- make_positive_integer(n) if (n == 0L) { return(numeric(0L)) } FUN <- function(at, d) rnorm(n = at, mean = d$mu, sd = d$sigma) apply_dpqr(d = x, FUN = FUN, at = n, type = \"random\", drop = drop) } ## One random sample for each distribution (returns vector): random(Y, 1) #> [1] -0.596718 2.490967 3.843207 7.747808 ## Several random samples for each distribution (returns matrix): random(Y, 3) #> r_1 r_2 r_3 #> [1,] 2.034514 0.1125799 -0.134331 #> [2,] 2.081810 2.1054214 3.462352 #> [3,] 2.834952 3.7057489 4.404233 #> [4,] 5.212147 5.1007867 9.014222 ## For further analogous methods see the \"Normal\" distribution provided ## in distributions3. methods(class = \"Normal\") #> [1] cdf fit_mle is_continuous is_discrete kurtosis #> [6] log_pdf mean pdf quantile random #> [11] skewness suff_stat support variance #> see '?methods' for accessing help and source code"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"Evaluate cumulative distribution function Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"d Bernoulli object created call Bernoulli(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"Evaluate cumulative distribution function Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"","code":"# S3 method for class 'Beta' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"d Beta object created call Beta(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pbeta. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"Evaluate cumulative distribution function Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"","code":"# S3 method for class 'Binomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"d Binomial object created call Binomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"Evaluate cumulative distribution function Categorical distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"","code":"# S3 method for class 'Categorical' cdf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"d Categorical object created call Categorical(). x vector elements whose cumulative probabilities like determine given distribution d. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"vector probabilities, one element x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"Evaluate cumulative distribution function Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"","code":"# S3 method for class 'Cauchy' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"d Cauchy object created call Cauchy(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pcauchy. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"Evaluate cumulative distribution function chi square distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"d ChiSquare object created call ChiSquare(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pchisq. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"Evaluate cumulative distribution function Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"","code":"# S3 method for class 'Erlang' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"d Erlang object created call Erlang(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"Evaluate cumulative distribution function Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"","code":"# S3 method for class 'Exponential' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"d Exponential object created call Exponential(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pexp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"Evaluate cumulative distribution function F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"","code":"# S3 method for class 'FisherF' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"d FisherF object created call FisherF(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pf. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"Evaluate cumulative distribution function Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"","code":"# S3 method for class 'Frechet' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"d Frechet object created call Frechet(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"Evaluate cumulative distribution function GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"","code":"# S3 method for class 'GEV' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"d GEV object created call GEV(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"Evaluate cumulative distribution function GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"","code":"# S3 method for class 'GP' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"d GP object created call GP(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"Evaluate cumulative distribution function Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"","code":"# S3 method for class 'Gamma' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"d Gamma object created call Gamma(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"Evaluate cumulative distribution function Geometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"","code":"# S3 method for class 'Geometric' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"d Geometric object created call Geometric(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgeom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"Evaluate cumulative distribution function Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"","code":"# S3 method for class 'Gumbel' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"d Gumbel object created call Gumbel(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"Evaluate cumulative distribution function hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"d HurdleNegativeBinomial object created call HurdleNegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed phnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"Evaluate cumulative distribution function hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"d HurdlePoisson object created call HurdlePoisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed phpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"Evaluate cumulative distribution function HyperGeometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"d HyperGeometric object created call HyperGeometric(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed phyper. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"Evaluate cumulative distribution function LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"","code":"# S3 method for class 'LogNormal' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"d LogNormal object created call LogNormal(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed plnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"Evaluate cumulative distribution function Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"","code":"# S3 method for class 'Logistic' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"d Logistic object created call Logistic(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed plogis. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"Evaluate cumulative distribution function negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"d NegativeBinomial object created call NegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"Evaluate cumulative distribution function Normal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"","code":"# S3 method for class 'Normal' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"d Normal object created call Normal(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"Evaluate cumulative distribution function Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"","code":"# S3 method for class 'Poisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"d Poisson object created call Poisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed ppois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"Evaluate cumulative distribution function PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' cdf( d, x, drop = TRUE, elementwise = NULL, lower.tail = TRUE, log.p = FALSE, verbose = TRUE, ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"d PoissonBinomial object created call PoissonBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. lower.tail, log.p, ... Arguments passed ppbinom pnorm, respectively. verbose logical. warning issued normal approximation applied PoissonBinomial package installed?","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"Evaluate cumulative distribution function RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"d RevWeibull object created call RevWeibull(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"Evaluate cumulative distribution function StudentsT distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"","code":"# S3 method for class 'StudentsT' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"d StudentsT object created call StudentsT(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pt. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"Evaluate cumulative distribution function Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"","code":"# S3 method for class 'Tukey' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"d Tukey distribution created call Tukey(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed ptukey. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"Evaluate cumulative distribution function continuous Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"","code":"# S3 method for class 'Uniform' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"d Uniform object created call Uniform(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed punif. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"Evaluate cumulative distribution function Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"","code":"# S3 method for class 'Weibull' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"d Weibull object created call Weibull(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pweibull. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"Evaluate cumulative distribution function zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"d ZINegativeBinomial object created call ZINegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pzinbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"Evaluate cumulative distribution function zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"d ZIPoisson object created call ZIPoisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pzipois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"Evaluate cumulative distribution function zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"d ZTNegativeBinomial object created call ZTNegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pztnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"Evaluate cumulative distribution function zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"d ZTPoisson object created call ZTPoisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pztpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a probability distribution — cdf","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"Generic function computing probabilities distribution objects based cumulative distribution function (CDF).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"","code":"cdf(d, x, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"Probabilities corresponding vector x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"","code":"## distribution object X <- Normal() ## probabilities from CDF cdf(X, c(1, 2, 3, 4, 5)) #> [1] 0.8413447 0.9772499 0.9986501 0.9999683 0.9999997"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/distributions3-package.html","id":null,"dir":"Reference","previous_headings":"","what":"distributions3: Probability Distributions as S3 Objects — distributions3-package","title":"distributions3: Probability Distributions as S3 Objects — distributions3-package","text":"Tools create manipulate probability distributions using S3. Generics pdf(), cdf(), quantile(), random() provide replacements base R's d/p/q/r style functions. Functions arguments named carefully minimize confusion students intro stats courses. documentation distribution contains detailed mathematical notes.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/distributions3-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"distributions3: Probability Distributions as S3 Objects — distributions3-package","text":"Maintainer: Alex Hayes alexpghayes@gmail.com (ORCID) Authors: Ralph Moller-Trane Daniel Jordan dandermotj@gmail.com Paul Northrop p.northrop@ucl.ac.uk Moritz N. Lang moritz.n.lang@gmail.com (ORCID) Achim Zeileis Achim.Zeileis@R-project.org (ORCID) contributors: Emil Hvitfeldt emilhhvitfeldt@gmail.com (ORCID) [contributor] Bruna Wundervald brunadaviesw@gmail.com [contributor] Alessandro Gasparini alessandro.gasparini@ki.se [contributor]","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"Fit Bernoulli distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"d Bernoulli object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"Bernoulli object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Binomial distribution to data — fit_mle.Binomial","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"fit distribution inherit size parameter Binomial object passed.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"","code":"# S3 method for class 'Binomial' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"d Binomial object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"Binomial object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit an Exponential distribution to data — fit_mle.Exponential","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"Fit Exponential distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"","code":"# S3 method for class 'Exponential' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"d Exponential object created call Exponential(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"Exponential object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Gamma distribution to data — fit_mle.Gamma","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"Fit Gamma distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"","code":"# S3 method for class 'Gamma' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"d Gamma object created call Gamma(). x vector fit Gamma distribution . ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"Gamma object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Geometric distribution to data — fit_mle.Geometric","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"Fit Geometric distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"","code":"# S3 method for class 'Geometric' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"d Geometric object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"Geometric object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Log Normal distribution to data — fit_mle.LogNormal","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"Fit Log Normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"","code":"# S3 method for class 'LogNormal' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"d LogNormal object created call LogNormal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"LogNormal object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Normal distribution to data — fit_mle.Normal","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"Fit Normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"","code":"# S3 method for class 'Normal' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"d Normal object created call Normal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"Normal object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit an Poisson distribution to data — fit_mle.Poisson","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"Fit Poisson distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"","code":"# S3 method for class 'Poisson' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"d Poisson object created call Poisson(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"Poisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a distribution to data — fit_mle","title":"Fit a distribution to data — fit_mle","text":"Generic function fitting maximum-likelihood estimates (MLEs) distribution based empirical data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a distribution to data — fit_mle","text":"","code":"fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a distribution to data — fit_mle","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector data compute likelihood. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a distribution to data — fit_mle","text":"distribution (kind d) parameters MLE estimates based x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fit a distribution to data — fit_mle","text":"","code":"X <- Normal() fit_mle(X, c(-1, 0, 0, 0, 3)) #> [1] \"Normal(mu = 0.4, sigma = 1.517)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":null,"dir":"Reference","previous_headings":"","what":"Fill out area under the curve for a plotted PDF — stat_auc","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"Fill area curve plotted PDF","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"","code":"stat_auc( mapping = NULL, data = NULL, geom = \"auc\", position = \"identity\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, from = -Inf, to = Inf, annotate = FALSE, digits = 3, ... ) geom_auc( mapping = NULL, data = NULL, stat = \"auc\", position = \"identity\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, from = -Inf, to = Inf, annotate = FALSE, digits = 3, ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"mapping Set aesthetic mappings created aes(). specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot(). data.frame, object, override plot data. objects fortified produce data frame. See fortify() variables created. function called single argument, plot data. return value must data.frame, used layer data. function can created formula (e.g. ~ head(.x, 10)). geom geometric object use display data layer. using stat_*() function construct layer, geom argument can used override default coupling stats geoms. geom argument accepts following: Geom ggproto subclass, example GeomPoint. string naming geom. give geom string, strip function name geom_ prefix. example, use geom_point(), give geom \"point\". information ways specify geom, see layer geom documentation. position position adjustment use data layer. can used various ways, including prevent overplotting improving display. position argument accepts following: result calling position function, position_jitter(). method allows passing extra arguments position. string naming position adjustment. give position string, strip function name position_ prefix. example, use position_jitter(), give position \"jitter\". information ways specify position, see layer position documentation. na.rm FALSE, default, missing values removed warning. TRUE, missing values silently removed. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. can also named logical vector finely select aesthetics display. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders(). Left end-point interval Right end-point interval annotate P() added upper left corner annotation? Works also colour character, e.g., \"red\". digits Number digits shown annotation ... arguments passed layer()'s params argument. arguments broadly fall one 4 categories . Notably, arguments position argument, aesthetics required can passed .... Unknown arguments part 4 categories ignored. Static aesthetics mapped scale, fixed value apply layer whole. example, colour = \"red\" linewidth = 3. geom's documentation Aesthetics section lists available options. 'required' aesthetics passed params. Please note passing unmapped aesthetics vectors technically possible, order required length guaranteed parallel input data. constructing layer using stat_*() function, ... argument can used pass parameters geom part layer. example stat_density(geom = \"area\", outline.type = \"\"). geom's documentation lists parameters can accept. Inversely, constructing layer using geom_*() function, ... argument can used pass parameters stat part layer. example geom_area(stat = \"density\", adjust = 0.5). stat's documentation lists parameters can accept. key_glyph argument layer() may also passed .... can one functions described key glyphs, change display layer legend. stat statistical transformation use data layer. using geom_*() function construct layer, stat argument can used override default coupling geoms stats. stat argument accepts following: Stat ggproto subclass, example StatCount. string naming stat. give stat string, strip function name stat_ prefix. example, use stat_count(), give stat \"count\". information ways specify stat, see layer stat documentation.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"","code":"N1 <- Normal() plot_pdf(N1) + geom_auc(to = -0.645) plot_pdf(N1) + geom_auc(from = -0.645, to = 0.1, annotate = TRUE) N2 <- Normal(0, c(1, 2)) plot_pdf(N2) + geom_auc(to = 0) plot_pdf(N2) + geom_auc(from = -2, to = 2, annotate = TRUE)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":null,"dir":"Reference","previous_headings":"","what":"The hurdle negative binomial distribution — dhnbinom","title":"The hurdle negative binomial distribution — dhnbinom","text":"Density, distribution function, quantile function, random generation zero-hurdle negative binomial distribution parameters mu, theta (size), pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The hurdle negative binomial distribution — dhnbinom","text":"","code":"dhnbinom(x, mu, theta, size, pi, log = FALSE) phnbinom(q, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) qhnbinom(p, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) rhnbinom(n, mu, theta, size, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The hurdle negative binomial distribution — dhnbinom","text":"x vector (non-negative integer) quantiles. mu vector (non-negative) negative binomial location parameters. theta, size vector (non-negative) negative binomial overdispersion parameters. theta , equivalently, size may specified. pi vector zero-hurdle probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The hurdle negative binomial distribution — dhnbinom","text":"functions follow usual conventions d/p/q/r functions base R. particular, four hnbinom functions hurdle negative binomial distribution call corresponding nbinom functions negative binomial distribution base R internally. Note, however, precision qhnbinom large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The hurdle negative binomial distribution — dhnbinom","text":"","code":"## theoretical probabilities for a hurdle negative binomial distribution x <- 0:8 p <- dhnbinom(x, mu = 2.5, theta = 1, pi = 0.75) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rhnbinom(500, mu = 2.5, theta = 1, pi = 0.75) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":null,"dir":"Reference","previous_headings":"","what":"The hurdle Poisson distribution — dhpois","title":"The hurdle Poisson distribution — dhpois","text":"Density, distribution function, quantile function, random generation zero-hurdle Poisson distribution parameters lambda pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The hurdle Poisson distribution — dhpois","text":"","code":"dhpois(x, lambda, pi, log = FALSE) phpois(q, lambda, pi, lower.tail = TRUE, log.p = FALSE) qhpois(p, lambda, pi, lower.tail = TRUE, log.p = FALSE) rhpois(n, lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The hurdle Poisson distribution — dhpois","text":"x vector (non-negative integer) quantiles. lambda vector (non-negative) Poisson parameters. pi vector zero-hurdle probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The hurdle Poisson distribution — dhpois","text":"functions follow usual conventions d/p/q/r functions base R. particular, four hpois functions hurdle Poisson distribution call corresponding pois functions Poisson distribution base R internally. Note, however, precision qhpois large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The hurdle Poisson distribution — dhpois","text":"","code":"## theoretical probabilities for a hurdle Poisson distribution x <- 0:8 p <- dhpois(x, lambda = 2.5, pi = 0.75) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rhpois(500, lambda = 2.5, pi = 0.75) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine whether a distribution is discrete or continuous — is_discrete","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"Generic functions determining whether certain probability distribution discrete continuous, respectively.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"","code":"is_discrete(d, ...) is_continuous(d, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"d object. package provides methods distribution objects Normal() Binomial() etc. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"logical vector indicating whether distribution(s) d /discrete continuous, respectively.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"generic function is_discrete intended return TRUE every distribution whose entire support discrete FALSE otherwise. Analogously, is_continuous intended return TRUE every distribution whose entire support continuous FALSE otherwise. mixed discrete-continuous distributions methods return FALSE. Methods generics provided distribution classes set package.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"","code":"X <- Normal() is_discrete(X) #> [1] FALSE is_continuous(X) #> [1] TRUE Y <- Binomial(size = 10, p = c(0.2, 0.5, 0.8)) is_discrete(Y) #> [1] TRUE TRUE TRUE is_continuous(Y) #> [1] FALSE FALSE FALSE"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":null,"dir":"Reference","previous_headings":"","what":"Is an object a distribution? — is_distribution","title":"Is an object a distribution? — is_distribution","text":"is_distribution tests x inherits \"distribution\".","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is an object a distribution? — is_distribution","text":"","code":"is_distribution(x)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is an object a distribution? — is_distribution","text":"x object test.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Is an object a distribution? — is_distribution","text":"","code":"Z <- Normal() is_distribution(Z) #> [1] TRUE is_distribution(1L) #> [1] FALSE"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"Functions computing (log-)likelihood based distribution object observed data. log-likelihood computed sum log-density contributions likelihood taking exponential thereof.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"","code":"log_likelihood(d, x, ...) likelihood(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector data compute likelihood. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"Numeric value (log-)likelihood.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"","code":"## distribution object X <- Normal() ## sum of log_pdf() contributions log_likelihood(X, c(-1, 0, 0, 0, 3)) #> [1] -9.594693 ## exp of log_likelihood() likelihood(X, c(-1, 0, 0, 0, 3)) #> [1] 6.808915e-05"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"Evaluate probability mass function Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Bernoulli' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"d Bernoulli object created call Bernoulli(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"Evaluate probability mass function Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"","code":"# S3 method for class 'Beta' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Beta' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"d Beta object created call Beta(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dbeta. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"Evaluate probability mass function Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"","code":"# S3 method for class 'Binomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Binomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"d Binomial object created call Binomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"Evaluate probability mass function Categorical discrete distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"","code":"# S3 method for class 'Categorical' pdf(d, x, ...) # S3 method for class 'Categorical' log_pdf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"d Categorical object created call Categorical(). x vector elements whose probabilities like determine given distribution d. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"vector probabilities, one element x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"Evaluate probability mass function Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"","code":"# S3 method for class 'Cauchy' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Cauchy' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"d Cauchy object created call Cauchy(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dcauchy. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"Evaluate probability mass function chi square distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ChiSquare' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"d ChiSquare object created call ChiSquare(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dchisq. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"Evaluate probability mass function Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"","code":"# S3 method for class 'Erlang' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Erlang' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"d Erlang object created call Erlang(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"Evaluate probability density function Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"","code":"# S3 method for class 'Exponential' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Exponential' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"d Exponential object created call Exponential(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dexp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of an F distribution — pdf.FisherF","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"Evaluate probability mass function F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"","code":"# S3 method for class 'FisherF' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'FisherF' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"d FisherF object created call FisherF(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed df. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"Evaluate probability mass function Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"","code":"# S3 method for class 'Frechet' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Frechet' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"d Frechet object created call Frechet(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"Evaluate probability mass function GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"","code":"# S3 method for class 'GEV' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'GEV' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"d GEV object created call GEV(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a GP distribution — pdf.GP","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"Evaluate probability mass function GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"","code":"# S3 method for class 'GP' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'GP' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"d GP object created call GP(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"Evaluate probability mass function Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"","code":"# S3 method for class 'Gamma' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Gamma' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"d Gamma object created call Gamma(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"Please see documentation Geometric() properties Geometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"","code":"# S3 method for class 'Geometric' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Geometric' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"d Geometric object created call Geometric(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgeom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"Evaluate probability mass function Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"","code":"# S3 method for class 'Gumbel' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Gumbel' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"d Gumbel object created call Gumbel(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"Evaluate probability mass function hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'HurdleNegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"d HurdleNegativeBinomial object created call HurdleNegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dhnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"Evaluate probability mass function hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'HurdlePoisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"d HurdlePoisson object created call HurdlePoisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dhpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"Please see documentation HyperGeometric() properties HyperGeometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'HyperGeometric' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"d HyperGeometric object created call HyperGeometric(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dhyper. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"Please see documentation LogNormal() properties LogNormal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"","code":"# S3 method for class 'LogNormal' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'LogNormal' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"d LogNormal object created call LogNormal(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dlnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"Please see documentation Logistic() properties Logistic distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"","code":"# S3 method for class 'Logistic' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Logistic' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"d Logistic object created call Logistic(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dlogis. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"Please see documentation Multinomial() properties Multinomial distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"","code":"# S3 method for class 'Multinomial' pdf(d, x, ...) # S3 method for class 'Multinomial' log_pdf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"d Multinomial object created call Multinomial(). x vector elements whose probabilities like determine given distribution d. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"vector probabilities, one element x.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"","code":"set.seed(27) X <- Multinomial(size = 5, p = c(0.3, 0.4, 0.2, 0.1)) X #> Multinomial distribution (size = 5, p = [0.3, 0.4, ..., 0.1]) random(X, 10) #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 4 3 1 0 2 2 4 2 0 1 #> [2,] 1 1 4 4 1 1 1 3 1 1 #> [3,] 0 1 0 1 1 1 0 0 3 3 #> [4,] 0 0 0 0 1 1 0 0 1 0 # pdf(X, 2) # log_pdf(X, 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"Evaluate probability mass function NegativeBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'NegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"d NegativeBinomial object created call NegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"","code":"# S3 method for class 'Normal' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Normal' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"d Normal object created call Normal(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"Evaluate probability mass function Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"","code":"# S3 method for class 'Poisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Poisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"d Poisson object created call Poisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"Evaluate probability mass function PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, log = FALSE, verbose = TRUE, ...) # S3 method for class 'PoissonBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"d PoissonBinomial object created call PoissonBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. log, ... Arguments passed dpbinom pnorm, respectively. verbose logical. warning issued normal approximation applied PoissonBinomial package installed?","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"Evaluate probability mass function RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'RevWeibull' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"d RevWeibull object created call RevWeibull(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"Please see documentation StudentsT() properties StudentsT distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"","code":"# S3 method for class 'StudentsT' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'StudentsT' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"d StudentsT object created call StudentsT(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dt. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"Evaluate probability mass function continuous Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"","code":"# S3 method for class 'Uniform' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Uniform' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"d Uniform object created call Uniform(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dunif. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"Please see documentation Weibull() properties Weibull distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"","code":"# S3 method for class 'Weibull' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Weibull' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"d Weibull object created call Weibull(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dweibull. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"Evaluate probability mass function zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZINegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"d ZINegativeBinomial object created call ZINegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dzinbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"Evaluate probability mass function zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZIPoisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"d ZIPoisson object created call ZIPoisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dzipois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"Evaluate probability mass function zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZTNegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"d ZTNegativeBinomial object created call ZTNegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dztnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"Evaluate probability mass function zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZTPoisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"d ZTPoisson object created call ZTPoisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dztpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability density of a probability distribution — pdf","title":"Evaluate the probability density of a probability distribution — pdf","text":"Generic function computing probability density function (PDF) contributions based distribution object observed data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability density of a probability distribution — pdf","text":"","code":"pdf(d, x, drop = TRUE, ...) log_pdf(d, x, ...) pmf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability density of a probability distribution — pdf","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability density of a probability distribution — pdf","text":"Probabilities corresponding vector x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Evaluate the probability density of a probability distribution — pdf","text":"generic function pdf() computes probability density, continuous discrete distributions. pmf() (probability mass function) alias just calls pdf() internally. computing log-density contributions (e.g., log-likelihood) either pdf(..., log = TRUE) can used generic function log_pdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability density of a probability distribution — pdf","text":"","code":"## distribution object X <- Normal() ## probability density pdf(X, c(1, 2, 3, 4, 5)) #> [1] 2.419707e-01 5.399097e-02 4.431848e-03 1.338302e-04 1.486720e-06 pmf(X, c(1, 2, 3, 4, 5)) #> [1] 2.419707e-01 5.399097e-02 4.431848e-03 1.338302e-04 1.486720e-06 ## log-density pdf(X, c(1, 2, 3, 4, 5), log = TRUE) #> [1] -1.418939 -2.918939 -5.418939 -8.918939 -13.418939 log_pdf(X, c(1, 2, 3, 4, 5)) #> [1] -1.418939 -2.918939 -5.418939 -8.918939 -13.418939"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"Plot method object inheriting class \"distribution\". default probability density function (p.d.f.), continuous variable, probability mass function (p.m.f.), discrete variable, plotted. cumulative distribution function (c.d.f.) plotted cdf = TRUE. Multiple functions included plot parameter vectors x length greater 1. See argument .","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"","code":"# S3 method for class 'distribution' plot( x, cdf = FALSE, p = c(0.1, 99.9), len = 1000, all = FALSE, legend_args = list(), ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"x object class c(\"name\", \"distribution\"), \"name\" name distribution. cdf logical scalar. cdf = TRUE cumulative distribution function (c.d.f.) plotted. Otherwise, probability density function (p.d.f.), continuous variable, probability mass function (p.m.f.), discrete variable, plotted. p numeric vector. xlim passed ... p fallback option setting range values p.m.f, p.d.f. c.d.f plotted. See Details. len integer scalar. x continuous distribution object len number values p.d.f c.d.f. evaluated produce plot. larger len smoother curve. logical scalar. = TRUE separate distribution plotted combinations parameter values present parameter vectors present x. combinations generated using expand.grid. = FALSE number distributions plotted equal maximum lengths parameter vectors, shorter vectors recycled length necessary using rep_len. legend_args list arguments passed legend. particular, argument x (perhaps conjunction legend_args$y) can used set position legend. legend_args$x supplied \"bottomright\" used cdf = TRUE \"topright\" cdf = FALSE. ... arguments passed plot, plot.ecdf lines, xlim, ylim, xlab, ylab, main, lwd, lty, col, pch.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"object class x, parameter vectors expanded contain parameter combination function plotted.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"xlim passed ... determines range values variable plotted horizontal axis. x discrete distribution object values p.m.f. c.d.f. plotted smallest set consecutive integers contains components xlim. Otherwise, xlim used directly. xlim passed ... range values spans support distribution, following proviso: lower (upper) endpoint distribution -Inf (Inf) lower (upper) limit plotting range set p[1]\\ name x single upper case letter name used labels axes plot. Otherwise, x P(X = x) f(x) used. legend included least one parameter vectors x length greater 1. Plots c.d.f.s produced using calls approxfun plot.ecdf.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"","code":"B <- Binomial(20, 0.7) plot(B) plot(B, cdf = TRUE) B2 <- Binomial(20, c(0.1, 0.5, 0.9)) plot(B2, legend_args = list(x = \"top\")) x <- plot(B2, cdf = TRUE) x$size #> [1] 20 20 20 x$p #> [1] 0.1 0.5 0.9 X <- Poisson(2) plot(X) plot(X, cdf = TRUE) G <- Gamma(c(1, 3), 1:2) plot(G) plot(G, all = TRUE) plot(G, cdf = TRUE) C <- Cauchy() plot(C, p = c(1, 99), len = 10000) plot(C, cdf = TRUE, p = c(1, 99))"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot the CDF of a distribution — plot_cdf","title":"Plot the CDF of a distribution — plot_cdf","text":"function easily plot CDF distribution using ggplot2. Requires ggplot2 loaded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot the CDF of a distribution — plot_cdf","text":"","code":"plot_cdf(d, limits = NULL, p = 0.001, plot_theme = NULL)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot the CDF of a distribution — plot_cdf","text":"d distribution object limits either NULL (default) vector length 2 specifies range x-axis p limits NULL, range x-axis support d bounded interval, quantile(d, p) quantile(d, 1 - p) lower /upper limits support -Inf/Inf. Defaults 0.001. plot_theme specify theme resulting plot using ggplot2. Default theme_minimal","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot the CDF of a distribution — plot_cdf","text":"","code":"N1 <- Normal() plot_cdf(N1) N2 <- Normal(0, c(1, 2)) plot_cdf(N2) B1 <- Binomial(10, 0.2) plot_cdf(B1) B2 <- Binomial(10, c(0.2, 0.5)) plot_cdf(B2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot the PDF of a distribution — plot_pdf","title":"Plot the PDF of a distribution — plot_pdf","text":"function easily plot PDF distribution using ggplot2. Requires ggplot2 loaded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot the PDF of a distribution — plot_pdf","text":"","code":"plot_pdf(d, limits = NULL, p = 0.001, plot_theme = NULL)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot the PDF of a distribution — plot_pdf","text":"d distribution object limits either NULL (default) vector length 2 specifies range x-axis p limits NULL, range x-axis support d bounded interval, quantile(d, p) quantile(d, 1 - p) lower /upper limits support -Inf/Inf. Defaults 0.001. plot_theme specify theme resulting plot using ggplot2. Default theme_minimal","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot the PDF of a distribution — plot_pdf","text":"","code":"N1 <- Normal() plot_pdf(N1) N2 <- Normal(0, c(1, 2)) plot_pdf(N2) B1 <- Binomial(10, 0.2) plot_pdf(B1) B2 <- Binomial(10, c(0.2, 0.5)) plot_pdf(B2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":null,"dir":"Reference","previous_headings":"","what":"Extracting fitted or predicted probability distributions from models — prodist","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"Generic function methods various model classes extracting fitted (-sample) predicted (--sample) probability distributions3 objects.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"","code":"prodist(object, ...) # S3 method for class 'lm' prodist(object, ..., sigma = \"ML\") # S3 method for class 'glm' prodist(object, ..., dispersion = NULL) # S3 method for class 'distribution' prodist(object, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"object model object. ... Arguments passed methods, typically calling underlying predict methods, e.g., newdata lm glm objects n.ahead arima objects. sigma character numeric NULL. Specification standard deviation sigma used Normal distribution lm method. default \"ML\" (equivalently \"MLE\" NULL) uses maximum likelihood estimate based residual sum squares divided number observations, n. Alternatively, sigma = \"OLS\" uses least-squares estimate (divided residual degrees freedom, n - k). Finally, concrete numeric value can also specified sigma. dispersion character numeric NULL. Specification dispersion parameter glm method. default NULL (equivalently \"deviance\") use deviance divided number observations, n. Alternatively, dispersion = \"Chisquared\" uses Chi-squared statistic divided residual degrees freedom, n - k. Finally, concrete numeric value can also specified dispersion.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"object inheriting distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"facilitate making probabilistic forecasts based regression time series model objects, function prodist extracts fitted predicted probability distribution objects. Currently, methods provided objects fitted lm, glm, arima base R well glm.nb MASS package hurdle/zeroinfl/zerotrunc pscl countreg packages. methods essentially proceed two steps: First, standard predict method model objects used compute fitted (-sample, default) predicted (--sample) distribution parameters. Typically, includes mean plus parameters describing scale, dispersion, shape, etc.). Second, distributions objects set using generator functions distributions3. Note probability distributions reflect random variation dependent variable based model employed (associated distributional assumpation dependent variable). capture uncertainty parameter estimates. linear regression models generalized linear models, estimated lm glm respectively, ambiguity estimate dispersion parameter model used. logLik methods use maximum-likelihood (ML) estimate implicitly, summary methods report estimate standardized residual degrees freedom, n - k (rather number observations, n). prodist methods objects follow logLik method default summary behavior can mimicked setting sigma dispersion arguments accordingly.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"","code":"## Model: Linear regression ## Fit: lm ## Data: 1920s cars data data(\"cars\", package = \"datasets\") ## Stopping distance (ft) explained by speed (mph) reg <- lm(dist ~ speed, data = cars) ## Extract fitted normal distributions (in-sample, with constant variance) pd <- prodist(reg) head(pd) #> 1 2 #> \"Normal(mu = -1.849, sigma = 15.07)\" \"Normal(mu = -1.849, sigma = 15.07)\" #> 3 4 #> \"Normal(mu = 9.948, sigma = 15.07)\" \"Normal(mu = 9.948, sigma = 15.07)\" #> 5 6 #> \"Normal(mu = 13.880, sigma = 15.07)\" \"Normal(mu = 17.813, sigma = 15.07)\" ## Extract log-likelihood from model object logLik(reg) #> 'log Lik.' -206.5784 (df=3) ## Replicate log-likelihood via distributions object sum(log_pdf(pd, cars$dist)) #> [1] -206.5784 log_likelihood(pd, cars$dist) #> [1] -206.5784 ## Compute corresponding medians and 90% interval qd <- quantile(pd, c(0.05, 0.5, 0.95)) head(qd) #> q_0.05 q_0.5 q_0.95 #> 1 -26.635522 -1.849460 22.93660 #> 2 -26.635522 -1.849460 22.93660 #> 3 -14.838296 9.947766 34.73383 #> 4 -14.838296 9.947766 34.73383 #> 5 -10.905887 13.880175 38.66624 #> 6 -6.973478 17.812584 42.59865 ## Visualize observations with predicted quantiles plot(dist ~ speed, data = cars) matplot(cars$speed, qd, add = TRUE, type = \"l\", col = 2, lty = 1) ## Sigma estimated by maximum-likelihood estimate (default, used in logLik) ## vs. least-squares estimate (used in summary) nd <- data.frame(speed = 50) prodist(reg, newdata = nd, sigma = \"ML\") #> 1 #> \"Normal(mu = 179, sigma = 15.07)\" prodist(reg, newdata = nd, sigma = \"OLS\") #> 1 #> \"Normal(mu = 179, sigma = 15.38)\" summary(reg)$sigma #> [1] 15.37959 ## Model: Poisson generalized linear model ## Fit: glm ## Data: FIFA 2018 World Cup data data(\"FIFA2018\", package = \"distributions3\") ## Number of goals per team explained by ability differences poisreg <- glm(goals ~ difference, data = FIFA2018, family = poisson) summary(poisreg) #> #> Call: #> glm(formula = goals ~ difference, family = poisson, data = FIFA2018) #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) 0.21272 0.08125 2.618 0.00885 ** #> difference 0.41344 0.10579 3.908 9.31e-05 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for poisson family taken to be 1) #> #> Null deviance: 144.20 on 127 degrees of freedom #> Residual deviance: 128.69 on 126 degrees of freedom #> AIC: 359.39 #> #> Number of Fisher Scoring iterations: 5 #> ## Interpretation: When the ratio of abilities increases by 1 percent, ## the expected number of goals increases by around 0.4 percent ## Predict fitted Poisson distributions for teams with equal ability (out-of-sample) nd <- data.frame(difference = 0) prodist(poisreg, newdata = nd) #> 1 #> \"Poisson(lambda = 1.237)\" ## Extract fitted Poisson distributions (in-sample) pd <- prodist(poisreg) head(pd) #> 1 2 #> \"Poisson(lambda = 1.7680)\" \"Poisson(lambda = 0.8655)\" #> 3 4 #> \"Poisson(lambda = 1.0297)\" \"Poisson(lambda = 1.4862)\" #> 5 6 #> \"Poisson(lambda = 1.4354)\" \"Poisson(lambda = 1.0661)\" ## Extract log-likelihood from model object logLik(poisreg) #> 'log Lik.' -177.6971 (df=2) ## Replicate log-likelihood via distributions object sum(log_pdf(pd, FIFA2018$goals)) #> [1] -177.6971 log_likelihood(pd, FIFA2018$goals) #> [1] -177.6971 ## Model: Autoregressive integrated moving average model ## Fit: arima ## Data: Quarterly approval ratings of U.S. presidents (1945-1974) data(\"presidents\", package = \"datasets\") ## ARMA(2,1) model arma21 <- arima(presidents, order = c(2, 0, 1)) ## Extract predicted normal distributions for next two years p <- prodist(arma21, n.ahead = 8) p #> 1975 Qtr1 1975 Qtr2 #> \"Normal(mu = 29.58, sigma = 9.013)\" \"Normal(mu = 32.41, sigma = 11.118)\" #> 1975 Qtr3 1975 Qtr4 #> \"Normal(mu = 36.45, sigma = 12.935)\" \"Normal(mu = 38.61, sigma = 13.821)\" #> 1976 Qtr1 1976 Qtr2 #> \"Normal(mu = 41.54, sigma = 14.648)\" \"Normal(mu = 43.19, sigma = 15.092)\" #> 1976 Qtr3 1976 Qtr4 #> \"Normal(mu = 45.32, sigma = 15.507)\" \"Normal(mu = 46.58, sigma = 15.743)\" ## Compute median (= mean) forecast along with 80% and 95% interval quantile(p, c(0.5, 0.1, 0.9, 0.025, 0.975)) #> q_0.5 q_0.1 q_0.9 q_0.025 q_0.975 #> 1975 Qtr1 29.58398 18.03366 41.13430 11.91929 47.24867 #> 1975 Qtr2 32.40878 18.15989 46.65767 10.61698 54.20058 #> 1975 Qtr3 36.44588 19.86888 53.02287 11.09355 61.79820 #> 1975 Qtr4 38.61415 20.90236 56.32594 11.52630 65.70199 #> 1976 Qtr1 41.53897 22.76708 60.31085 12.82984 70.24809 #> 1976 Qtr2 43.19489 23.85376 62.53602 13.61519 72.77459 #> 1976 Qtr3 45.31799 25.44445 65.19152 14.92404 75.71194 #> 1976 Qtr4 46.57728 26.40232 66.75224 15.72234 77.43222"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"x Bernoulli object created call Bernoulli(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Beta distribution — quantile.Beta","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"","code":"# S3 method for class 'Beta' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"x Beta object created call Beta(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qbeta. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Binomial distribution — quantile.Binomial","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"","code":"# S3 method for class 'Binomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"x Binomial object created call Binomial(). probs vector probabilities. drop logical. Shoul result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"","code":"# S3 method for class 'Categorical' quantile(x, probs, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"x Categorical object created call Categorical(). probs vector probabilities. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"vector quantiles, one element probs.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"","code":"# S3 method for class 'Cauchy' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"x Cauchy object created call Cauchy(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qcauchy. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a chi square distribution — quantile.ChiSquare","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"x ChiSquare object created call ChiSquare(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qchisq. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of an Erlang distribution — quantile.Erlang","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"","code":"# S3 method for class 'Erlang' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"x Erlang object created call Erlang(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of an Exponential distribution — quantile.Exponential","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"","code":"# S3 method for class 'Exponential' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"x Exponential object created call Exponential(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qexp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of an F distribution — quantile.FisherF","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"","code":"# S3 method for class 'FisherF' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"x FisherF object created call FisherF(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qf. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Frechet distribution — quantile.Frechet","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"","code":"# S3 method for class 'Frechet' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"x Frechet object created call Frechet(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a GEV distribution — quantile.GEV","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"","code":"# S3 method for class 'GEV' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"x GEV object created call GEV(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a GP distribution — quantile.GP","title":"Determine quantiles of a GP distribution — quantile.GP","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a GP distribution — quantile.GP","text":"","code":"# S3 method for class 'GP' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a GP distribution — quantile.GP","text":"x GP object created call GP(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a GP distribution — quantile.GP","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a GP distribution — quantile.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Gamma distribution — quantile.Gamma","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"","code":"# S3 method for class 'Gamma' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"x Gamma object created call Gamma(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Geometric distribution — quantile.Geometric","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"Determine quantiles Geometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"","code":"# S3 method for class 'Geometric' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"x Geometric object created call Geometric(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgeom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"","code":"# S3 method for class 'Gumbel' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"x Gumbel object created call Gumbel(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"x HurdleNegativeBinomial object created call HurdleNegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qhnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"x HurdlePoisson object created call HurdlePoisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qhpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"Determine quantiles HyperGeometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"x HyperGeometric object created call HyperGeometric(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qhyper. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"Determine quantiles LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"","code":"# S3 method for class 'LogNormal' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"x LogNormal object created call LogNormal(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qlnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Logistic distribution — quantile.Logistic","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"Determine quantiles Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"","code":"# S3 method for class 'Logistic' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"x Logistic object created call Logistic(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qlogis. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"Determine quantiles NegativeBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"x NegativeBinomial object created call NegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Normal distribution — quantile.Normal","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals. quantile()","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"","code":"# S3 method for class 'Normal' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"x Normal object created call Normal(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"function returns values get Z-table. Note quantile() inverse cdf(). Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Poisson distribution — quantile.Poisson","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"","code":"# S3 method for class 'Poisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"x Poisson object created call Poisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' quantile( x, probs, drop = TRUE, elementwise = NULL, lower.tail = TRUE, log.p = FALSE, verbose = TRUE, ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"x PoissonBinomial object created call PoissonBinomial(). probs vector probabilities. drop logical. Shoul result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. lower.tail, log.p, ... Arguments passed qpbinom qnorm, respectively. verbose logical. warning issued normal approximation applied PoissonBinomial package installed?","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"x RevWeibull object created call RevWeibull(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"Please see documentation StudentsT() properties StudentsT distribution, well extensive examples showing calculate p-values confidence intervals. quantile()","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"","code":"# S3 method for class 'StudentsT' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"x StudentsT object created call StudentsT(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qt. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"function returns values get Z-table. Note quantile() inverse cdf(). Please see documentation StudentsT() properties StudentsT distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Tukey distribution — quantile.Tukey","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"Determine quantiles Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"","code":"# S3 method for class 'Tukey' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"x vector elements whose cumulative probabilities like determine given distribution d. probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qtukey. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"","code":"# S3 method for class 'Uniform' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"x Uniform object created call Uniform(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qunif. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Weibull distribution — quantile.Weibull","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"Determine quantiles Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"","code":"# S3 method for class 'Weibull' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"x Weibull object created call Weibull(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qweibull. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"x ZINegativeBinomial object created call ZINegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qzinbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"x ZIPoisson object created call ZIPoisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qzipois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"x ZTNegativeBinomial object created call ZTNegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qztnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"x ZTPoisson object created call ZTPoisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qztpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"Draw random sample Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"x Bernoulli object created call Bernoulli(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Beta distribution — random.Beta","title":"Draw a random sample from a Beta distribution — random.Beta","text":"Draw random sample Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Beta distribution — random.Beta","text":"","code":"# S3 method for class 'Beta' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Beta distribution — random.Beta","text":"x Beta object created call Beta(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Beta distribution — random.Beta","text":"Values [0, 1]. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Beta distribution — random.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Binomial distribution — random.Binomial","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"Draw random sample Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"","code":"# S3 method for class 'Binomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"x Binomial object created call Binomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"Integers containing values 0 x$size. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Categorical distribution — random.Categorical","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"Draw random sample Categorical distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"","code":"# S3 method for class 'Categorical' random(x, n = 1L, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"x Categorical object created call Categorical(). n number samples draw. Defaults 1L. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"vector containing values outcomes length n.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Cauchy distribution — random.Cauchy","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"Draw random sample Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"","code":"# S3 method for class 'Cauchy' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"x Cauchy object created call Cauchy(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a chi square distribution — random.ChiSquare","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"Draw random sample chi square distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"x ChiSquare object created call ChiSquare(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an Erlang distribution — random.Erlang","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"Draw random sample Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"","code":"# S3 method for class 'Erlang' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"x Erlang object created call Erlang(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an Exponential distribution — random.Exponential","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"Draw random sample Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"","code":"# S3 method for class 'Exponential' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"x Exponential object created call Exponential(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an F distribution — random.FisherF","title":"Draw a random sample from an F distribution — random.FisherF","text":"Draw random sample F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an F distribution — random.FisherF","text":"","code":"# S3 method for class 'FisherF' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an F distribution — random.FisherF","text":"x FisherF object created call FisherF(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an F distribution — random.FisherF","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an F distribution — random.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Frechet distribution — random.Frechet","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"Draw random sample Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"","code":"# S3 method for class 'Frechet' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"x Frechet object created call Frechet(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a GEV distribution — random.GEV","title":"Draw a random sample from a GEV distribution — random.GEV","text":"Draw random sample GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a GEV distribution — random.GEV","text":"","code":"# S3 method for class 'GEV' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a GEV distribution — random.GEV","text":"x GEV object created call GEV(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a GEV distribution — random.GEV","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a GEV distribution — random.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a GP distribution — random.GP","title":"Draw a random sample from a GP distribution — random.GP","text":"Draw random sample GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a GP distribution — random.GP","text":"","code":"# S3 method for class 'GP' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a GP distribution — random.GP","text":"x GP object created call GP(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a GP distribution — random.GP","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a GP distribution — random.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Gamma distribution — random.Gamma","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"Draw random sample Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"","code":"# S3 method for class 'Gamma' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"x Gamma object created call Gamma(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Geometric distribution — random.Geometric","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"Please see documentation Geometric() properties Geometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"","code":"# S3 method for class 'Geometric' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"x Geometric object created call Geometric(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Gumbel distribution — random.Gumbel","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"Draw random sample Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"","code":"# S3 method for class 'Gumbel' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"x Gumbel object created call Gumbel(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"Draw random sample hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"x HurdleNegativeBinomial object created call HurdleNegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"Draw random sample hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"x HurdlePoisson object created call HurdlePoisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"Please see documentation HyperGeometric() properties HyperGeometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"x HyperGeometric object created call HyperGeometric(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a LogNormal distribution — random.LogNormal","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"Draw random sample LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"","code":"# S3 method for class 'LogNormal' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"x LogNormal object created call LogNormal(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Logistic distribution — random.Logistic","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"Draw random sample Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"","code":"# S3 method for class 'Logistic' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"x Logistic object created call Logistic(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Multinomial distribution — random.Multinomial","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"Draw random sample Multinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"","code":"# S3 method for class 'Multinomial' random(x, n = 1L, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"x Multinomial object created call Multinomial(). n number samples draw. Defaults 1L. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"integer vector length n.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"","code":"set.seed(27) X <- Multinomial(size = 5, p = c(0.3, 0.4, 0.2, 0.1)) X #> Multinomial distribution (size = 5, p = [0.3, 0.4, ..., 0.1]) random(X, 10) #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 4 3 1 0 2 2 4 2 0 1 #> [2,] 1 1 4 4 1 1 1 3 1 1 #> [3,] 0 1 0 1 1 1 0 0 3 3 #> [4,] 0 0 0 0 1 1 0 0 1 0 # pdf(X, 2) # log_pdf(X, 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"Draw random sample negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"x NegativeBinomial object created call NegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Normal distribution — random.Normal","title":"Draw a random sample from a Normal distribution — random.Normal","text":"Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Normal distribution — random.Normal","text":"","code":"# S3 method for class 'Normal' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Normal distribution — random.Normal","text":"x Normal object created call Normal(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Normal distribution — random.Normal","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Normal distribution — random.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Poisson distribution — random.Poisson","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"Draw random sample Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"","code":"# S3 method for class 'Poisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"x Poisson object created call Poisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"Draw random sample PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"x PoissonBinomial object created call PoissonBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"Integers containing values 0 x$size. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"Draw random sample RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"x RevWeibull object created call RevWeibull(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a StudentsT distribution — random.StudentsT","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"Please see documentation StudentsT() properties T distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"","code":"# S3 method for class 'StudentsT' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"x StudentsT object created call StudentsT(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Tukey distribution — random.Tukey","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"Draw random sample Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"","code":"# S3 method for class 'Tukey' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"x Tukey object created call Tukey(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a continuous Uniform distribution — random.Uniform","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"Draw random sample continuous Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"","code":"# S3 method for class 'Uniform' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"x Uniform object created call Uniform(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"Values [, b]. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Weibull distribution — random.Weibull","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"Draw random sample Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"","code":"# S3 method for class 'Weibull' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"x Weibull object created call Weibull(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"Draw random sample zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"x ZINegativeBinomial object created call ZINegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"Draw random sample zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"x ZIPoisson object created call ZIPoisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"Draw random sample zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"x ZTNegativeBinomial object created call ZTNegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"Draw random sample zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"x ZTPoisson object created call ZTPoisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a probability distribution — random","title":"Draw a random sample from a probability distribution — random","text":"Generic function drawing random samples distribution objects.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a probability distribution — random","text":"","code":"random(x, n = 1L, drop = TRUE, ...) # S3 method for class 'distribution' simulate(object, nsim = 1L, seed = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a probability distribution — random","text":"x, object object. package provides methods distribution objects Normal() Binomial() etc. n, nsim number samples draw. positive integer. Defaults 1L. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors. seed optional random seed set using set.seed prior drawing random sample. previous random seed global environment () restored afterwards.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a probability distribution — random","text":"Random samples drawn distriubtion x. random methods typically return either matrix , possible, vector. simulate method always returns data frame (attribute \"seed\" containing .Random.seed simulation).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Draw a random sample from a probability distribution — random","text":"random new generic drawing random samples S3 distribution objects provided package, Normal Binomial etc. respective methods typically call \"r\" function corresponding distribution functions provided base R rnorm, rbinom etc. addition new random generic also simulate method distribution objects simply calls random method internally.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a probability distribution — random","text":"","code":"## distribution object X <- Normal() ## 10 random samples random(X, 10) #> [1] 0.295241218 0.006885942 1.157410886 2.134637891 0.237844613 #> [6] -1.285127357 0.034827247 1.570295342 0.158010051 -0.745799472"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate responses from fitted model objects — simulate.default","title":"Simulate responses from fitted model objects — simulate.default","text":"Default method simulating new responses model object prodist method (extracting probability distribution object).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate responses from fitted model objects — simulate.default","text":"","code":"# Default S3 method simulate(object, nsim = 1, seed = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate responses from fitted model objects — simulate.default","text":"object object prodist method available. nsim number response vectors simulate. positive integer. Defaults 1. seed optional random seed set using set.seed prior drawing random sample. previous random seed global environment () restored afterwards. ... Arguments passed simulate.distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate responses from fitted model objects — simulate.default","text":"data frame attribute \"seed\" containing .Random.seed simulation.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate responses from fitted model objects — simulate.default","text":"default method simply combines two building blocks provided package: (1) prodist extracting probability distribution fitted model object, (2) simulate.distribution simulating new observations distribution (internally calling random). Thus, enables simulation fitted model object provides prodist method. waives need implement dedicated simulate method model class.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate responses from fitted model objects — simulate.default","text":"","code":"## Poisson GLM for FIFA 2018 goals data(\"FIFA2018\", package = \"distributions3\") m <- glm(goals ~ difference, data = FIFA2018, family = poisson) ## simulate new goals via glm method set.seed(0) g_glm <- simulate(m, n = 3) ## alternatively use the new default method set.seed(0) g_default <- simulate.default(m, n = 3) ## same results all.equal(g_glm, g_default, check.attributes = FALSE) #> [1] TRUE"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"Compute sufficient statistics Bernoulli distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"d Bernoulli object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"named list sufficient statistics Bernoulli distribution: successes: number successful trials (sum(x == 1)) failures: number failed trials (sum(x == 0)).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"Compute sufficient statistics Binomial distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"","code":"# S3 method for class 'Binomial' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"d Binomial object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"named list sufficient statistics Binomial distribution: successes: total number successful trials. experiments: number experiments run. trials: number trials run per experiment.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"Compute sufficient statistics Exponential distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"","code":"# S3 method for class 'Exponential' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"d Exponential object created call Exponential(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"named list sufficient statistics exponential distribution: sum: sum observations. samples: number observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"sum: sum data. log_sum: log sum data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"","code":"# S3 method for class 'Gamma' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"d Gamma object created call Gamma(). x vector fit Gamma distribution . ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"Gamma object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"Compute sufficient statistics Geometric distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"","code":"# S3 method for class 'Geometric' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"d Geometric object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"named list sufficient statistics Geometric distribution: trials: total number trials ran first success. experiments: number experiments run.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"Compute sufficient statistics Log-normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"","code":"# S3 method for class 'LogNormal' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"d LogNormal object created call LogNormal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"named list sufficient statistics normal distribution: mu: sample mean log data. sigma: sample standard deviation log data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"Compute sufficient statistics Normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"","code":"# S3 method for class 'Normal' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"d Normal object created call Normal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"named list sufficient statistics normal distribution: mu: sample mean data. sigma: sample standard deviation data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"Compute sufficient statistics Poisson distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"","code":"# S3 method for class 'Poisson' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"d Poisson object created call Poisson(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"named list sufficient statistics Poisson distribution: sum: sum data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics of a distribution from data — suff_stat","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"Generic function computing sufficient statistics distribution based empirical data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"","code":"suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector data compute likelihood. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"named list sufficient statistics","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"","code":"X <- Normal() suff_stat(X, c(-1, 0, 0, 0, 3)) #> $mu #> [1] 0.4 #> #> $sigma #> [1] 1.516575 #> #> $samples #> [1] 5 #>"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Bernoulli distribution — support.Bernoulli","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"Return support Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"d Bernoulli object created call Bernoulli(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Beta distribution — support.Beta","title":"Return the support of the Beta distribution — support.Beta","text":"Return support Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Beta distribution — support.Beta","text":"","code":"# S3 method for class 'Beta' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Beta distribution — support.Beta","text":"d Beta object created call Beta(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Beta distribution — support.Beta","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Binomial distribution — support.Binomial","title":"Return the support of the Binomial distribution — support.Binomial","text":"Return support Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Binomial distribution — support.Binomial","text":"","code":"# S3 method for class 'Binomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Binomial distribution — support.Binomial","text":"d Binomial object created call Binomial(). drop logical. Shoul result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Binomial distribution — support.Binomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Cauchy distribution — support.Cauchy","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"Return support Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"","code":"# S3 method for class 'Cauchy' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"d Cauchy object created call Cauchy(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the ChiSquare distribution — support.ChiSquare","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"Return support ChiSquare distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"d ChiSquare object created call ChiSquare(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Erlang distribution — support.Erlang","title":"Return the support of the Erlang distribution — support.Erlang","text":"Return support Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Erlang distribution — support.Erlang","text":"","code":"# S3 method for class 'Erlang' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Erlang distribution — support.Erlang","text":"d Erlang object created call Erlang(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Erlang distribution — support.Erlang","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Exponential distribution — support.Exponential","title":"Return the support of the Exponential distribution — support.Exponential","text":"Return support Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Exponential distribution — support.Exponential","text":"","code":"# S3 method for class 'Exponential' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Exponential distribution — support.Exponential","text":"d Exponential object created call Exponential(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Exponential distribution — support.Exponential","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the FisherF distribution — support.FisherF","title":"Return the support of the FisherF distribution — support.FisherF","text":"Return support FisherF distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the FisherF distribution — support.FisherF","text":"","code":"# S3 method for class 'FisherF' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the FisherF distribution — support.FisherF","text":"d FisherF object created call FisherF(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the FisherF distribution — support.FisherF","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Frechet distribution — support.Frechet","title":"Return the support of the Frechet distribution — support.Frechet","text":"Return support Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Frechet distribution — support.Frechet","text":"","code":"# S3 method for class 'Frechet' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Frechet distribution — support.Frechet","text":"d Frechet object created call Frechet(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Frechet distribution — support.Frechet","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of a GEV distribution — support.GEV","title":"Return the support of a GEV distribution — support.GEV","text":"Return support GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of a GEV distribution — support.GEV","text":"","code":"# S3 method for class 'GEV' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of a GEV distribution — support.GEV","text":"d GEV object created call GEV(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of a GEV distribution — support.GEV","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the GP distribution — support.GP","title":"Return the support of the GP distribution — support.GP","text":"Return support GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the GP distribution — support.GP","text":"","code":"# S3 method for class 'GP' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the GP distribution — support.GP","text":"d GP object created call GP(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the GP distribution — support.GP","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Gamma distribution — support.Gamma","title":"Return the support of the Gamma distribution — support.Gamma","text":"Return support Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Gamma distribution — support.Gamma","text":"","code":"# S3 method for class 'Gamma' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Gamma distribution — support.Gamma","text":"d Gamma object created call Gamma(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Gamma distribution — support.Gamma","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Geometric distribution — support.Geometric","title":"Return the support of the Geometric distribution — support.Geometric","text":"Return support Geometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Geometric distribution — support.Geometric","text":"","code":"# S3 method for class 'Geometric' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Geometric distribution — support.Geometric","text":"d Geometric object created call Geometric(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Geometric distribution — support.Geometric","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Gumbel distribution — support.Gumbel","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"Return support Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"","code":"# S3 method for class 'Gumbel' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"d Gumbel object created call Gumbel(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"Return support hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"d HurdleNegativeBinomial object created call HurdleNegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"Return support hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"d HurdlePoisson object created call HurdlePoisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the HyperGeometric distribution — support.HyperGeometric","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"Return support HyperGeometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"d HyperGeometric object created call HyperGeometric(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the LogNormal distribution — support.LogNormal","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"Return support LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"","code":"# S3 method for class 'LogNormal' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"d LogNormal object created call LogNormal(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Logistic distribution — support.Logistic","title":"Return the support of the Logistic distribution — support.Logistic","text":"Return support Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Logistic distribution — support.Logistic","text":"","code":"# S3 method for class 'Logistic' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Logistic distribution — support.Logistic","text":"d Logistic object created call Logistic(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Logistic distribution — support.Logistic","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"Return support NegativeBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"d NegativeBinomial object created call NegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Normal distribution — support.Normal","title":"Return the support of the Normal distribution — support.Normal","text":"Return support Normal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Normal distribution — support.Normal","text":"","code":"# S3 method for class 'Normal' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Normal distribution — support.Normal","text":"d Normal object created call Normal(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Normal distribution — support.Normal","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Poisson distribution — support.Poisson","title":"Return the support of the Poisson distribution — support.Poisson","text":"Return support Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Poisson distribution — support.Poisson","text":"","code":"# S3 method for class 'Poisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Poisson distribution — support.Poisson","text":"d Poisson object created call Poisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Poisson distribution — support.Poisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"Return support PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"d PoissonBinomial object created call PoissonBinomial(). drop logical. Shoul result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the RevWeibull distribution — support.RevWeibull","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"Return support RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"d RevWeibull object created call RevWeibull(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the StudentsT distribution — support.StudentsT","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"Return support StudentsT distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"","code":"# S3 method for class 'StudentsT' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"d StudentsT object created call StudentsT(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Tukey distribution — support.Tukey","title":"Return the support of the Tukey distribution — support.Tukey","text":"Return support Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Tukey distribution — support.Tukey","text":"","code":"# S3 method for class 'Tukey' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Tukey distribution — support.Tukey","text":"d Tukey object created call Tukey(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Tukey distribution — support.Tukey","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Uniform distribution — support.Uniform","title":"Return the support of the Uniform distribution — support.Uniform","text":"Return support Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Uniform distribution — support.Uniform","text":"","code":"# S3 method for class 'Uniform' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Uniform distribution — support.Uniform","text":"d Uniform object created call Uniform(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Uniform distribution — support.Uniform","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Weibull distribution — support.Weibull","title":"Return the support of the Weibull distribution — support.Weibull","text":"Return support Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Weibull distribution — support.Weibull","text":"","code":"# S3 method for class 'Weibull' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Weibull distribution — support.Weibull","text":"d Weibull object created call Weibull(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Weibull distribution — support.Weibull","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"Return support zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"d ZINegativeBinomial object created call ZINegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"Return support zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"d ZIPoisson object created call ZIPoisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"Return support zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"d ZTNegativeBinomial object created call ZTNegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"Return support zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"d ZTPoisson object created call ZTPoisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of a distribution — support","title":"Return the support of a distribution — support","text":"Generic function computing support interval (minimum maximum) given probability distribution object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of a distribution — support","text":"","code":"support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of a distribution — support","text":"d object. package provides methods distribution objects Normal() Binomial() etc. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of a distribution — support","text":"vector (matrix) two elements (columns) indicating range (minimum maximum) support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return the support of a distribution — support","text":"","code":"X <- Normal() support(X) #> min max #> -Inf Inf Y <- Uniform(-1, 1:3) support(Y) #> min max #> [1,] -1 1 #> [2,] -1 2 #> [3,] -1 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the moments of a probability distribution — variance","title":"Compute the moments of a probability distribution — variance","text":"Generic functions computing moments (variance, skewness, excess kurtosis) probability distributions.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the moments of a probability distribution — variance","text":"","code":"variance(x, ...) skewness(x, ...) kurtosis(x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the moments of a probability distribution — variance","text":"x object. package provides methods distribution objects Normal() Binomial() etc. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the moments of a probability distribution — variance","text":"Numeric vector values moments.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the moments of a probability distribution — variance","text":"functions variance, skewness, kurtosis new generic functions computing moments probability distributions provided package. Additionally, probability distributions distributions3 methods mean generic. Moreover, quantiles can computed methods quantile. examples illustrating usage probability distribution objects, see manual pages respective distributions, e.g., Normal Binomial etc.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":null,"dir":"Reference","previous_headings":"","what":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"Methods vec_proxy vec_restore vctrs order include distribution objects tibble objects.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"","code":"# S3 method for class 'distribution' vec_proxy(x, ...) # S3 method for class 'distribution' vec_restore(x, to, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"x, Objects inheriting distribution. ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"vec_proxy method returns distribution object additionally inherits data.frame vec_restore method restores original distribution classes.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"methods vec_proxy vec_restore vctrs needed distribution objects can included vector column (extracted ) tibble data frames. vec_proxy simply adds class data.frame actual underlying data structure used distribution objects. way number rows etc. can correctly determined. Conversely, vec_restore strips additional data.frame class restores original distribution classes. Users typically need call vec_proxy vec_restore directly.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"","code":"## Poisson GLM for FIFA 2018 goals data data(\"FIFA2018\", package = \"distributions3\") m <- glm(goals ~ difference, data = FIFA2018, family = poisson) ## Predict fitted Poisson distributions for teams with ability differences ## of -1, 0, 1 (out-of-sample) using the new data as a data.frame nd <- data.frame(difference = -1:1) nd$dist <- prodist(m, newdata = nd) nd #> difference dist #> 1 -1 Poisson(lambda = 0.8181454) #> 2 0 Poisson(lambda = 1.2370397) #> 3 1 Poisson(lambda = 1.8704100) ## Do the same using the new data as a tibble library(\"tibble\") nt <- tibble(difference = -1:1) nt$dist <- prodist(m, newdata = nt) nt #> # A tibble: 3 × 2 #> difference dist #> #> 1 -1 Poisson(lambda = 0.8181) #> 2 0 Poisson(lambda = 1.2370) #> 3 1 Poisson(lambda = 1.8704)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-inflated negative binomial distribution — dzinbinom","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"Density, distribution function, quantile function, random generation zero-inflated negative binomial distribution parameters mu, theta (size), pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"","code":"dzinbinom(x, mu, theta, size, pi, log = FALSE) pzinbinom(q, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) qzinbinom(p, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) rzinbinom(n, mu, theta, size, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"x vector (non-negative integer) quantiles. mu vector (non-negative) negative binomial location parameters. theta, size vector (non-negative) negative binomial overdispersion parameters. theta , equivalently, size may specified. pi vector zero-inflation probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"functions follow usual conventions d/p/q/r functions base R. particular, four zinbinom functions zero-inflated negative binomial distribution call corresponding nbinom functions negative binomial distribution base R internally. Note, however, precision qzinbinom large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"","code":"## theoretical probabilities for a zero-inflated negative binomial distribution x <- 0:8 p <- dzinbinom(x, mu = 2.5, theta = 1, pi = 0.25) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rzinbinom(500, mu = 2.5, theta = 1, pi = 0.25) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-inflated Poisson distribution — dzipois","title":"The zero-inflated Poisson distribution — dzipois","text":"Density, distribution function, quantile function, random generation zero-inflated Poisson distribution parameters lambda pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-inflated Poisson distribution — dzipois","text":"","code":"dzipois(x, lambda, pi, log = FALSE) pzipois(q, lambda, pi, lower.tail = TRUE, log.p = FALSE) qzipois(p, lambda, pi, lower.tail = TRUE, log.p = FALSE) rzipois(n, lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-inflated Poisson distribution — dzipois","text":"x vector (non-negative integer) quantiles. lambda vector (non-negative) Poisson parameters. pi vector zero-inflation probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-inflated Poisson distribution — dzipois","text":"functions follow usual conventions d/p/q/r functions base R. particular, four zipois functions zero-inflated Poisson distribution call corresponding pois functions Poisson distribution base R internally. Note, however, precision qzipois large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-inflated Poisson distribution — dzipois","text":"","code":"## theoretical probabilities for a zero-inflated Poisson distribution x <- 0:8 p <- dzipois(x, lambda = 2.5, pi = 0.25) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rzipois(500, lambda = 2.5, pi = 0.25) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-truncated negative binomial distribution — dztnbinom","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"Density, distribution function, quantile function, random generation zero-truncated negative binomial distribution parameters mu theta (size).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"","code":"dztnbinom(x, mu, theta, size, log = FALSE) pztnbinom(q, mu, theta, size, lower.tail = TRUE, log.p = FALSE) qztnbinom(p, mu, theta, size, lower.tail = TRUE, log.p = FALSE) rztnbinom(n, mu, theta, size)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"x vector (non-negative integer) quantiles. mu vector (non-negative) negative binomial location parameters. theta, size vector (non-negative) negative binomial overdispersion parameters. theta , equivalently, size may specified. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"negative binomial distribution left-truncated zero (zero-truncated negative binomial short) distribution obtained, considering negative binomial variable Y conditional Y greater zero. functions follow usual conventions d/p/q/r functions base R. particular, four ztnbinom functions zero-truncated negative binomial distribution call corresponding nbinom functions negative binomial distribution base R internally.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"","code":"## theoretical probabilities for a zero-truncated negative binomial distribution x <- 0:8 p <- dztnbinom(x, mu = 2.5, theta = 1) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rztnbinom(500, mu = 2.5, theta = 1) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-truncated Poisson distribution — dztpois","title":"The zero-truncated Poisson distribution — dztpois","text":"Density, distribution function, quantile function, random generation zero-truncated Poisson distribution parameter lambda.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-truncated Poisson distribution — dztpois","text":"","code":"dztpois(x, lambda, log = FALSE) pztpois(q, lambda, lower.tail = TRUE, log.p = FALSE) qztpois(p, lambda, lower.tail = TRUE, log.p = FALSE) rztpois(n, lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-truncated Poisson distribution — dztpois","text":"x vector (non-negative integer) quantiles. lambda vector (non-negative) Poisson parameters. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-truncated Poisson distribution — dztpois","text":"Poisson distribution left-truncated zero (zero-truncated Poisson short) distribution obtained, considering Poisson variable Y conditional Y greater zero. functions follow usual conventions d/p/q/r functions base R. particular, four ztpois functions zero-truncated Poisson distribution call corresponding pois functions Poisson distribution base R internally.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-truncated Poisson distribution — dztpois","text":"","code":"## theoretical probabilities for a zero-truncated Poisson distribution x <- 0:8 p <- dztpois(x, lambda = 2.5) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rztpois(500, lambda = 2.5) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-development-version","dir":"Changelog","previous_headings":"","what":"distributions3 (development version)","title":"distributions3 (development version)","text":"warning, default (#100). prodist() methods various count regression objects now distinguish computations classic pscl package newer countreg package (currently R-Forge, soon released CRAN). simulate() method distribution objects now better aligned simulate.lm() base R: now always returns data.frame seed attribute. New simulate() default method leverages prodist() subsequently uses simulate() method distribution objects. New prodist() methods distribution objects just returns unmodified distribution object . format() method - hence print() method - distribution objects simplified. example, now Normal(mu = 0, sigma = 1) used instead Normal distribution (mu = 0, sigma = 1) order yield compact output, especially vectors distributions (#101). Added .character() method essentially calls format(..., digits = 15, drop0trailing = TRUE). mimics behavior precision base R real vectors. Note enables using match() distribution objects. Added duplicated() method relies corresponding method data.frame parameters distribution. Enabled inclusion distribution vectors columns tibble data objects, see ?vec_proxy.distribution details practical example. Fixed errors notation cumulative distribution function documentation HurdlePoisson() HurdleNegativeBinomial() (@dkwhu #94 #96). prodist() method glm objects can now also handle family specifications MASS::negative.binomial(theta) fixed theta (reported Christian Kleiber). Replace ellipsis dependency rlang former deprecated/archived (@olivroy #105). small improvements methods manual pages.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-021","dir":"Changelog","previous_headings":"","what":"distributions3 0.2.1","title":"distributions3 0.2.1","text":"CRAN release: 2022-09-07 New generics is_discrete() is_continous() methods distribution objects package. is_discrete() methods return TRUE every distribution discrete entire support FALSE otherwise. Analogously, is_continuous() returns TRUE every distribution continuous entire support FALSE otherwise. Thus, mixed discrete-continuous distributions methods yield FALSE (#90). New logical argument elementwise = NULL apply_dpqr() hence inherited cdf(), pdf(), log_pdf(), quantile(). provides type-safety applying one functions vector distributions d numeric argument x d x length n > 1. setting elementwise = TRUE function applied element--element, also yielding vector length n. setting elementwise = FALSE function applied combinations yielding n--n matrix. default elementwise = NULL corresponds FALSE d x different lengths TRUE length n > 1 (#87). Extended support various count data distributions, now enompassing Poisson negative binomial distributions along various adjustments zero counts (hurdle, inflation, truncation, respectively). details provided following items (#86). New d/p/q/r functions hnbinom, zinbinom, ztnbinom, ztpois similar corresponding nbinom pois functions base R. New HurdleNegativeBinomial(), ZINegativeBinomial(), ZTNegativeBinomial(), ZTPoisson() distribution constructors along corresponding S3 methods “usual” generics (except skewness() kurtosis()). New prodist() methods extracting fitted/predicted probability distributions models estimated hurdle(), zeroinfl(), zerotrunc() objects either pscl package countreg package. Added argument prodist(..., sigma = \"ML\") lm method extracting fitted/predicted probability distribution linear regression model. previous version prodist() method always used least-squares estimate error variance (= residual sum squares divided residual degrees freedom, n - k), also reported summary() method. Now default use maximum-likelihood estimate instead (divided number observations, n) consistent logLik() method. previous behavior can obtained specifying sigma = \"OLS\" (#91). Similarly lm method glm method prodist(..., dispersion = NULL) now, default, uses dispersion estimate matches logLik() output. based deviance divided number observations, n. Alternatively, dispersion = \"Chisquared\" uses estimate employed summary() method, based Chi-squared statistic divided residual degrees freedom, n - k. Small improvements methods various distribution objects: Added support() method GEV-based distributions (GEV(), GP(), Gumbel(), Frechet()). Added random() method Tukey() distribution (using inversion method).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-020","dir":"Changelog","previous_headings":"","what":"distributions3 0.2.0","title":"distributions3 0.2.0","text":"CRAN release: 2022-06-21 Vectorized univariate distribution objects Moritz Lang Achim Zeileis (#71 #82). allows representation fitted probability distributions regression models. New helper functions provided help setting distribution objects unified way. particular, apply_dpqr() helps apply standard d/p/q/r functions available base R many packages. accompanying manual page provides worked examples guidance. New vignette (Achim Zeileis) using distributions3 go basic probability theory probabilistic regression models. Illustrated Poisson GLMs number goals per team 2018 FIFA World Cup explained teams’ ability differences. (#74) New generic function prodist() extract fitted (-sample) predicted (--sample) probability distributions model objects like lm, glm, arima. (#83) Extended support count data distributions (Achim Zeileis): Alternative parameterization negative binomial distribution (commonly used regression models), zero-inflated Poisson, zero-hurdle Poisson. (#80 #81)","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-012","dir":"Changelog","previous_headings":"","what":"distributions3 0.1.2","title":"distributions3 0.1.2","text":"CRAN release: 2022-01-03 Added plotting generic univariate distributions (@paulnorthrop, PR #56) Added support Generalised Extreme Value (GEV), Frechet, Gumbel, reversed Weibull Generalised Pareto (GP) distributions (@paulnorthrop, PR #52) Added support Erlang distribution (@ellessenne, PR #54) Various minor bug fixes","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-011","dir":"Changelog","previous_headings":"","what":"distributions3 0.1.1","title":"distributions3 0.1.1","text":"CRAN release: 2019-09-03 Rename distributions3 CRAN","code":""}] +[{"path":"https://alexpghayes.github.io/distributions3/dev/CODE_OF_CONDUCT.html","id":null,"dir":"","previous_headings":"","what":"Contributor Code of Conduct","title":"Contributor Code of Conduct","text":"contributors maintainers project, pledge respect people contribute reporting issues, posting feature requests, updating documentation, submitting pull requests patches, activities. committed making participation project harassment-free experience everyone, regardless level experience, gender, gender identity expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion. Examples unacceptable behavior participants include use sexual language imagery, derogatory comments personal attacks, trolling, public private harassment, insults, unprofessional conduct. Project maintainers right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct. Project maintainers follow Code Conduct may removed project team. Instances abusive, harassing, otherwise unacceptable behavior may reported opening issue contacting one project maintainers. Code Conduct adapted Contributor Covenant (https://www.contributor-covenant.org), version 1.0.0, available https://contributor-covenant.org/version/1/0/0/.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to distributions","title":"Contributing to distributions","text":"outlines propose change distributions. detailed info contributing , tidyverse packages, please see development contributing guide.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to distributions","text":"Small typos grammatical errors documentation may edited directly using GitHub web interface, long changes made source file. YES: edit roxygen comment .R file R/. : edit .Rd file man/.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"prerequisites","dir":"","previous_headings":"","what":"Prerequisites","title":"Contributing to distributions","text":"make substantial pull request, always file issue make sure someone team agrees ’s problem. ’ve found bug, create associated issue illustrate bug minimal reprex.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"","what":"Pull request process","title":"Contributing to distributions","text":"recommend create Git branch pull request (PR). Look Travis AppVeyor build status making changes. README contain badges continuous integration services used package. New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat. Contributions test cases included easier accept. user-facing changes, add bullet top NEWS.md current development version header describing changes made followed GitHub username, links relevant issue(s)/PR(s).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to distributions","text":"Please note distributions project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/CONTRIBUTING.html","id":"see-tidyverse-development-contributing-guide","dir":"","previous_headings":"","what":"See tidyverse development contributing guide","title":"Contributing to distributions","text":"details.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2022 distributions3 authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"false-positives","dir":"Articles","previous_headings":"Things that can go wrong","what":"False positives","title":"Intro to hypothesis testing","text":"need concerned rejecting null hypothesis null hypothesis true. called false positive Type error. null hypothesis true, calculate statistic like , still expect see value p-value 9.6⋅10−79.6 \\cdot 10^{-7} 9.6⋅10−59.6 \\cdot 10^{-5} percent time. small p-values isn’t issue, let’s consider different null hypothesis μ0=3.9\\mu_0 = 3.9. Now $$ Z = {\\bar x - \\mu_0 \\{\\sigma \\\\sqrt n}} = {4 - 3.9 \\\\sqrt \\frac 23} \\approx 0.12 $$ corresponding p-value P(|Z|>0.12)=P(Z<−0.12)+P(Z>0.12)≈0.9 P(|Z| > 0.12) = P(Z < -0.12) + P(Z > 0.12) \\approx 0.9 see quite probable! definitely reject null hypothesis! leads us new question: reject null hypothesis? standard choice set acceptable probability false positive α\\alpha. One arbitrary common choice set α=0.05\\alpha = 0.05, means okay ${1 \\20}$ chance false positive. reject null hypothesis p-value less α\\alpha. often called “rejecting null hypothesis significance level α\\alpha”. formally, might write P(rejectH0|H0true)=α P(\\text{reject} \\; H_0 | H_0 \\; \\text{true}) = \\alpha","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"false-negatives","dir":"Articles","previous_headings":"Things that can go wrong","what":"False negatives","title":"Intro to hypothesis testing","text":"hand, may also fail reject null hypothesis null hypothesis fact false. might just enough data reject null, example. call false negative Type II error. write Power=P(fail rejectH0|H0false)=1−β \\text{Power} = P(\\text{fail reject} \\; H_0 | H_0 \\; \\text{false}) = 1 - \\beta achieve power 1−β1 - \\beta one sample Z-test, need $$ n \\approx \\left( { \\sigma \\cdot (z_{\\alpha / 2} + z_\\beta) \\ \\mu_0 - \\mu_A } \\right)^2 $$ μA\\mu_A true mean μ0\\mu_0 proposed mean. ’ll exercise later help see comes .","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"z-test","dir":"Articles","previous_headings":"Examples","what":"Z-test","title":"Intro to hypothesis testing","text":"company claims battery lifetimes normally distributed μ=40\\mu = 40 σ=5\\sigma = 5 hours. curious claim mean reasonable, collect random sample 100 batteries. sample mean 39.8. p-value Z-test H0:μ=40H_0 : \\mu = 40? begin calculating Z-score $$ Z = {\\bar x - \\mu_0 \\{\\sigma \\\\sqrt n}} = {39.8 - 40 \\{5 \\\\sqrt 100}} = 0.4 $$ calculate, using fact Z∼Normal(0,1)Z \\sim \\mathrm{Normal}(0, 1), P(Z<−0.4)+P(Z>0.4)≈0.69 P(Z < -0.4) + P(Z > 0.4) \\approx 0.69 might also interested one-sided test, HA:μ<40H_A : \\mu < 40. case p-value case Z<−0.4Z < -0.4, p-value P(Z<−0.4)≈0.34 P(Z < -0.4) \\approx 0.34","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/intro-to-hypothesis-testing.html","id":"power-for-z-test","dir":"Articles","previous_headings":"Examples","what":"Power for Z-test","title":"Intro to hypothesis testing","text":"Suppose powdered medicine supposed mean particle diameter μ=15\\mu = 15 micrometers, standard deviation diameters stays steady around 1.8 micrometers. company like high power detect mean thicknesses 0.2 micrometers away 15. n=100n = 100, power test true μ\\mu 15.2 micrometers. Assume company interested controlling type error α=0.05\\alpha = 0.05 level. reject null Z score less zα/2z_{\\alpha / 2} z1−α/2z_{1 - \\alpha / 2}, Z score less -1.96 greater 1.96. Recall Z score ${\\bar x - \\mu_0 \\{\\sigma \\\\sqrt n}}$, can rearrange terms x‾\\bar x see reject null x‾<14.65\\bar x < 14.65 x‾>15.35\\bar x > 15.35. Now interested probability rejection region alternative hypothesis μA=15.2\\mu_A = 15.2 true. P(x‾>15.35|μ=15.2)+P(x‾<14.65|μ=15.2) P(\\bar x > 15.35 | \\mu = 15.2) + P(\\bar x < 14.65 | \\mu = 15.2) know x‾∼Normal(15.2,1.8/100)\\bar x \\sim \\mathrm{Normal} \\left(15.2, 1.8 / \\sqrt{100}\\right) equals 0.001+0.198≈0.199 0.001 + 0.198 \\approx 0.199 power 20 percent. quite low.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample sign tests","text":"Sometimes want Z-test T-test, reason tests appropriate. data may skewed, distribution outliers, non-normal important way. circumstances sign test appropriate. example, suppose wander around Times Square ask strangers salaries. Incomes typically skewed, might get sample like: 8478,21564,36562,176602,9395,18320,50000,2,40298,39,10780,2268583,3404930 8478, 21564, 36562, 176602, 9395, 18320, 50000, 2, 40298, 39, 10780, 2268583, 3404930 look QQ plot, see massive outliers: Luckily, sign test requires independent samples valid inference (consequence, low power).","code":"incomes <- c(8478, 21564, 36562, 176602, 9395, 18320, 50000, 2, 40298, 39, 10780, 2268583, 3404930) qqnorm(incomes) qqline(incomes)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample sign tests","text":"sign test allows us test whether median distribution equals hypothesized value. Let’s test whether data consistent median 50,000, close-ish median income U.S. memory serves. H0:m=50,000HA:μ≠50,000 H_0: m = 50,000 \\qquad H_A: \\mu \\neq 50,000 mm stands population median. test statistic B=∑=1n1(50,000,∞)(xi)∼Binomial(N,0.5) B = \\sum_{=1}^n 1_{(50, 000, \\infty)} (x_i) \\sim \\mathrm{Binomial}(N, 0.5) BB number data points observed strictly greater median, NN sample size exact ties median removed. Forgetting remove exact ties frequent mistake students test classes TA. sort data can see B=3B = 3 N=12N = 12 case: can verify R well:","code":"sort(incomes) #> [1] 2 39 8478 9395 10780 18320 21564 36562 40298 #> [10] 50000 176602 2268583 3404930 b <- sum(incomes > 50000) b #> [1] 3 n <- sum(incomes != 50000) n #> [1] 12"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample sign tests","text":"calculate two-sided p-value, need find 2⋅min(P(B≥3),P(B≤3))=2⋅min(1−P(B≤2),P(B≤3)) \\begin{align} 2 \\cdot \\min(P(B \\ge 3), P(B \\le 3)) = 2 \\cdot \\min(1 - P(B \\le 2), P(B \\le 3)) \\end{align} need c.d.f. binomial random variable: practice computing c.d.f. binomial random variables rather tedious aren’t great shortcuts small samples. got question like exam, ’d want use binomial p.m.f. repeatedly, like : P(B≤3)=P(B=0)+P(B=1)+P(B=2)+P(B=3)=(120)0.500.512+(121)0.510.511+(122)0.520.510+(123)0.530.59 \\begin{align} P(B \\le 3) &= P(B = 0) + P(B = 1) + P(B = 2) + P(B = 3) \\\\ &= \\binom{12}{0} 0.5^0 0.5^12 + \\binom{12}{1} 0.5^1 0.5^11 + \\binom{12}{2} 0.5^2 0.5^10 + \\binom{12}{3} 0.5^3 0.5^9 \\end{align} Finally, sometimes interest one sided sign tests. test H0:m≤3HA:m>3 \\begin{align} H_0: m \\le 3 \\qquad H_A: m > 3 \\end{align} p-value given P(B>3)=1−P(B≤2) P(B > 3) = 1 - P(B \\le 2) calculate test H0:m≥3HA:m<3 H_0: m \\ge 3 \\qquad H_A: m < 3 p-value given P(B<3) P(B < 3) calculate ","code":"library(distributions3) X <- Binomial(n, 0.5) 2 * min(cdf(X, b), 1 - cdf(X, b - 1)) #> [1] 0.1459961 1 - cdf(X, b - 1) #> [1] 0.9807129 cdf(X, b) #> [1] 0.07299805"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-sign-tests.html","id":"using-the-binom-test-function","dir":"Articles","previous_headings":"","what":"Using the binom.test() function","title":"One sample sign tests","text":"verify results can use binom.test() base R. x argument gets value BB, n value NN, p = 0.5 test median. , H0:m=3H_0 : m = 3 use H0:m≤3H_0 : m \\le 3 H0:m≥3H_0 : m \\ge 3 results agree manual computations, reassuring.","code":"binom.test(3, n = 12, p = 0.5) #> #> Exact binomial test #> #> data: 3 and 12 #> number of successes = 3, number of trials = 12, p-value = 0.146 #> alternative hypothesis: true probability of success is not equal to 0.5 #> 95 percent confidence interval: #> 0.05486064 0.57185846 #> sample estimates: #> probability of success #> 0.25 binom.test(3, n = 12, p = 0.5, alternative = \"greater\") #> #> Exact binomial test #> #> data: 3 and 12 #> number of successes = 3, number of trials = 12, p-value = 0.9807 #> alternative hypothesis: true probability of success is greater than 0.5 #> 95 percent confidence interval: #> 0.07187026 1.00000000 #> sample estimates: #> probability of success #> 0.25 binom.test(3, n = 12, p = 0.5, alternative = \"less\") #> #> Exact binomial test #> #> data: 3 and 12 #> number of successes = 3, number of trials = 12, p-value = 0.073 #> alternative hypothesis: true probability of success is less than 0.5 #> 95 percent confidence interval: #> 0.0000000 0.5273266 #> sample estimates: #> probability of success #> 0.25"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-confidence-interval.html","id":"using-the-t-test-function","dir":"Articles","previous_headings":"","what":"Using the t.test() function","title":"T confidence interval for a mean","text":"want verify calculation correct, R function t.test() performs T-tests calculates T confidence intervals means. get confidence interval single sample, pass t.test() vector data, tell confidence coefficient (recall 0.88) via conf.level argument. conf.level defaults 0.95, means don’t specify confidence interval get 95 percent confidence interval. t.test() returns interval (2.63, 6.37), exactly calculated hand, reassuring. also one-sample T-test us well. don’t specify conf.level, get 95 percent confidence interval: wider 88 percent confidence interval, expect.","code":"t.test(x, conf.level = 0.88) #> #> One Sample t-test #> #> data: x #> t = 4.1367, df = 9, p-value = 0.002534 #> alternative hypothesis: true mean is not equal to 0 #> 88 percent confidence interval: #> 2.631598 6.368402 #> sample estimates: #> mean of x #> 4.5 t.test(x) #> #> One Sample t-test #> #> data: x #> t = 4.1367, df = 9, p-value = 0.002534 #> alternative hypothesis: true mean is not equal to 0 #> 95 percent confidence interval: #> 2.0392 6.9608 #> sample estimates: #> mean of x #> 4.5"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample T-tests","text":"Let’s suppose student interesting estimating many memes professors know love. go class, every time professor uses new meme, write . year classes, student recorded following meme counts, count corresponds single class took: 3,7,11,0,7,0,4,5,6,2 3, 7, 11, 0, 7, 0, 4, 5, 6, 2 Note: Z-test, need know population standard deviation σ\\sigma. T-tests, unnecessary, estimate standard deviation data. results additional uncertainty test statistic, reflected heavier tails T distribution compared normal distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"One sample T-tests","text":"can T-test, need make check can reasonably treat mean sample normally distributed. happens case either following hold: data comes normal distribution. lots data. much? Many textbooks use 30 data points rule thumb. Since small sample, let’s check data comes normal distribution using normal quantile-quantile plot. Since data lies close line y=xy = x, notable systematic deviations line, ’s safe treat sample coming normal distribution. can proceed hypothesis test.","code":"# read in the data x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) # make the qqplot qqnorm(x) qqline(x)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample T-tests","text":"Let’s test null hypothesis , average, professors know 3 memes. H0:μ=3HA:μ≠3 H_0: \\mu = 3 \\qquad H_A: \\mu \\neq 3 First need calculate T-statistic. Let’s use R. Remember T-statistic defined T=x‾−μ0s/n∼tn−1 T = \\frac{\\bar x - \\mu_0}{s / \\sqrt{n}} \\sim t_{n-1} x‾=1n∑=1nxi\\bar x = \\frac 1n \\sum_{=1}^n x_i sample mean, μ0\\mu_0 proposed value population mean, s=1n−1∑=1n(xi−x‾)2s = \\sqrt{\\frac{1}{n-1} \\sum_{=1}^n (x_i - \\bar x)^2} sample standard deviation, nn sample size. test statistic T distribution n−1n-1 degrees freedom.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample T-tests","text":"R looks like: Since sample size 10, calculate two-sided p-value, need find P(|t9|≥|1.38|)=P(t9≥1.38)+P(t9≤−1.38)=1−P(t9≤1.38)+P(t9≤−1.38) \\begin{align} P(|t_9| \\ge |1.38|) &= P(t_9 \\ge 1.38) + P(t_9 \\le -1.38) \\\\ &= 1 - P(t_9 \\le 1.38) + P(t_9 \\le -1.38) \\\\ \\end{align} need c.d.f. t9t_9 distribution. Note saved t_stat also done slightly accurate since rounding error. p-value 0.20. verify T-table. Note get value cdf(T_9, 1.38) looking 1.38 T-table. may also seen different formula p-value two-sided T-test, makes use fact T distribution symmetric: P(|t9|≥|1.38|)=2⋅P(t9≤−|1.38|) \\begin{align} P(|t_9| \\ge |1.38|) &= 2 \\cdot P(t_9 \\le -|1.38|) \\end{align} Using formula get result: Finally, sometimes interest one sided T-tests. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} p-value given P(t9>1.38) P(t_9 > 1.38) calculate test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 p-value given P(t9<1.38) P(t_9 < 1.38) calculate ","code":"n <- length(x) # calculate the z-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(n)) t_stat #> [1] 1.378916 library(distributions3) T_9 <- StudentsT(df = 9) # make a T_9 distribution 1 - cdf(T_9, 1.38) + cdf(T_9, -1.38) #> [1] 0.2008985 1 - cdf(T_9, abs(t_stat)) + cdf(T_9, -abs(t_stat)) #> [1] 0.2012211 2 * cdf(T_9, -1.38) #> [1] 0.2008985 1 - cdf(T_9, 1.38) #> [1] 0.1004493 cdf(T_9, 1.38) #> [1] 0.8995507"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-t-test.html","id":"using-the-t-test-function","dir":"Articles","previous_headings":"","what":"Using the t.test() function","title":"One sample T-tests","text":"want verify calculation correct, R function t.test() performs T-tests calculates T confidence intervals means. get T statistic, degrees freedom sampling distribution, p-value pass t.test() vector data. tell t.test() null hypothesis passing mu argument. case, want test mu = 3. don’t specify mu, t.test() assumes want test hypothesis H0:μ=0H_0 : \\mu = 0. looks like can also get one-sided p-values t.test() specifying alternative hypothesis. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} use test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 use results agree hand calculations earlier.","code":"t.test(x, mu = 3) #> #> One Sample t-test #> #> data: x #> t = 1.3789, df = 9, p-value = 0.2012 #> alternative hypothesis: true mean is not equal to 3 #> 95 percent confidence interval: #> 2.0392 6.9608 #> sample estimates: #> mean of x #> 4.5 t.test(x) #> #> One Sample t-test #> #> data: x #> t = 4.1367, df = 9, p-value = 0.002534 #> alternative hypothesis: true mean is not equal to 0 #> 95 percent confidence interval: #> 2.0392 6.9608 #> sample estimates: #> mean of x #> 4.5 t.test(x, mu = 3, alternative = \"greater\") #> #> One Sample t-test #> #> data: x #> t = 1.3789, df = 9, p-value = 0.1006 #> alternative hypothesis: true mean is greater than 3 #> 95 percent confidence interval: #> 2.505919 Inf #> sample estimates: #> mean of x #> 4.5 t.test(x, mu = 3, alternative = \"less\") #> #> One Sample t-test #> #> data: x #> t = 1.3789, df = 9, p-value = 0.8994 #> alternative hypothesis: true mean is less than 3 #> 95 percent confidence interval: #> -Inf 6.494081 #> sample estimates: #> mean of x #> 4.5"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample Z-tests for a proportion","text":"Let’s suppose student interesting estimating percent professors department watches Game Thrones. go office hours ask professor turns 17 62 professors department watch Game Thrones. Several faculty think Game Thrones board game. can imagine data bunch zeros ones, ithi^{th} data point, xix_i one professor ii watches Game Thrones, zero otherwise. full dataset might look something like: 1,0,0,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0 \\begin{align} & 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, \\\\ & 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, \\\\ & 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 \\end{align} much easier just remember 17 ones 45 zeros.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"One sample Z-tests for a proportion","text":"can Z-test, need make check can reasonably treat mean sample normally distributed. data definitely normal distribution since ’s zeros ones, need check central limit theorem kicks . time check 30 data points , proportion, something slightly different. data binary, like , central limit theorem kicks slower usual. standard thing check whether n⋅π>5n \\cdot \\pi > 5 n⋅(1−π)>5n \\cdot (1 - \\pi) > 5 nn sample size (62 case) π\\pi sample average. Note textbooks might use pp rather π\\pi. case π=17/62\\pi = 17 / 62, 62⋅17/62=1762 \\cdot 17 / 62 = 17 62⋅(1−17/62)=4562 \\cdot (1 - 17 / 62) = 45 ’re good go.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample Z-tests for a proportion","text":"Let’s test null hypothesis , average, twenty percent professors Game Thrones. corresponding null hypothesis H0:π=0.2HA:π≠0.2 H_0: \\pi = 0.2 \\qquad H_A: \\pi \\neq 0.2 First need calculate Z-statistic. Remember Z-statistic proportion Z=π−π0π0(1−π0)n∼Normal(0,1) Z = \\frac{\\pi - \\pi_0}{\\sqrt{\\frac{\\pi_0 (1 - \\pi_0)}{n}}} \\sim \\mathrm{Normal}(0, 1)","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample Z-tests for a proportion","text":"R looks like: calculate two-sided p-value, need find P(|Z|≥|1.46|)=P(Z≥1.46)+P(Z≤−1.46)=1−P(Z≤1.46)+P(Z≤−1.46)=1−Φ(1.46)+Φ(−1.46) \\begin{align} P(|Z| \\ge |1.46|) &= P(Z \\ge 1.46) + P(Z \\le -1.46) \\\\ &= 1 - P(Z \\le 1.46) + P(Z \\le -1.46) \\\\ &= 1 - \\Phi(1.46) + \\Phi(-1.46) \\end{align} need c.d.f. standard normal Note saved z_stat also done slightly accurate since rounding error. p-value 0.14. verify Z-table. Note get value cdf(Z, 1.46) looking 1.46 Z-table. may also seen different formula p-value two-sided Z-test, makes use fact normal distribution symmetric: P(|Z|≥|1.46|)=2⋅P(Z≤−|1.46|)=2⋅Φ(−1.46) \\begin{align} P(|Z| \\ge |1.46|) &= 2 \\cdot P(Z \\le -|1.46|) &= 2 \\cdot \\Phi(-1.46) \\end{align} Using formula get result:","code":"n <- 62 pi <- 17 / 62 pi_0 <- 0.2 # calculate the z-statistic z_stat <- (pi - pi_0) / sqrt(pi_0 * (1 - pi_0) / n) z_stat #> [1] 1.460501 library(distributions3) #> #> Attaching package: 'distributions3' #> The following object is masked from 'package:stats': #> #> Gamma #> The following object is masked from 'package:grDevices': #> #> pdf Z <- Normal(0, 1) # make a standard normal r.v. 1 - cdf(Z, 1.46) + cdf(Z, -1.46) #> [1] 0.1442901 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.1441523 2 * cdf(Z, -1.46) #> [1] 0.1442901"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test-for-proportion.html","id":"one-sided-z-tests","dir":"Articles","previous_headings":"","what":"One-sided Z-tests","title":"One sample Z-tests for a proportion","text":"Finally, sometimes interest one sided Z-tests. test H0:π≤0.2HA:π>0.2 \\begin{align} H_0: \\pi \\le 0.2 \\qquad H_A: \\pi > 0.2 \\end{align} p-value given P(Z>1.46) P(Z > 1.46) calculate test H0:π≥0.2HA:π<0.2 H_0: \\pi \\ge 0.2 \\qquad H_A: \\pi < 0.2 p-value given P(Z<1.46) P(Z < 1.46) calculate ","code":"1 - cdf(Z, 1.46) #> [1] 0.07214504 cdf(Z, 1.46) #> [1] 0.927855"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"One sample Z-tests","text":"Let’s suppose student interesting estimating many memes professors know love. go class, every time professor uses new meme, write . year classes, student recorded following meme counts, count corresponds single class took: 3,7,11,0,7,0,4,5,6,2 3, 7, 11, 0, 7, 0, 4, 5, 6, 2 student talks students ’ve done similar studies determines σ=2\\sigma = 2 reasonable value standard deviation distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"One sample Z-tests","text":"can Z-test, need make check can reasonably treat mean sample normally distributed. happens case either following hold: data comes normal distribution. lots data. much? Many textbooks use 30 data points rule thumb. Since small sample, check data comes normal distribution using normal quantile-quantile plot. Since data lies close line y=xy = x, notable systematic deviations line, ’s safe treat sample coming normal distribution. can proceed hypothesis test.","code":"# read in the data x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) # make the qqplot qqnorm(x) qqline(x)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"One sample Z-tests","text":"Let’s test null hypothesis , average, professors know 3 memes. H0:μ=3HA:μ≠3 H_0: \\mu = 3 \\qquad H_A: \\mu \\neq 3 First need calculate Z-statistic. Let’s R. Remember Z-statistic defined Z=x‾−μ0σ/n∼Normal(0,1) Z = \\frac{\\bar x - \\mu_0}{\\sigma / \\sqrt{n}} \\sim \\mathrm{Normal}(0, 1)","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"One sample Z-tests","text":"R looks like: calculate two-sided p-value, need find P(|Z|≥|2.37|)=P(Z≥2.37)+P(Z≤−2.37)=1−P(Z≤2.37)+P(Z≤−2.37)=1−Φ(2.37)+Φ(−2.37) \\begin{align} P(|Z| \\ge |2.37|) &= P(Z \\ge 2.37) + P(Z \\le -2.37) \\\\ &= 1 - P(Z \\le 2.37) + P(Z \\le -2.37) \\\\ &= 1 - \\Phi(2.37) + \\Phi(-2.37) \\end{align} need c.d.f. standard normal Note saved z_stat also done slightly accurate since rounding error. p-value 0.0177. verify Z-table. Note get value cdf(Z, 2.37) looking 2.37 Z-table. may also seen different formula p-value two-sided Z-test, makes use fact normal distribution symmetric: P(|Z|≥|2.37|)=2⋅P(Z≤−|2.37|)=2⋅Φ(−2.37) \\begin{align} P(|Z| \\ge |2.37|) &= 2 \\cdot P(Z \\le -|2.37|) \\\\ &= 2 \\cdot \\Phi(-2.37) \\end{align} Using formula get result: Finally, sometimes interest one sided Z-tests. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} p-value given P(Z>2.37) P(Z > 2.37) calculate test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 p-value given P(Z<2.37) P(Z < 2.37) calculate ","code":"n <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(n)) z_stat #> [1] 2.371708 library(distributions3) Z <- Normal(0, 1) # make a standard normal r.v. 1 - cdf(Z, 2.37) + cdf(Z, -2.37) #> [1] 0.01778809 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 2 * cdf(Z, -2.37) #> [1] 0.01778809 1 - cdf(Z, 2.37) #> [1] 0.008894043 cdf(Z, 2.37) #> [1] 0.991106"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"rejection-regions","dir":"Articles","previous_headings":"","what":"Rejection regions","title":"One sample Z-tests","text":"Preface: strongly opposed make dichotomous “reject/fail reject” decision hypothesis tests. hypothesis test, report p-value, period. Picking arbitrary α\\alpha level rejection threshold treating gold standard ridiculous, evidenced 60 years statistical literature laden warnings hypothesis testing. said, sometimes can useful think reject hypothesis test. can think three different rejection regions Z-test: rejection region terms p-value rejection region terms test statistic rejection region terms sample mean given α\\alpha level threshold, rejection regions equivalent. ’ll start thinking rejection two-sided test. H0:μ=μ0HA:μ≠μ0 \\begin{align} H_0 : \\mu = \\mu_0 \\qquad H_A : \\mu \\neq \\mu_0 \\end{align} calculate test statistic ZobsZ_\\text{obs}, p-value P(|Z|>|Zobs|)P(|Z| > |Z_\\text{obs}|) reject P(|Z|>|Zobs|)<αP(|Z| > |Z_\\text{obs}|) < \\alpha. defines first rejection region. Using observation , exactly equivalent rejecting P(|Z|>|Zobs|)<α⇔2⋅P(Z<−|Zobs|)<α⇔P(Z<−|Zobs|)<α/2 \\begin{align} P(|Z| > |Z_\\text{obs}|) < \\alpha & \\Longleftrightarrow 2 \\cdot P(Z < -|Z_\\text{obs}|) < \\alpha \\\\ & \\Longleftrightarrow P(Z < -|Z_\\text{obs}|) < \\alpha / 2 \\end{align} last statement exactly Zobsz1−α/2⇔x‾>μ0+z1−α/2σn \\begin{align} \\frac{\\bar x - \\mu_0}{\\sigma / \\sqrt{n}} > z_{1 - \\alpha / 2} & \\Longleftrightarrow \\bar x > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\end{align} x‾−μ0σ/nμ0+z1−α/2σn\\bar{x} > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} x‾<μ0+zα/2σn\\bar{x} < \\mu_0 + z_{\\alpha / 2} \\frac{\\sigma}{\\sqrt n}, power test μ=μA\\mu = \\mu_A P(reject H0|μ=μA)=P(x‾>μ0+z1−α/2σn|μ=μA)+P(x‾<μ0+zα/2σn|μ=μA). P(\\text{reject } H_0 \\left | \\mu = \\mu_A \\right .) = P\\left( \\left . \\bar x > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A \\right) + P\\left( \\left . \\bar x < \\mu_0 + z_{\\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A \\right). Remember X‾∼Normal(μ,σ2n)\\bar X \\sim \\mathrm{Normal} \\left(\\mu, \\frac{\\sigma^2}{n} \\right). means , given μ=μA\\mu = \\mu_A, x‾∼Normal(μ,σ2n)\\bar{x} \\sim \\mathrm{Normal} \\left(\\mu, \\frac{\\sigma^2}{n} \\right), let’s us calculate probabilities need find power: P(x‾>μ0+z1−α/2σn|μ=μA)=P(x‾−μAσ/n>μ0+z1−α/2σn−μAσ/n)=P(Z>μ0−μAσ/n+z1−α/2), \\begin{align} P\\left( \\left . \\bar{x} > \\mu_0 + z_{1 - \\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A \\right) &= P\\left( \\frac{\\bar{x} - \\mu_A}{\\sigma/\\sqrt{n}} > \\frac{\\mu_0 + z_{1-\\alpha/2}\\frac{\\sigma}{\\sqrt{n}} - \\mu_A}{\\sigma/\\sqrt{n}} \\right) \\\\ &= P\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right), \\end{align} similarly P(x‾<μ0+zα/2σn|μ=μA)=P(Z<μ0−μAσ/n+zα/2). P\\left( \\left . \\bar{x} < \\mu_0 + z_{\\alpha / 2} \\frac{\\sigma}{\\sqrt n} \\right | \\mu = \\mu_A\\right) = P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right). , power test, true population mean μA\\mu_A, Power=P(Z>μ0−μAσ/n+z1−α/2)+P(Z<μ0−μAσ/n+zα/2)=[1−P(Z<μ0−μAσ/n+z1−α/2)]+P(Z<μ0−μAσ/n+zα/2) \\begin{align} \\text{Power} &= P\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) + P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right) \\\\ &= \\left[1 - P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right)\\right] + P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right) \\end{align} Let’s calculate μA=5\\mu_A = 5. means probability reject null hypothesis (H0:μ=3H_0: \\mu = 3) true mean 55 0.89.","code":"power_lower <- (3 - 5) / (2 / sqrt(10)) + quantile(Z, 0.025) power_upper <- (3 - 5) / (2 / sqrt(10)) + quantile(Z, 1 - 0.025) cdf(Z, power_lower) + (1 - cdf(Z, power_upper)) #> [1] 0.8853791"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/one-sample-z-test.html","id":"formulas-for-sample-size-calculations","dir":"Articles","previous_headings":"Power and sample size calculations","what":"Formulas for sample size calculations","title":"One sample Z-tests","text":"Often times researchers like go direction: aim specific level power, calculate many observations needed reach level. achieve power 1−β1 - \\beta one sample Z-test H0:μ=μ0H_0 : \\mu = \\mu_0, need $$ n \\approx \\left( { \\sigma \\cdot (z_{\\alpha / 2} + z_\\beta) \\ \\mu_0 - \\mu_A } \\right)^2 $$ samples. nn integer, round . Often, denominator thought detectable difference. , question becomes many samples required sufficient power detect difference particular size. equation simply rewrite equation presented power. Recall, power two sided test Power=P(Z>μ0−μAσ/n+z1−α/2)+P(Z<μ0−μAσ/n+zα/2). \\text{Power} = P\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) + P\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{\\alpha/2} \\right). Usually, one terms contributing close zero. Let’s say first term one clearly different zero. determine sample size, want determine nn P(Z>μ0−μAσ/n+z1−α/2)=1−βP\\left( Z > \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) = 1-\\beta. , similarly, P(Z<μ0−μAσ/n+z1−α/2)=βP\\left( Z < \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} \\right) = \\beta. .e. need μ0−μAσ/n+z1−α/2=zβ\\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} = z_{\\beta}. zβ=μ0−μAσ/n+z1−α/2⇔zβ−z1−α/2=μ0−μAσ/n⇔σ(zβ−z1−α/2)=(μ0−μA)n⇔σ(zβ−z1−α/2)μ0−μA=n⇔(σ(zβ−z1−α/2)μ0−μA)2=n \\begin{align} z_{\\beta} = \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} + z_{1-\\alpha/2} & \\Longleftrightarrow z_{\\beta} - z_{1-\\alpha/2} = \\frac{\\mu_0 - \\mu_A}{\\sigma/\\sqrt{n}} \\\\ & \\Longleftrightarrow \\sigma (z_{\\beta} - z_{1-\\alpha/2}) = (\\mu_0-\\mu_A)\\sqrt{n} \\\\ & \\Longleftrightarrow \\frac{\\sigma (z_{\\beta} - z_{1-\\alpha/2})}{\\mu_0-\\mu_A} = \\sqrt{n} \\\\ & \\Longleftrightarrow \\left(\\frac{\\sigma (z_{\\beta} - z_{1-\\alpha/2})}{\\mu_0-\\mu_A}\\right)^2 = n \\end{align} Since z1−α/2=−zα/2z_{1-\\alpha/2} = -z_{\\alpha/2}, equation : (σ(zβ+zα/2)μ0−μA)2=n. \\left(\\frac{\\sigma (z_{\\beta} + z_{\\alpha/2})}{\\mu_0-\\mu_A}\\right)^2 = n. example, say student prior experiment determined wanted test number memes professors know love 2. want make sure sample size large enough likely reject null hypothesis true number 3. determine want probability 0.9 rejecting null true number 3. , sample size calculation looks like : $$ n \\approx \\left( { 2 \\cdot (1.96 + 1.28) \\ 2-3 } \\right)^2 = 41.99 $$ make sure reject null hypothesis probability 0.9 true value 3, ask 53 professors. calculation done R. Remember, β=1−Power\\beta = 1-\\text{Power}. Note small discrepancy. due rounding error.","code":"(2 * (quantile(Z, 0.05 / 2) + quantile(Z, 1 - 0.9)) / (3 - 2))^2 #> [1] 42.02969"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/paired-tests.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"Paired tests","text":"Suppose ’re interested people’s happiness discovering #rstats Twitter community. survey get happiness scores, using happiness survey goes 0 100. data looks like ","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/paired-tests.html","id":"working-with-the-differences","dir":"Articles","previous_headings":"","what":"Working with the differences","title":"Paired tests","text":"Crucially, since measurement measurement person, can subtract measurement measurement one sample test differences.","code":"before <- c(88, 73, 35, 21, 28, 56, 50, 73, 93, 55) after <- c(80, 78, 56, 28, 26, 50, 39, 67, 98, 63) diff <- after - before diff #> [1] -8 5 21 7 -2 -6 -11 -6 5 8"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/paired-tests.html","id":"paired-tests-versus-two-sample-tests","dir":"Articles","previous_headings":"","what":"Paired tests versus two sample tests","title":"Paired tests","text":"One key question : use paired instead two sample tests? Students typically struggle , ’s worth spending time thinking . abstract terms, use paired tests two observations experimental unit two sample tests two observations different experimental units. difficulty takes time become comfortable experimental units. recommend memorizing examples paired tests appropriate: left/right shoe examples use two sample test: Also note two sample tests, use pair - power pair can memorize analogize","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"the-poisson-distribution","dir":"Articles","previous_headings":"","what":"The Poisson distribution","title":"The Poisson distribution: From basic probability theory to regression models","text":"classic basic probability distribution employed modeling count data Poisson distribution. probability mass function f(y;λ)f(y; \\lambda) yields probability random variable YY take count y∈{0,1,2,…}y \\\\{0, 1, 2, \\dots\\} based distribution parameter λ>0\\lambda > 0: Pr(Y=y)=f(y;λ)=exp(−λ)⋅λyy!. \\text{Pr}(Y = y) = f(y; \\lambda) = \\frac{\\exp\\left(-\\lambda\\right) \\cdot \\lambda^y}{y!}. Poisson distribution many distinctive features, e.g., expectation variance equal given parameter λ\\lambda. Thus, E(Y)=λ\\text{E}(Y) = \\lambda Var(Y)=λ\\text{Var}(Y) = \\lambda. Moreover, Poisson distribution related basic probability distributions. Namely, can obtained limit binomial distribution number attempts high success probability low. Poisson distribution can approximated normal distribution λ\\lambda large. See Wikipedia (2022) properties references. distributions3 package Poisson distribution objects can generated Poisson() function. Subsequently, object can handled like distribution objects distributions3: print; extract mean variance; evaluate density, cumulative distribution, quantile function; simulate random samples. Using plot() method distribution can also visualized use show probabilities counts 0,1,…,150, 1, \\dots, 15 change parameter λ=0.5,2,5,10\\lambda = 0.5, 2, 5, 10. vignette illustrate infrastructure can leveraged obtain predicted probabilities number goals soccer matches 2018 FIFA World Cup.","code":"library(\"distributions3\") Y <- Poisson(lambda = 1.5) print(Y) ## [1] \"Poisson(lambda = 1.5)\" mean(Y) ## [1] 1.5 variance(Y) ## [1] 1.5 pdf(Y, 0:5) ## [1] 0.22313016 0.33469524 0.25102143 0.12551072 0.04706652 0.01411996 cdf(Y, 0:5) ## [1] 0.2231302 0.5578254 0.8088468 0.9343575 0.9814241 0.9955440 quantile(Y, c(0.1, 0.5, 0.9)) ## [1] 0 1 3 set.seed(0) random(Y, 5) ## [1] 3 1 1 2 3 plot(Poisson(0.5), main = expression(lambda == 0.5), xlim = c(0, 15)) plot(Poisson(2), main = expression(lambda == 2), xlim = c(0, 15)) plot(Poisson(5), main = expression(lambda == 5), xlim = c(0, 15)) plot(Poisson(10), main = expression(lambda == 10), xlim = c(0, 15))"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"goals-in-the-2018-fifa-world-cup","dir":"Articles","previous_headings":"","what":"Goals in the 2018 FIFA World Cup","title":"The Poisson distribution: From basic probability theory to regression models","text":"investigate number goals scored per match 2018 FIFA World Cup, FIFA2018 data set provides two rows, one team, 64 matches tournament. following, treat goals scored two teams match independent realistic assumption particular data set. just remark briefly also bivariate generalizations Poisson distribution allow correlated observations considered . addition goals, data set provides basic meta-information matches (ID, team name abbreviations, type match, group vs. knockout stage) well covariates revisit later document. data looks like : now, focus goals variable . brief summary yields showing teams scored 00 66 goals per match average y‾=1.297\\bar y = 1.297 observations yiy_i (=1,…,128i = 1, \\dots, 128). corresponding table observed relative frequencies : (Note recent versions R using proportions() rather prop.table() recommended.) confirms goals relatively rare events soccer game team scoring zero two goals per match almost 90 percent matches. show observed frequency distribution can approximated well Poisson distribution can subsequently used obtain predicted probabilities goals scored match.","code":"data(\"FIFA2018\", package = \"distributions3\") head(FIFA2018) ## goals team match type stage logability difference ## 1 5 RUS 1 A group 0.1530732 0.8638406 ## 2 0 KSA 1 A group -0.7107673 -0.8638406 ## 3 0 EGY 2 A group -0.2066409 -0.4438080 ## 4 1 URU 2 A group 0.2371671 0.4438080 ## 5 3 RUS 3 A group 0.1530732 0.3597142 ## 6 1 EGY 3 A group -0.2066409 -0.3597142 summary(FIFA2018$goals) ## Min. 1st Qu. Median Mean 3rd Qu. Max. ## 0.000 0.000 1.000 1.297 2.000 6.000 observed <- prop.table(table(FIFA2018$goals)) observed ## ## 0 1 2 3 4 5 6 ## 0.2578125 0.3750000 0.2500000 0.0781250 0.0156250 0.0156250 0.0078125"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"basic-fitted-distribution","dir":"Articles","previous_headings":"","what":"Basic fitted distribution","title":"The Poisson distribution: From basic probability theory to regression models","text":"first step, simply assume goals scored constant mean teams matches hence just fit single Poisson distribution number goals. , obtain point estimate Poisson parameter using empirical mean λ̂=y‾=1.297\\hat \\lambda = \\bar y = 1.297 set corresponding distribution object: technical details show actually corresponds maximum likelihood estimation distribution. already illustrated , expected probabilities observing counts 0,1,…,60, 1, \\dots, 6 goals Poisson distribution can extracted using pdf() method. comparison observed empirical frequencies yields large, observed expected frequencies rather close. However, reasonable teams score goals probabilities, imply winning losing just attributed “luck” “random variation” alone. Therefore, certain level randomness certainly remain, also consider stronger weaker teams tournament.","code":"p_const <- Poisson(lambda = mean(FIFA2018$goals)) p_const ## [1] \"Poisson(lambda = 1.297)\" expected <- pdf(p_const, 0:6) cbind(observed, expected) ## observed expected ## 0 0.2578125 0.273384787 ## 1 0.3750000 0.354545896 ## 2 0.2500000 0.229900854 ## 3 0.0781250 0.099384223 ## 4 0.0156250 0.032222229 ## 5 0.0156250 0.008357641 ## 6 0.0078125 0.001806469"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"poisson-regression-and-probabilistic-forecasting","dir":"Articles","previous_headings":"","what":"Poisson regression and probabilistic forecasting","title":"The Poisson distribution: From basic probability theory to regression models","text":"account different expected performances teams 2018 FIFA World Cup, FIFA2018 data provides estimated logability team. estimated Zeileis, Leitner, Hornik (2018) prior start tournament (2018-05-20) based quoted odds 26 online bookmakers using bookmaker consensus model Leitner, Zeileis, Hornik (2010). difference logability team opponent useful predictor number goals scored. Consequently, fit generalized linear model (GLM) data links expected number goals per team/match λi\\lambda_i linear predictor xi⊤βx_i^\\top \\beta regressor vector xi⊤=(1,𝚍𝚒𝚏𝚏𝚎𝚛𝚎𝚗𝚌𝚎i)x_i^\\top = (1, \\mathtt{difference}_i) corresponding coefficient vector β\\beta using log-link: log(λi)=xi⊤β\\log(\\lambda_i) = x_i^\\top \\beta. maximum likelihood estimator β̂\\hat \\beta corresponding inference, predictions, residuals, etc. can obtained using glm() function base R family = poisson: parameters can interpreted. First, intercept corresponds expected log-goals per team match two equally strong teams, .e., zero difference log-abilities. corresponding prediction number goals can either obtained manually extracted coef() applying exp() (inverse log-link). equivalently predict() function can used type = \"response\" order get expected λ̂\\hat \\lambda_i (rather just linear predictor xi⊤β̂x_i^\\top \\hat \\beta predicted default). , can also set Poisson() distribution object obtain associated expected probability distribution zero six goals mathc two equally strong teams: Second, slope 0.4130.413 can interpreted ability elasticity number goals scored. difference log-abilities can also understood log ability ratio. Thus, ability ratio increases 11 percent, expected number goals increases approximately 0.4130.413 percent. yields different predicted Poisson distribution team/match tournament. can set vector 128128Poisson() distribution objects extracting vector fitted point estimates (λ̂1,…,λ̂128)⊤(\\hat \\lambda_1, \\dots, \\hat \\lambda_{128})^\\top: Note specific elements vector p_reg Poisson distributions can extracted usual, e.g., index like p_reg[] using head() tail() functions etc. illustration, following goal distributions expected FIFA World Cup final (last two rows data) France won 4-2 Croatia: shows France expected score goals Croatia teams scored goals expected, albeit unlikely many.","code":"m <- glm(goals ~ difference, data = FIFA2018, family = poisson) summary(m) ## ## Call: ## glm(formula = goals ~ difference, family = poisson, data = FIFA2018) ## ## Coefficients: ## Estimate Std. Error z value Pr(>|z|) ## (Intercept) 0.21272 0.08125 2.618 0.00885 ** ## difference 0.41344 0.10579 3.908 9.31e-05 *** ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 ## ## (Dispersion parameter for poisson family taken to be 1) ## ## Null deviance: 144.20 on 127 degrees of freedom ## Residual deviance: 128.69 on 126 degrees of freedom ## AIC: 359.39 ## ## Number of Fisher Scoring iterations: 5 lambda_zero <- exp(coef(m)[1]) lambda_zero ## (Intercept) ## 1.23704 predict(m, newdata = data.frame(difference = 0), type = \"response\") ## 1 ## 1.23704 p_zero <- Poisson(lambda = lambda_zero) pdf(p_zero, 0:6) ## [1] 0.290242139 0.359041061 0.222074031 0.091571467 0.028319386 0.007006441 ## [7] 0.001444541 p_reg <- Poisson(lambda = fitted(m)) length(p_reg) ## [1] 128 head(p_reg) ## 1 2 ## \"Poisson(lambda = 1.7680)\" \"Poisson(lambda = 0.8655)\" ## 3 4 ## \"Poisson(lambda = 1.0297)\" \"Poisson(lambda = 1.4862)\" ## 5 6 ## \"Poisson(lambda = 1.4354)\" \"Poisson(lambda = 1.0661)\" tail(FIFA2018, 2) ## goals team match type stage logability difference ## 127 4 FRA 64 Final knockout 0.8865638 0.6289619 ## 128 2 CRO 64 Final knockout 0.2576019 -0.6289619 p_final <- tail(p_reg, 2) p_final ## 127 128 ## \"Poisson(lambda = 1.6044)\" \"Poisson(lambda = 0.9538)\" pdf(p_final, 0:6) ## d_0 d_1 d_2 d_3 d_4 d_5 ## 127 0.2010078 0.3224993 0.2587107 0.13835949 0.05549639 0.017807808 ## 128 0.3852791 0.3674743 0.1752462 0.05571586 0.01328527 0.002534265 ## d_6 ## 127 0.0047618419 ## 128 0.0004028582"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"further-details-and-extensions","dir":"Articles","previous_headings":"","what":"Further details and extensions","title":"The Poisson distribution: From basic probability theory to regression models","text":"Assuming independence number goals scored, can obtain table possible match results (normal time) multiplying marginal probabilities (six goals). R done using outer() function default performs multiplication arguments. example, can see table expected probability France winning Croatia 1-0 12.4312.43 percent probability France loses 0-1 7.397.39 percent. advantage France can also brought clearly aggregating probabilities winning (lower triangular matrix), draw (diagonal), losing (upper triangular matrix). R can computed : Note probabilities sum 11 considered six goals per team goals can actually occur small probability. Next, update expected frequencies table averaging across expectations per team/match regression model. , observed expected frequencies reasonably close, emphasizing model good marginal fit data. bring discrepancies graphically show frequencies square root scale using -called hanging rootogram (Kleiber Zeileis 2016). gray bars represent square-root observed frequencies “hanging” square-root expected frequencies red line. offset around x-axis thus shows difference two frequencies reasonably close zero. Finally, want point log-abilities (thus differences) obtained based bookmakers odds prior tournament, calibration intercept slope coefficients done “-sample”. means used data tournament estimating GLM evaluation can made ex post. Alternatively, one used previous FIFA World Cups calibrating coefficients probabilistic forecasts outcome matches (thus entire tournament) obtained ex ante. approach used Groll et al. (2019) Groll et al. (2021) additionally added explanatory variables used flexible machine learning regression techniques rather simple Poisson GLM.","code":"res <- outer(pdf(p_final[1], 0:6), pdf(p_final[2], 0:6)) round(100 * res, digits = 2) ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] ## [1,] 7.74 7.39 3.52 1.12 0.27 0.05 0.01 ## [2,] 12.43 11.85 5.65 1.80 0.43 0.08 0.01 ## [3,] 9.97 9.51 4.53 1.44 0.34 0.07 0.01 ## [4,] 5.33 5.08 2.42 0.77 0.18 0.04 0.01 ## [5,] 2.14 2.04 0.97 0.31 0.07 0.01 0.00 ## [6,] 0.69 0.65 0.31 0.10 0.02 0.00 0.00 ## [7,] 0.18 0.17 0.08 0.03 0.01 0.00 0.00 sum(res[lower.tri(res)]) ## France wins ## [1] 0.5245018 sum(diag(res)) ## draw ## [1] 0.2497855 sum(res[upper.tri(res)]) ## France loses ## [1] 0.2242939 expected <- pdf(p_reg, 0:6) head(expected) ## d_0 d_1 d_2 d_3 d_4 d_5 d_6 ## 1 0.1706693 0.3017480 0.2667494 0.15720674 0.069486450 0.024570788 0.0072403041 ## 2 0.4208316 0.3642392 0.1576286 0.04547703 0.009840349 0.001703409 0.0002457231 ## 3 0.3571261 0.3677207 0.1893148 0.06497703 0.016726166 0.003444474 0.0005911098 ## 4 0.2262357 0.3362265 0.2498462 0.12377196 0.045986787 0.013668909 0.0033857384 ## 5 0.2380213 0.3416546 0.2452047 0.11732187 0.042100811 0.012086260 0.0028914265 ## 6 0.3443506 0.3671104 0.1956873 0.06954039 0.018534163 0.003951835 0.0007021718 expected <- colMeans(expected) cbind(observed, expected) ## observed expected ## 0 0.2578125 0.294374450 ## 1 0.3750000 0.340171469 ## 2 0.2500000 0.214456075 ## 3 0.0781250 0.098236077 ## 4 0.0156250 0.036594546 ## 5 0.0156250 0.011726654 ## 6 0.0078125 0.003332718 bp <- barplot(sqrt(observed), offset = sqrt(expected) - sqrt(observed), xlab = \"Goals\", ylab = \"sqrt(Frequency)\") lines(bp, sqrt(expected), type = \"o\", pch = 19, lwd = 2, col = 2) abline(h = 0, lty = 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/poisson.html","id":"technical-details-maximum-likelihood-estimation-of-lambda","dir":"Articles","previous_headings":"","what":"Technical details: Maximum likelihood estimation of λ\\lambda","title":"The Poisson distribution: From basic probability theory to regression models","text":"Fitting single Poisson distribution constant λ\\lambda nn independent observations y1,…,yny_1, \\dots, y_n using maximum likelihood estimation can done analytically using basic algebra. First, set log-likelihood function ℓ\\ell sum log-densities per observation: ℓ(λ;y1,…,yn)=∑=1nlogf(yi;λ) \\begin{align*} \\ell(\\lambda; y_1, \\dots, y_n) & = \\sum_{= 1}^n \\log f(y_i; \\lambda) \\\\ \\end{align*} solving first-order condition analytically need score function, .e., derivative log-likelihood respect parameter λ\\lambda. derivative sum simply sum derivatives: ℓ′(λ;y1,…,yn)=∑=1n{logf(yi;λ)}′=∑=1n{−λ+yi⋅log(λ)−log(yi!)}′=∑=1n{−1+yi⋅1λ}=−n+1λ∑=1nyi \\begin{align*} \\ell^\\prime(\\lambda; y_1, \\dots, y_n) & = \\sum_{= 1}^n \\left\\{ \\log f(y_i; \\lambda) \\right\\}^\\prime \\\\ & = \\sum_{= 1}^n \\left\\{ -\\lambda + y_i \\cdot \\log(\\lambda) - \\log(y_i!) \\right\\}^\\prime \\\\ & = \\sum_{= 1}^n \\left\\{ -1 + y_i \\cdot \\frac{1}{\\lambda} \\right\\} \\\\ & = -n + \\frac{1}{\\lambda} \\sum_{= 1}^n y_i \\end{align*} first-order condition maximizing log-likelihood sets derivative zero. can solved follows: ℓ′(λ;y1,…,yn)=0−n+1λ∑=1nyi=0n⋅λ=∑=1nyiλ=1n∑=1nyi=y‾ \\begin{align*} \\ell^\\prime(\\lambda; y_1, \\dots, y_n) & = 0 \\\\ -n + \\frac{1}{\\lambda} \\sum_{= 1}^n y_i & = 0 \\\\ n \\cdot \\lambda & = \\sum_{= 1}^n y_i \\\\ \\lambda & = \\frac{1}{n} \\sum_{= 1}^n y_i = \\bar y \\end{align*} Thus, maximum likelihood estimator simply empirical mean λ̂=y‾.\\hat \\lambda = \\bar y. Unfortunately, parameter λ\\lambda constant depends linear predictor log link log(λi)=xi⊤β\\log(\\lambda_i) = x_i^\\top \\beta, corresponding log-likelihood regression coefficients β\\beta can maximized easily. closed-form solution maximum likelihood estimator β̂\\hat \\beta glm() function employs iterative numerical algorithm (-called iteratively weighted least squares) fitting model.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"problem-setup","dir":"Articles","previous_headings":"","what":"Problem setup","title":"Two sample Z-tests","text":"Let’s suppose student wants figure biology professors English professors know memes. student writes meme quiz springs 14 unsuspecting biology professors 18 unsuspecting English professors office hours. biology professors get following scores: 3,7,11,0,7,0,4,5,6,2,4,7,2,9 3, 7, 11, 0, 7, 0, 4, 5, 6, 2, 4, 7, 2, 9 English professors score: 5,5,4,5,4,5,7,2,6,2,2,7,2,6,4,2,5,2 5, 5, 4, 5, 4, 5, 7, 2, 6, 2, 2, 7, 2, 6, 4, 2, 5, 2 ’ll assume population variance biology professor scores σ12=3\\sigma^2_1 = 3 population variance English professor scores σ22=2\\sigma^2_2 = 2.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"assumption-checking","dir":"Articles","previous_headings":"","what":"Assumption checking","title":"Two sample Z-tests","text":"can Z-test, need make check can reasonably treat means sample normally distributed. happens case either following hold: data comes normal distribution. lots data. much? Many textbooks use 30 data points rule thumb. Since samples less 30 data points, need check plausibly normal distributions. check biology professor scores first using normal quantile-quantile plot. Since biology scores lies close line y=xy = x, notable systematic deviations line, ’s safe treat sample coming normal distribution. Honestly quantile-quantile plot good ’s suspicious. Anyway, next check English scores seems fine well. can also create side--side boxplots data using ggplot2 package get nice comparison two groups. requires little bit data manipulation: Based eye-balling data, ’d pretty surprised rejected null hypothesis equal means two groups.","code":"biology <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2, 4, 7, 2, 9) english <- c(8, 5, 4, 10, 4, 5, 7, 2, 6, 1, 2, 7, 0, 6, 4, 12, 5, 2) qqnorm(biology) qqline(biology) qqnorm(english) qqline(english) library(ggplot2) # make a data frame in long format for plotting test_results <- data.frame( score = c(biology, english), department = c( rep(\"biology\", length(biology)), rep(\"english\", length(english)) ) ) ggplot(test_results, aes(x = department, y = score, color = department)) + geom_boxplot() + geom_jitter() + scale_color_brewer(type = \"qual\", palette = 2) + theme_minimal() + theme(legend.position = \"none\")"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"null-hypothesis-and-test-statistic","dir":"Articles","previous_headings":"","what":"Null hypothesis and test statistic","title":"Two sample Z-tests","text":"Let’s write null hypothesis (treat biology professors group 1 English professors group 2): H0:μ1−μ2=0HA:μ1−μ2≠0 H_0: \\mu_1 - \\mu_2 = 0 \\qquad H_A: \\mu_1 - \\mu_2 \\neq 0 First need calculate Z-statistic. Let’s use R. Remember Z-statistic defined Z=x‾1−x‾2−δ0σ12/n1+σ22/n2∼Normal(0,1) Z = \\frac{\\bar x_1 - \\bar x_2 - \\delta_0} {\\sqrt{\\sigma_1^2 / n_1 + \\sigma_2^2 / n_2}} \\sim \\mathrm{Normal}(0, 1) R looks like:","code":"delta_0 <- 0 # by assumption sigma_sq_1 <- 3 sigma_sq_2 <- 2 n_1 <- length(biology) n_2 <- length(english) # calculate the z-statistic z_stat <- (mean(biology) - mean(english) - delta_0) / sqrt(sigma_sq_1 / n_1 + sigma_sq_2 / n_2) z_stat #> [1] -0.3756527"},{"path":"https://alexpghayes.github.io/distributions3/dev/articles/two-sample-z-test.html","id":"calculating-p-values","dir":"Articles","previous_headings":"","what":"Calculating p-values","title":"Two sample Z-tests","text":"calculate two-sided p-value, need find P(|Z|≥|−0.376|)=P(Z≥0.376)+P(Z≤−0.376)=1−P(Z≤0.376)+P(Z≤−0.376)=1−Φ(0.376)+Φ(0.376) \\begin{align} P(|Z| \\ge |-0.376|) &= P(Z \\ge 0.376) + P(Z \\le -0.376) \\\\ &= 1 - P(Z \\le 0.376) + P(Z \\le -0.376) \\\\ &= 1 - \\Phi(0.376) + \\Phi(0.376) \\end{align} need c.d.f. standard normal Note saved z_stat also done slightly accurate since rounding error. p-value 0.71. verify Z-table. Note get value cdf(Z, -0.376) looking -0.376 Z-table. may also seen different formula p-value two-sided Z-test, makes use fact normal distribution symmetric: P(|Z|≥|−0.376|)=2⋅P(Z≤−|−0.376|)=2⋅Φ(−0.376) \\begin{align} P(|Z| \\ge |-0.376|) &= 2 \\cdot P(Z \\le -|-0.376|) &= 2 \\cdot \\Phi(-0.376) \\end{align} Using formula get result: Finally, sometimes interest one sided Z-tests. test H0:μ≤3HA:μ>3 \\begin{align} H_0: \\mu \\le 3 \\qquad H_A: \\mu > 3 \\end{align} p-value given P(Z>−0.376) P(Z > -0.376) calculate test H0:μ≥3HA:μ<3 H_0: \\mu \\ge 3 \\qquad H_A: \\mu < 3 p-value given P(Z<−0.376) P(Z < -0.376) calculate ","code":"library(distributions3) Z <- Normal(0, 1) # make a standard normal r.v. 1 - cdf(Z, 0.376) + cdf(Z, -0.376) #> [1] 0.7069169 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.7071751 2 * cdf(Z, -0.376) #> [1] 0.7069169 1 - cdf(Z, -0.376) #> [1] 0.6465416 cdf(Z, -0.376) #> [1] 0.3534584"},{"path":"https://alexpghayes.github.io/distributions3/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Alex Hayes. Author, maintainer. Ralph Moller-Trane. Author. Emil Hvitfeldt. Contributor. Daniel Jordan. Author. Paul Northrop. Author. Moritz N. Lang. Author. Achim Zeileis. Author. Bruna Wundervald. Contributor. Alessandro Gasparini. Contributor.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Hayes , Moller-Trane R, Jordan D, Northrop P, Lang M, Zeileis (2024). distributions3: Probability Distributions S3 Objects. R package version 0.2.1.9000, https://alexpghayes.github.io/distributions3/, https://github.com/alexpghayes/distributions3.","code":"@Manual{, title = {distributions3: Probability Distributions as S3 Objects}, author = {Alex Hayes and Ralph Moller-Trane and Daniel Jordan and Paul Northrop and Moritz N. Lang and Achim Zeileis}, year = {2024}, note = {R package version 0.2.1.9000, https://alexpghayes.github.io/distributions3/}, url = {https://github.com/alexpghayes/distributions3}, }"},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"distributions3","dir":"","previous_headings":"","what":"Probability Distributions as S3 Objects","title":"Probability Distributions as S3 Objects","text":"distributions3, inspired eponynmous Julia package, provides generic function interface probability distributions. distributions3 two goals: Replace rnorm(), pnorm(), etc, family functions S3 methods distribution objects extremely well documented friendly students intro stat classes. main generics : random(): Draw samples distribution. pdf(): Evaluate probability density (mass) point. cdf(): Evaluate cumulative probability point. quantile(): Determine quantile given probability. Inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Probability Distributions as S3 Objects","text":"can install distributions3 : can install development version :","code":"install.packages(\"distributions3\") install.packages(\"devtools\") devtools::install_github(\"alexpghayes/distributions3\")"},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"basic-usage","dir":"","previous_headings":"","what":"Basic Usage","title":"Probability Distributions as S3 Objects","text":"basic usage distributions3 looks like: Note quantile() always returns lower tail probabilities. aren’t sure means, please read last several paragraphs vignette(\"one-sample-z-confidence-interval\") gander plot.","code":"library(\"distributions3\") X <- Bernoulli(0.1) random(X, 10) #> [1] 0 0 0 0 0 0 1 1 0 0 pdf(X, 1) #> [1] 0.1 cdf(X, 0) #> [1] 0.9 quantile(X, 0.5) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Probability Distributions as S3 Objects","text":"interested contributing distributions3, please reach Github! happy review PRs contributing bug fixes. Please note distributions3 released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/index.html","id":"related-work","dir":"","previous_headings":"","what":"Related work","title":"Probability Distributions as S3 Objects","text":"comprehensive overview many packages providing various distribution related functionality see CRAN Task View. distributional provides distribution objects vectorized S3 objects distr6 builds distr, uses R6 objects distr quite similar distributions, uses S4 objects less focused documentation. fitdistrplus provides extensive functionality fitting various distributions treat distributions objects","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Bernoulli distribution — Bernoulli","title":"Create a Bernoulli distribution — Bernoulli","text":"Bernoulli distributions used represent events like coin flips single trial either successful unsuccessful. Bernoulli distribution special case Binomial() distribution n = 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Bernoulli distribution — Bernoulli","text":"","code":"Bernoulli(p = 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Bernoulli distribution — Bernoulli","text":"p success probability distribution. p can value [0, 1], defaults 0.5.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Bernoulli distribution — Bernoulli","text":"Bernoulli object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Bernoulli distribution — Bernoulli","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Bernoulli random variable parameter p = \\(p\\). textbooks also define \\(q = 1 - p\\), use \\(\\pi\\) instead \\(p\\). Bernoulli probability distribution widely used model binary variables, 'failure' 'success'. typical example flip coin, \\(p\\) thought probability flipping head, \\(q = 1 - p\\) probability flipping tail. Support: \\(\\{0, 1\\}\\) Mean: \\(p\\) Variance: \\(p \\cdot (1 - p) = p \\cdot q\\) Probability mass function (p.m.f): $$ P(X = x) = p^x (1 - p)^{1-x} = p^x q^{1-x} $$ Cumulative distribution function (c.d.f): $$ P(X \\le x) = \\left \\{ \\begin{array}{ll} 0 & x < 0 \\\\ 1 - p & 0 \\leq x < 1 \\\\ 1 & x \\geq 1 \\end{array} \\right. $$ Moment generating function (m.g.f): $$ E(e^{tX}) = (1 - p) + p e^t $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Bernoulli distribution — Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Beta distribution — Beta","title":"Create a Beta distribution — Beta","text":"Create Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Beta distribution — Beta","text":"","code":"Beta(alpha = 1, beta = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Beta distribution — Beta","text":"alpha alpha parameter. alpha can value strictly greater zero. Defaults 1. beta beta parameter. beta can value strictly greater zero. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Beta distribution — Beta","text":"beta object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Beta distribution — Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Binomial distribution — Binomial","title":"Create a Binomial distribution — Binomial","text":"Binomial distributions used represent situations can can thought result \\(n\\) Bernoulli experiments (\\(n\\) defined size experiment). classical example \\(n\\) independent coin flips, coin flip probability p success. case, individual probability flipping heads tails given Bernoulli(p) distribution, probability \\(x\\) equal results (\\(x\\) heads, example), \\(n\\) trials given Binomial(n, p) distribution. equation Binomial distribution directly derived equation Bernoulli distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Binomial distribution — Binomial","text":"","code":"Binomial(size, p = 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Binomial distribution — Binomial","text":"size number trials. Must integer greater equal one. size = 1L, Binomial distribution reduces bernoulli distribution. Often called n textbooks. p success probability given trial. p can value [0, 1], defaults 0.5.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Binomial distribution — Binomial","text":"Binomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Binomial distribution — Binomial","text":"Binomial distribution comes interested portion people thing. Binomial distribution also comes sign test, sometimes called Binomial test (see stats::binom.test()), may need Binomial C.D.F. compute p-values. recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Binomial random variable parameter size = \\(n\\) p = \\(p\\). textbooks define \\(q = 1 - p\\), called \\(\\pi\\) instead \\(p\\). Support: \\(\\{0, 1, 2, ..., n\\}\\) Mean: \\(np\\) Variance: \\(np \\cdot (1 - p) = np \\cdot q\\) Probability mass function (p.m.f): $$ P(X = k) = {n \\choose k} p^k (1 - p)^{n-k} $$ Cumulative distribution function (c.d.f): $$ P(X \\le k) = \\sum_{=0}^{\\lfloor k \\rfloor} {n \\choose } p^(1 - p)^{n-} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = (1 - p + p e^t)^n $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Binomial distribution — Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Categorical distribution — Categorical","title":"Create a Categorical distribution — Categorical","text":"Create Categorical distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Categorical distribution — Categorical","text":"","code":"Categorical(outcomes, p = NULL)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Categorical distribution — Categorical","text":"outcomes vector specifying elements sample space. Can numeric, factor, character, logical. p vector success probabilities outcome. element p can positive value – vector gets normalized internally. Defaults NULL, case distribution assumed uniform.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Categorical distribution — Categorical","text":"Categorical object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Categorical distribution — Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Cauchy distribution — Cauchy","title":"Create a Cauchy distribution — Cauchy","text":"Note Cauchy distribution student's t distribution one degree freedom. Cauchy distribution well defined mean variance. Cauchy distributions often appear priors Bayesian contexts due heavy tails.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Cauchy distribution — Cauchy","text":"","code":"Cauchy(location = 0, scale = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Cauchy distribution — Cauchy","text":"location location parameter. Can real number. Defaults 0. scale scale parameter. Must greater zero (?). Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Cauchy distribution — Cauchy","text":"Cauchy object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Cauchy distribution — Cauchy","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Cauchy variable mean location = \\(x_0\\) scale = \\(\\gamma\\). Support: \\(R\\), set real numbers Mean: Undefined. Variance: Undefined. Probability density function (p.d.f): $$ f(x) = \\frac{1}{\\pi \\gamma \\left[1 + \\left(\\frac{x - x_0}{\\gamma} \\right)^2 \\right]} $$ Cumulative distribution function (c.d.f): $$ F(t) = \\frac{1}{\\pi} \\arctan \\left( \\frac{t - x_0}{\\gamma} \\right) + \\frac{1}{2} $$ Moment generating function (m.g.f): exist.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Cauchy distribution — Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Chi-Square distribution — ChiSquare","title":"Create a Chi-Square distribution — ChiSquare","text":"Chi-square distributions show often frequentist settings sampling distribution test statistics, especially maximum likelihood estimation settings.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Chi-Square distribution — ChiSquare","text":"","code":"ChiSquare(df)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Chi-Square distribution — ChiSquare","text":"df Degrees freedom. Must positive.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Chi-Square distribution — ChiSquare","text":"ChiSquare object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Chi-Square distribution — ChiSquare","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) \\(\\chi^2\\) random variable df = \\(k\\). Support: \\(R^+\\), set positive real numbers Mean: \\(k\\) Variance: \\(2k\\) Probability density function (p.d.f): $$ f(x) = \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} $$ Cumulative distribution function (c.d.f): cumulative distribution function form $$ F(t) = \\int_{-\\infty}^t \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} dx $$ integral closed form solution must approximated numerically. c.d.f. standard normal sometimes called \"error function\". notation \\(\\Phi(t)\\) also stands c.d.f. standard normal evaluated \\(t\\). Z-tables list value \\(\\Phi(t)\\) various \\(t\\). Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\mu t + \\sigma^2 t^2 / 2} $$","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"transformations","dir":"Reference","previous_headings":"","what":"Transformations","title":"Create a Chi-Square distribution — ChiSquare","text":"squared standard Normal() distribution equivalent \\(\\chi^2_1\\) distribution one degree freedom. \\(\\chi^2\\) distribution special case Gamma() distribution shape (TODO: check ) parameter equal half. Sums \\(\\chi^2\\) distributions also distributed \\(\\chi^2\\) distributions, degrees freedom contributing distributions get summed. ratio two \\(\\chi^2\\) distributions FisherF() distribution. ratio Normal() square root scaled ChiSquare() StudentsT() distribution.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Chi-Square distribution — ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an Erlang distribution — Erlang","title":"Create an Erlang distribution — Erlang","text":"Erlang distribution two-parameter family continuous probability distributions support \\(x \\[0,\\infty)\\). two parameters positive integer shape parameter \\(k\\) positive real rate parameter \\(\\lambda\\). Erlang distribution shape parameter \\(k = 1\\) simplifies exponential distribution, special case gamma distribution. corresponds sum \\(k\\) independent exponential variables mean \\(1 / \\lambda\\) .","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an Erlang distribution — Erlang","text":"","code":"Erlang(k, lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an Erlang distribution — Erlang","text":"k shape parameter. Can positive integer number. lambda rate parameter. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an Erlang distribution — Erlang","text":"Erlang object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an Erlang distribution — Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an Exponential distribution — Exponential","title":"Create an Exponential distribution — Exponential","text":"Exponential distributions frequently used modeling amount time passes specific event occurs. example, exponential distributions used model time two earthquakes, amount delay internet packets, amount time piece machinery can run needing repair.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an Exponential distribution — Exponential","text":"","code":"Exponential(rate = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an Exponential distribution — Exponential","text":"rate rate parameter, written \\(\\lambda\\) textbooks. Can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an Exponential distribution — Exponential","text":"Exponential object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an Exponential distribution — Exponential","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Exponential random variable rate parameter rate = \\(\\lambda\\). Support: \\(x \\(0, \\infty)\\) Mean: \\(\\frac{1}{\\lambda}\\) Variance: \\(\\frac{1}{\\lambda^2}\\) Probability density function (p.d.f): $$ f(x) = \\lambda e^{-\\lambda x} $$ Cumulative distribution function (c.d.f): $$ F(x) = 1 - e^{-\\lambda x} $$ Moment generating function (m.g.f): $$ \\frac{\\lambda}{\\lambda - t}, t < \\lambda $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an Exponential distribution — Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":null,"dir":"Reference","previous_headings":"","what":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"Data 64 matches 2018 FIFA World Cup along predicted ability differences based bookmakers odds.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"","code":"data(\"FIFA2018\", package = \"distributions3\")"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"data frame 128 rows 7 columns. goals integer. Number goals scored normal time (90 minutes), \\ .e., excluding potential extra time penalties knockout matches. team character. 3-letter FIFA code team. match integer. Match ID ranging 1 (opening match) 64 (final). type factor. Type match groups H, round 16 (R16), quarter final, semi-final, match 3rd place, final. stage factor. Group vs. knockout tournament stage. logability numeric. Estimated log-ability team based bookmaker consensus model. difference numeric. Difference estimated log-abilities team opponent match.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"goals match obtained Wikipedia (https://en.wikipedia.org/wiki/2018_FIFA_World_Cup) log-abilities Zeileis et al. (2018) based quoted odds Oddschecker.com Bwin.com.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"investigate number goals scored per match 2018 FIFA World Cup, FIFA2018 provides two rows, one team, matches tournament. addition basic meta-information matches (ID, team name abbreviations, type match, group vs. knockout stage), information estimated log-ability team provided. estimated Zeileis et al. (2018) prior start tournament (2018-05-20) based quoted odds 26 online bookmakers using bookmaker consensus model Leitner et al. (2010). difference log-ability team opponent useful predictor number goals scored. model data basic Poisson regression model provides good fit. treats number goals two teams independent given ability difference reasonable assumption data set.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"Leitner C, Zeileis , Hornik K (2010). Forecasting Sports Tournaments Ratings (Prob)abilities: Comparison EURO 2008. International Journal Forecasting, 26(3), 471-481. doi:10.1016/j.ijforecast.2009.10.001 Zeileis , Leitner C, Hornik K (2018). Probabilistic Forecasts 2018 FIFA World Cup Based Bookmaker Consensus Model. Working Paper 2018-09, Working Papers Economics Statistics, Research Platform Empirical Experimental Economics, University Innsbruck. https://EconPapers.RePEc.org/RePEc:inn:wpaper:2018-09","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FIFA2018.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Goals scored in all 2018 FIFA World Cup matches — FIFA2018","text":"","code":"## load data data(\"FIFA2018\", package = \"distributions3\") ## observed relative frequencies of goals in all matches obsrvd <- prop.table(table(FIFA2018$goals)) ## expected probabilities assuming a simple Poisson model, ## using the average number of goals across all teams/matches ## as the point estimate for the mean (lambda) of the distribution p_const <- Poisson(lambda = mean(FIFA2018$goals)) p_const #> [1] \"Poisson(lambda = 1.297)\" expctd <- pdf(p_const, 0:6) ## comparison: observed vs. expected frequencies ## frequencies for 3 and 4 goals are slightly overfitted ## while 5 and 6 goals are slightly underfitted cbind(\"observed\" = obsrvd, \"expected\" = expctd) #> observed expected #> 0 0.2578125 0.273384787 #> 1 0.3750000 0.354545896 #> 2 0.2500000 0.229900854 #> 3 0.0781250 0.099384223 #> 4 0.0156250 0.032222229 #> 5 0.0156250 0.008357641 #> 6 0.0078125 0.001806469 ## instead of fitting the same average Poisson model to all ## teams/matches, take ability differences into account m <- glm(goals ~ difference, data = FIFA2018, family = poisson) summary(m) #> #> Call: #> glm(formula = goals ~ difference, family = poisson, data = FIFA2018) #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) 0.21272 0.08125 2.618 0.00885 ** #> difference 0.41344 0.10579 3.908 9.31e-05 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for poisson family taken to be 1) #> #> Null deviance: 144.20 on 127 degrees of freedom #> Residual deviance: 128.69 on 126 degrees of freedom #> AIC: 359.39 #> #> Number of Fisher Scoring iterations: 5 #> ## when the ratio of abilities increases by 1 percent, the ## expected number of goals increases by around 0.4 percent ## this yields a different predicted Poisson distribution for ## each team/match p_reg <- Poisson(lambda = fitted(m)) head(p_reg) #> 1 2 #> \"Poisson(lambda = 1.7680)\" \"Poisson(lambda = 0.8655)\" #> 3 4 #> \"Poisson(lambda = 1.0297)\" \"Poisson(lambda = 1.4862)\" #> 5 6 #> \"Poisson(lambda = 1.4354)\" \"Poisson(lambda = 1.0661)\" ## as an illustration, the following goal distributions ## were expected for the final (that France won 4-2 against Croatia) p_final <- tail(p_reg, 2) p_final #> 127 128 #> \"Poisson(lambda = 1.6044)\" \"Poisson(lambda = 0.9538)\" pdf(p_final, 0:6) #> d_0 d_1 d_2 d_3 d_4 d_5 #> 127 0.2010078 0.3224993 0.2587107 0.13835949 0.05549639 0.017807808 #> 128 0.3852791 0.3674743 0.1752462 0.05571586 0.01328527 0.002534265 #> d_6 #> 127 0.0047618419 #> 128 0.0004028582 ## clearly France was expected to score more goals than Croatia ## but both teams scored more goals than expected, albeit not unlikely many ## assuming independence of the number of goals scored, obtain ## table of possible match results (after normal time), along with ## overall probabilities of win/draw/lose res <- outer(pdf(p_final[1], 0:6), pdf(p_final[2], 0:6)) sum(res[lower.tri(res)]) ## France wins #> [1] 0.5245018 sum(diag(res)) ## draw #> [1] 0.2497855 sum(res[upper.tri(res)]) ## France loses #> [1] 0.2242939 ## update expected frequencies table based on regression model expctd <- pdf(p_reg, 0:6) head(expctd) #> d_0 d_1 d_2 d_3 d_4 d_5 d_6 #> 1 0.1706693 0.3017480 0.2667494 0.15720674 0.069486450 0.024570788 0.0072403041 #> 2 0.4208316 0.3642392 0.1576286 0.04547703 0.009840349 0.001703409 0.0002457231 #> 3 0.3571261 0.3677207 0.1893148 0.06497703 0.016726166 0.003444474 0.0005911098 #> 4 0.2262357 0.3362265 0.2498462 0.12377196 0.045986787 0.013668909 0.0033857384 #> 5 0.2380213 0.3416546 0.2452047 0.11732187 0.042100811 0.012086260 0.0028914265 #> 6 0.3443506 0.3671104 0.1956873 0.06954039 0.018534163 0.003951835 0.0007021718 expctd <- colMeans(expctd) cbind(\"observed\" = obsrvd, \"expected\" = expctd) #> observed expected #> 0 0.2578125 0.294374450 #> 1 0.3750000 0.340171469 #> 2 0.2500000 0.214456075 #> 3 0.0781250 0.098236077 #> 4 0.0156250 0.036594546 #> 5 0.0156250 0.011726654 #> 6 0.0078125 0.003332718"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Create an F distribution — FisherF","title":"Create an F distribution — FisherF","text":"Create F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create an F distribution — FisherF","text":"","code":"FisherF(df1, df2, lambda = 0)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create an F distribution — FisherF","text":"df1 Numerator degrees freedom. Can positive number. df2 Denominator degrees freedom. Can positive number. lambda Non-centrality parameter. Can positive number. Defaults 0.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create an F distribution — FisherF","text":"FisherF object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create an F distribution — FisherF","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. TODO","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create an F distribution — FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Frechet distribution — Frechet","title":"Create a Frechet distribution — Frechet","text":"Frechet distribution special case \\link{GEV} distribution, obtained GEV shape parameter \\(\\xi\\) positive. may referred type II extreme value distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Frechet distribution — Frechet","text":"","code":"Frechet(location = 0, scale = 1, shape = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Frechet distribution — Frechet","text":"location location (minimum) parameter \\(m\\). location can real number. Defaults 0. scale scale parameter \\(s\\). scale can positive number. Defaults 1. shape shape parameter \\(\\alpha\\). shape can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Frechet distribution — Frechet","text":"Frechet object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Frechet distribution — Frechet","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Frechet random variable location parameter location = \\(m\\), scale parameter scale = \\(s\\), shape parameter shape = \\(\\alpha\\). Frechet(\\(m, s, \\alpha\\)) distribution equivalent \\link{GEV}(\\(m + s, s / \\alpha, 1 / \\alpha\\)) distribution. Support: \\((m, \\infty)\\). Mean: \\(m + s\\Gamma(1 - 1/\\alpha)\\), \\(\\alpha > 1\\); undefined otherwise. Median: \\(m + s(\\ln 2)^{-1/\\alpha}\\). Variance: \\(s^2 [\\Gamma(1 - 2 / \\alpha) - \\Gamma(1 - 1 / \\alpha)^2]\\) \\(\\alpha > 2\\); undefined otherwise. Probability density function (p.d.f): $$f(x) = \\alpha s ^ {-1} [(x - m) / s] ^ {-(1 + \\alpha)}% \\exp\\{-[(x - m) / s] ^ {-\\alpha} \\}$$ \\(x > m\\). p.d.f. 0 \\(x \\leq m\\). Cumulative distribution function (c.d.f): $$F(x) = \\exp\\{-[(x - m) / s] ^ {-\\alpha} \\}$$ \\(x > m\\). c.d.f. 0 \\(x \\leq m\\).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Frechet distribution — Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Generalised Extreme Value (GEV) distribution — GEV","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"GEV distribution arises Extremal Types Theorem, rather like Central Limit Theorem (see \\link{Normal}) relates maximum \\(n\\) ..d. random variables rather sum. , suitable linear rescaling, distribution maximum tends non-degenerate limit \\(n\\) tends infinity limit must GEV distribution. requirement variables independent can relaxed substantially. Therefore, GEV distribution often used model maximum large number random variables.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"","code":"GEV(mu = 0, sigma = 1, xi = 0)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"mu location parameter, written \\(\\mu\\) textbooks. mu can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks. sigma can positive number. Defaults 1. xi shape parameter, written \\(\\xi\\) textbooks. xi can real number. Defaults 0, corresponds Gumbel distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"GEV object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) GEV random variable location parameter mu = \\(\\mu\\), scale parameter sigma = \\(\\sigma\\) shape parameter xi = \\(\\xi\\). Support: \\((-\\infty, \\mu - \\sigma / \\xi)\\) \\(\\xi < 0\\); \\((\\mu - \\sigma / \\xi, \\infty)\\) \\(\\xi > 0\\); \\(R\\), set real numbers, \\(\\xi = 0\\). Mean: \\(\\mu + \\sigma[\\Gamma(1 - \\xi) - 1]/\\xi\\) \\(\\xi < 1, \\xi \\neq 0\\); \\(\\mu + \\sigma\\gamma\\) \\(\\xi = 0\\), \\(\\gamma\\) Euler's constant, approximately equal 0.57722; undefined otherwise. Median: \\(\\mu + \\sigma[(\\ln 2) ^ {-\\xi} - 1]/\\xi\\) \\(\\xi \\neq 0\\); \\(\\mu - \\sigma\\ln(\\ln 2)\\) \\(\\xi = 0\\). Variance: \\(\\sigma^2 [\\Gamma(1 - 2 \\xi) - \\Gamma(1 - \\xi)^2] / \\xi^2\\) \\(\\xi < 1 / 2, \\xi \\neq 0\\); \\(\\sigma^2 \\pi^2 / 6\\) \\(\\xi = 0\\); undefined otherwise. Probability density function (p.d.f): \\(\\xi \\neq 0\\) $$f(x) = \\sigma ^ {-1} [1 + \\xi (x - \\mu) / \\sigma] ^ {-(1 + 1/\\xi)}% \\exp\\{-[1 + \\xi (x - \\mu) / \\sigma] ^ {-1/\\xi} \\}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). p.d.f. 0 outside support. \\(\\xi = 0\\) (Gumbel) special case $$f(x) = \\sigma ^ {-1} \\exp[-(x - \\mu) / \\sigma]% \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers. Cumulative distribution function (c.d.f): \\(\\xi \\neq 0\\) $$F(x) = \\exp\\{-[1 + \\xi (x - \\mu) / \\sigma] ^ {-1/\\xi} \\}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). c.d.f. 0 support 1 support. \\(\\xi = 0\\) (Gumbel) special case $$F(x) = \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Generalised Extreme Value (GEV) distribution — GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Generalised Pareto (GP) distribution — GP","title":"Create a Generalised Pareto (GP) distribution — GP","text":"GP distribution link \\link{GEV} distribution. Suppose maximum \\(n\\) ..d. random variables approximately GEV distribution. sufficiently large threshold \\(u\\), conditional distribution amount (threshold excess) variable exceeds \\(u\\) given exceeds \\(u\\) approximately GP distribution. Therefore, GP distribution often used model threshold excesses high threshold \\(u\\). requirement variables independent can relaxed substantially, exceedances \\(u\\) may cluster.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Generalised Pareto (GP) distribution — GP","text":"","code":"GP(mu = 0, sigma = 1, xi = 0)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Generalised Pareto (GP) distribution — GP","text":"mu location parameter, written \\(\\mu\\) textbooks. mu can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks. sigma can positive number. Defaults 1. xi shape parameter, written \\(\\xi\\) textbooks. xi can real number. Defaults 0, corresponds Gumbel distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Generalised Pareto (GP) distribution — GP","text":"GP object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Generalised Pareto (GP) distribution — GP","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) GP random variable location parameter mu = \\(\\mu\\), scale parameter sigma = \\(\\sigma\\) shape parameter xi = \\(\\xi\\). Support: \\([\\mu, \\mu - \\sigma / \\xi]\\) \\(\\xi < 0\\); \\([\\mu, \\infty)\\) \\(\\xi \\geq 0\\). Mean: \\(\\mu + \\sigma/(1 - \\xi)\\) \\(\\xi < 1\\); undefined otherwise. Median: \\(\\mu + \\sigma[2 ^ \\xi - 1]/\\xi\\) \\(\\xi \\neq 0\\); \\(\\mu + \\sigma\\ln 2\\) \\(\\xi = 0\\). Variance: \\(\\sigma^2 / (1 - \\xi)^2 (1 - 2\\xi)\\) \\(\\xi < 1 / 2\\); undefined otherwise. Probability density function (p.d.f): \\(\\xi \\neq 0\\) $$f(x) = \\sigma^{-1} [1 + \\xi (x - \\mu) / \\sigma] ^ {-(1 + 1/\\xi)}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). p.d.f. 0 outside support. \\(\\xi = 0\\) special case $$f(x) = \\sigma ^ {-1} \\exp[-(x - \\mu) / \\sigma]$$ \\(x\\) [\\(\\mu, \\infty\\)). p.d.f. 0 outside support. Cumulative distribution function (c.d.f): \\(\\xi \\neq 0\\) $$F(x) = 1 - \\exp\\{-[1 + \\xi (x - \\mu) / \\sigma] ^ {-1/\\xi} \\}$$ \\(1 + \\xi (x - \\mu) / \\sigma > 0\\). c.d.f. 0 support 1 support. \\(\\xi = 0\\) special case $$F(x) = 1 - \\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Generalised Pareto (GP) distribution — GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Gamma distribution — Gamma","title":"Create a Gamma distribution — Gamma","text":"Several important distributions special cases Gamma distribution. shape parameter 1, Gamma exponential distribution parameter \\(1/\\beta\\). \\(shape = n/2\\) \\(rate = 1/2\\), Gamma equivalent chi squared distribution n degrees freedom. Moreover, \\(X_1\\) \\(Gamma(\\alpha_1, \\beta)\\) \\(X_2\\) \\(Gamma(\\alpha_2, \\beta)\\), function two variables form \\(\\frac{X_1}{X_1 + X_2}\\) \\(Beta(\\alpha_1, \\alpha_2)\\). last property frequently appears another distributions, extensively used multivariate methods. Gamma distribution added soon.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Gamma distribution — Gamma","text":"","code":"Gamma(shape, rate = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Gamma distribution — Gamma","text":"shape shape parameter. Can positive number. rate rate parameter. Can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Gamma distribution — Gamma","text":"Gamma object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Gamma distribution — Gamma","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Gamma random variable parameters shape = \\(\\alpha\\) rate = \\(\\beta\\). Support: \\(x \\(0, \\infty)\\) Mean: \\(\\frac{\\alpha}{\\beta}\\) Variance: \\(\\frac{\\alpha}{\\beta^2}\\) Probability density function (p.m.f): $$ f(x) = \\frac{\\beta^{\\alpha}}{\\Gamma(\\alpha)} x^{\\alpha - 1} e^{-\\beta x} $$ Cumulative distribution function (c.d.f): $$ f(x) = \\frac{\\Gamma(\\alpha, \\beta x)}{\\Gamma{\\alpha}} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = \\Big(\\frac{\\beta}{ \\beta - t}\\Big)^{\\alpha}, \\thinspace t < \\beta $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Gamma distribution — Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Geometric distribution — Geometric","title":"Create a Geometric distribution — Geometric","text":"Geometric distribution can thought generalization Bernoulli() distribution ask: \"keep flipping coin probability p heads, probability need \\(k\\) flips get first heads?\" Geometric distribution special case Negative Binomial distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Geometric distribution — Geometric","text":"","code":"Geometric(p = 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Geometric distribution — Geometric","text":"p success probability distribution. p can value [0, 1], defaults 0.5.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Geometric distribution — Geometric","text":"Geometric object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Geometric distribution — Geometric","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Geometric random variable success probability p = \\(p\\). Note multiple parameterizations Geometric distribution. Support: 0 < p < 1, \\(x = 0, 1, \\dots\\) Mean: \\(\\frac{1-p}{p}\\) Variance: \\(\\frac{1-p}{p^2}\\) Probability mass function (p.m.f): $$ P(X = x) = p(1-p)^x, $$ Cumulative distribution function (c.d.f): $$ P(X \\le x) = 1 - (1-p)^{x+1} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = \\frac{pe^t}{1 - (1-p)e^t} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Geometric distribution — Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Gumbel distribution — Gumbel","title":"Create a Gumbel distribution — Gumbel","text":"Gumbel distribution special case \\link{GEV} distribution, obtained GEV shape parameter \\(\\xi\\) equal 0. may referred type extreme value distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Gumbel distribution — Gumbel","text":"","code":"Gumbel(mu = 0, sigma = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Gumbel distribution — Gumbel","text":"mu location parameter, written \\(\\mu\\) textbooks. mu can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks. sigma can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Gumbel distribution — Gumbel","text":"Gumbel object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Gumbel distribution — Gumbel","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Gumbel random variable location parameter mu = \\(\\mu\\), scale parameter sigma = \\(\\sigma\\). Support: \\(R\\), set real numbers. Mean: \\(\\mu + \\sigma\\gamma\\), \\(\\gamma\\) Euler's constant, approximately equal 0.57722. Median: \\(\\mu - \\sigma\\ln(\\ln 2)\\). Variance: \\(\\sigma^2 \\pi^2 / 6\\). Probability density function (p.d.f): $$f(x) = \\sigma ^ {-1} \\exp[-(x - \\mu) / \\sigma]% \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers. Cumulative distribution function (c.d.f): \\(\\xi = 0\\) (Gumbel) special case $$F(x) = \\exp\\{-\\exp[-(x - \\mu) / \\sigma] \\}$$ \\(x\\) \\(R\\), set real numbers.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Gumbel distribution — Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"Hurdle negative binomial distributions frequently used model counts overdispersion many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"","code":"HurdleNegativeBinomial(mu, theta, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"mu Location parameter negative binomial component distribution. Can positive number. theta Overdispersion parameter negative binomial component distribution. Can positive number. pi Zero-hurdle probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"HurdleNegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) hurdle negative binomial random variable parameters mu = \\(\\mu\\) theta = \\(\\theta\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: $$ \\mu \\cdot \\frac{\\pi}{1 - F(0; \\mu, \\theta)} $$ \\(F(k; \\mu)\\) c.d.f. NegativeBinomial distribution. Variance: $$ m \\cdot \\left(1 + \\frac{\\mu}{\\theta} + \\mu - m \\right) $$ \\(m\\) mean . Probability mass function (p.m.f.): \\(P(X = 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X = k) = \\pi \\cdot \\frac{f(k; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ \\(f(k; \\mu, \\theta)\\) p.m.f. NegativeBinomial distribution. Cumulative distribution function (c.d.f.): \\(P(X \\le 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X \\le k) = 1 - \\pi + \\pi \\cdot \\frac{F(k; \\mu, \\theta) - F(0; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a hurdle negative binomial distribution — HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a hurdle Poisson distribution — HurdlePoisson","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"Hurdle Poisson distributions frequently used model counts many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"","code":"HurdlePoisson(lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"lambda Parameter Poisson component distribution. Can positive number. pi Zero-hurdle probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"HurdlePoisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) hurdle Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: $$ \\lambda \\cdot \\frac{\\pi}{1 - e^{-\\lambda}} $$ Variance: \\(m \\cdot (\\lambda + 1 - m)\\), \\(m\\) mean . Probability mass function (p.m.f.): \\(P(X = 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X = k) = \\pi \\cdot \\frac{f(k; \\lambda)}{1 - f(0; \\lambda)} $$ \\(f(k; \\lambda)\\) p.m.f. Poisson distribution. Cumulative distribution function (c.d.f.): \\(P(X \\le 0) = 1 - \\pi\\) \\(k > 0\\) $$ P(X \\le k) = 1 - \\pi + \\pi \\cdot \\frac{F(k; \\lambda) - F(0; \\lambda)}{1 - F(0; \\lambda)} $$ \\(F(k; \\lambda)\\) c.d.f. Poisson distribution. Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a hurdle Poisson distribution — HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a HyperGeometric distribution — HyperGeometric","title":"Create a HyperGeometric distribution — HyperGeometric","text":"understand HyperGeometric distribution, consider set \\(r\\) objects, \\(m\\) type \\(n\\) type II. sample size \\(k\\) (\\(k [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a LogNormal distribution — LogNormal","title":"Create a LogNormal distribution — LogNormal","text":"random variable created exponentiating Normal() distribution. Taking log LogNormal data returns Normal() data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a LogNormal distribution — LogNormal","text":"","code":"LogNormal(log_mu = 0, log_sigma = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a LogNormal distribution — LogNormal","text":"log_mu location parameter, written \\(\\mu\\) textbooks. Can real number. Defaults 0. log_sigma scale parameter, written \\(\\sigma\\) textbooks. Can positive real number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a LogNormal distribution — LogNormal","text":"LogNormal object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a LogNormal distribution — LogNormal","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) LogNormal random variable success probability p = \\(p\\). Support: \\(R^+\\) Mean: \\(\\exp(\\mu + \\sigma^2/2)\\) Variance: \\([\\exp(\\sigma^2)-1]\\exp(2\\mu+\\sigma^2)\\) Probability density function (p.d.f): $$ f(x) = \\frac{1}{x \\sigma \\sqrt{2 \\pi}} \\exp \\left(-\\frac{(\\log x - \\mu)^2}{2 \\sigma^2} \\right) $$ Cumulative distribution function (c.d.f): $$F(x) = \\frac{1}{2} + \\frac{1}{2\\sqrt{pi}}\\int_{-x}^x e^{-t^2} dt$$ Moment generating function (m.g.f): Undefined.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a LogNormal distribution — LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Logistic distribution — Logistic","title":"Create a Logistic distribution — Logistic","text":"continuous distribution real line. binary outcomes model given \\(P(Y = 1 | X) = F(X \\beta)\\) \\(F\\) Logistic cdf() called logistic regression.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Logistic distribution — Logistic","text":"","code":"Logistic(location = 0, scale = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Logistic distribution — Logistic","text":"location location parameter distribution. Logistic distributions, location parameter mean, median also mode. Defaults zero. scale scale parameter distribution. Defaults one.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Logistic distribution — Logistic","text":"Logistic object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Logistic distribution — Logistic","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Logistic random variable location = \\(\\mu\\) scale = \\(s\\). Support: \\(R\\), set real numbers Mean: \\(\\mu\\) Variance: \\(s^2 \\pi^2 / 3\\) Probability density function (p.d.f): $$ f(x) = \\frac{e^{-(\\frac{x - \\mu}{s})}}{s [1 + \\exp(-(\\frac{x - \\mu}{s})) ]^2} $$ Cumulative distribution function (c.d.f): $$ F(t) = \\frac{1}{1 + e^{-(\\frac{t - \\mu}{s})}} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\mu t} \\beta(1 - st, 1 + st) $$ \\(\\beta(x, y)\\) Beta function.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Logistic distribution — Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Multinomial distribution — Multinomial","title":"Create a Multinomial distribution — Multinomial","text":"multinomial distribution generalization binomial distribution multiple categories. perhaps easiest think first extend Bernoulli() distribution include two categories, resulting Categorical() distribution. extend repeat Categorical experiment several (\\(n\\)) times.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Multinomial distribution — Multinomial","text":"","code":"Multinomial(size, p)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Multinomial distribution — Multinomial","text":"size number trials. Must integer greater equal one. size = 1L, Multinomial distribution reduces categorical distribution (also called discrete uniform). Often called n textbooks. p vector success probabilities trial. p can take positive value, vector normalized internally.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Multinomial distribution — Multinomial","text":"Multinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Multinomial distribution — Multinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X = (X_1, ..., X_k)\\) Multinomial random variable success probability p = \\(p\\). Note \\(p\\) vector \\(k\\) elements sum one. Assume repeat Categorical experiment size = \\(n\\) times. Support: \\(X_i\\) \\({0, 1, 2, ..., n}\\). Mean: mean \\(X_i\\) \\(n p_i\\). Variance: variance \\(X_i\\) \\(n p_i (1 - p_i)\\). \\(\\neq j\\), covariance \\(X_i\\) \\(X_j\\) \\(-n p_i p_j\\). Probability mass function (p.m.f): $$ P(X_1 = x_1, ..., X_k = x_k) = \\frac{n!}{x_1! x_2! ... x_k!} p_1^{x_1} \\cdot p_2^{x_2} \\cdot ... \\cdot p_k^{x_k} $$ Cumulative distribution function (c.d.f): Omitted multivariate random variables time . Moment generating function (m.g.f): $$ E(e^{tX}) = \\left(\\sum_{=1}^k p_i e^{t_i}\\right)^n $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Multinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Multinomial distribution — Multinomial","text":"","code":"set.seed(27) X <- Multinomial(size = 5, p = c(0.3, 0.4, 0.2, 0.1)) X #> Multinomial distribution (size = 5, p = [0.3, 0.4, ..., 0.1]) random(X, 10) #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 4 3 1 0 2 2 4 2 0 1 #> [2,] 1 1 4 4 1 1 1 3 1 1 #> [3,] 0 1 0 1 1 1 0 0 3 3 #> [4,] 0 0 0 0 1 1 0 0 1 0 # pdf(X, 2) # log_pdf(X, 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a negative binomial distribution — NegativeBinomial","title":"Create a negative binomial distribution — NegativeBinomial","text":"generalization geometric distribution. number failures sequence ..d. Bernoulli trials specified target number (\\(r\\)) successes occurs.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a negative binomial distribution — NegativeBinomial","text":"","code":"NegativeBinomial(size, p = 0.5, mu = size)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a negative binomial distribution — NegativeBinomial","text":"size target number successes (greater \\(0\\)) experiment stopped. Denoted \\(r\\) . p success probability given trial. p can value [0, 1], defaults 0.5. mu Alternative parameterization via non-negative mean distribution (instead probability p), defaults size.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a negative binomial distribution — NegativeBinomial","text":"NegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a negative binomial distribution — NegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) negative binomial random variable success probability p = \\(p\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\(\\frac{(1 - p) r}{p} = \\mu\\) Variance: \\(\\frac{(1 - p) r}{p^2}\\) Probability mass function (p.m.f.): $$ f(k) = {k + r - 1 \\choose k} \\cdot p^r (1-p)^k $$ Cumulative distribution function (c.d.f.): Omitted now. Moment generating function (m.g.f.): $$ \\left(\\frac{p}{1 - (1 -p) e^t}\\right)^r, t < -\\log (1-p) $$ Alternative parameterization: Sometimes, especially used regression models, negative binomial distribution parameterized mean \\(\\mu\\) (listed ) plus size parameter \\(r\\). implies success probability \\(p = r/(r + \\mu)\\). can also seen generalization Poisson distribution assumption equidispersion (.e., variance equal mean) relaxed. negative binomial distribution overdispersed (.e., variance greater mean) variance can also written \\(\\mu + 1/r \\mu^2\\). Poisson distribution obtained \\(r\\) goes infinity. Note view natural also allow non-integer \\(r\\) parameters. factorials equations expressed terms gamma function.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a negative binomial distribution — NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Normal distribution — Normal","title":"Create a Normal distribution — Normal","text":"Normal distribution ubiquitous statistics, partially central limit theorem, states sums ..d. random variables eventually become Normal. Linear transformations Normal random variables result new random variables also Normal. taking intro stats course, likely use Normal distribution Z-tests simple linear regression. regularity conditions, maximum likelihood estimators asymptotically Normal. Normal distribution also called gaussian distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Normal distribution — Normal","text":"","code":"Normal(mu = 0, sigma = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Normal distribution — Normal","text":"mu location parameter, written \\(\\mu\\) textbooks, also mean distribution. Can real number. Defaults 0. sigma scale parameter, written \\(\\sigma\\) textbooks, also standard deviation distribution. Can positive number. Defaults 1. like Normal distribution variance \\(\\sigma^2\\), sure take square root, common source errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Normal distribution — Normal","text":"Normal object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Normal distribution — Normal","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Normal random variable mean mu = \\(\\mu\\) standard deviation sigma = \\(\\sigma\\). Support: \\(R\\), set real numbers Mean: \\(\\mu\\) Variance: \\(\\sigma^2\\) Probability density function (p.d.f): $$ f(x) = \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} $$ Cumulative distribution function (c.d.f): cumulative distribution function form $$ F(t) = \\int_{-\\infty}^t \\frac{1}{\\sqrt{2 \\pi \\sigma^2}} e^{-(x - \\mu)^2 / 2 \\sigma^2} dx $$ integral closed form solution must approximated numerically. c.d.f. standard Normal sometimes called \"error function\". notation \\(\\Phi(t)\\) also stands c.d.f. standard Normal evaluated \\(t\\). Z-tables list value \\(\\Phi(t)\\) various \\(t\\). Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\mu t + \\sigma^2 t^2 / 2} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Normal distribution — Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Poisson distribution — Poisson","title":"Create a Poisson distribution — Poisson","text":"Poisson distributions frequently used model counts.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Poisson distribution — Poisson","text":"","code":"Poisson(lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Poisson distribution — Poisson","text":"lambda shape parameter, also mean variance distribution. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Poisson distribution — Poisson","text":"Poisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Poisson distribution — Poisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\(\\lambda\\) Variance: \\(\\lambda\\) Probability mass function (p.m.f): $$ P(X = k) = \\frac{\\lambda^k e^{-\\lambda}}{k!} $$ Cumulative distribution function (c.d.f): $$ P(X \\le k) = e^{-\\lambda} \\sum_{= 0}^{\\lfloor k \\rfloor} \\frac{\\lambda^}{!} $$ Moment generating function (m.g.f): $$ E(e^{tX}) = e^{\\lambda (e^t - 1)} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Poisson distribution — Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Poisson binomial distribution — PoissonBinomial","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"Poisson binomial distribution generalization Binomial distribution. also sum \\(n\\) independent Bernoulli experiments. However, success probabilities can vary experiments identically distributed.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"","code":"PoissonBinomial(...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"... arbitrary number numeric vectors matrices success probabilities [0, 1] (matching number rows).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"PoissonBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"Poisson binomial distribution comes consider number successes independent binomial experiments (coin flips) potentially varying success probabilities. PoissonBinomial distribution class distributions3 mostly based PoissonBinomial package, providing fast Rcpp implementations efficient algorithms. Hence, recommended install PoissonBinomial package working distribution. However, fallback PoissonBinomial package installed methods PoissonBinomial distribution employ normal approximation. recommend reading following documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) Poisson binomial random variable success probabilities \\(p_1\\) \\(p_n\\). Support: \\(\\{0, 1, 2, ..., n\\}\\) Mean: \\(p_1 + \\dots + p_n\\) Variance: \\(p_1 \\cdot (1 - p_1) + \\dots + p_1 \\cdot (1 - p_1)\\) Probability mass function (p.m.f): $$ P(X = k) = \\sum_A \\prod_{\\} p_i \\prod_{j \\^C} (1 - p_j) $$ sum taken sets \\(\\) \\(k\\) elements \\(\\{0, 1, 2, ..., n\\}\\). \\(^C\\) complement \\(\\). Cumulative distribution function (c.d.f): $$ P(X \\le k) = \\sum_{=0}^{\\lfloor k \\rfloor} P(X = ) $$ Moment generating function (m.g.f): $$ E(e^{tX}) = \\prod_{= 1}^n (1 - p_i + p_i e^t) $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Poisson binomial distribution — PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> Loading required namespace: PoissonBinomial #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a reversed Weibull distribution — RevWeibull","title":"Create a reversed Weibull distribution — RevWeibull","text":"reversed (negated) Weibull distribution special case \\link{GEV} distribution, obtained GEV shape parameter \\(\\xi\\) negative. may referred type III extreme value distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a reversed Weibull distribution — RevWeibull","text":"","code":"RevWeibull(location = 0, scale = 1, shape = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a reversed Weibull distribution — RevWeibull","text":"location location (maximum) parameter \\(m\\). location can real number. Defaults 0. scale scale parameter \\(s\\). scale can positive number. Defaults 1. shape scale parameter \\(\\alpha\\). shape can positive number. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a reversed Weibull distribution — RevWeibull","text":"RevWeibull object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a reversed Weibull distribution — RevWeibull","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) reversed Weibull random variable location parameter location = \\(m\\), scale parameter scale = \\(s\\), shape parameter shape = \\(\\alpha\\). RevWeibull(\\(m, s, \\alpha\\)) distribution equivalent \\link{GEV}(\\(m - s, s / \\alpha, -1 / \\alpha\\)) distribution. \\(X\\) RevWeibull(\\(m, \\lambda, k\\)) distribution \\(m - X\\) \\link{Weibull}(\\(k, \\lambda\\)) distribution, , Weibull distribution shape parameter \\(k\\) scale parameter \\(\\lambda\\). Support: \\((-\\infty, m)\\). Mean: \\(m + s\\Gamma(1 + 1/\\alpha)\\). Median: \\(m + s(\\ln 2)^{1/\\alpha}\\). Variance: \\(s^2 [\\Gamma(1 + 2 / \\alpha) - \\Gamma(1 + 1 / \\alpha)^2]\\). Probability density function (p.d.f): $$f(x) = \\alpha s ^ {-1} [-(x - m) / s] ^ {\\alpha - 1}% \\exp\\{-[-(x - m) / s] ^ {\\alpha} \\}$$ \\(x < m\\). p.d.f. 0 \\(x \\geq m\\). Cumulative distribution function (c.d.f): $$F(x) = \\exp\\{-[-(x - m) / s] ^ {\\alpha} \\}$$ \\(x < m\\). c.d.f. 1 \\(x \\geq m\\).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a reversed Weibull distribution — RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Student's T distribution — StudentsT","title":"Create a Student's T distribution — StudentsT","text":"Student's T distribution closely related Normal() distribution, heavier tails. \\(\\nu\\) increases \\(\\infty\\), Student's T converges Normal. T distribution appears repeatedly throughout classic frequentist hypothesis testing comparing group means.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Student's T distribution — StudentsT","text":"","code":"StudentsT(df)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Student's T distribution — StudentsT","text":"df Degrees freedom. Can positive number. Often called \\(\\nu\\) textbooks.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Student's T distribution — StudentsT","text":"StudentsT object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Student's T distribution — StudentsT","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Students T random variable df = \\(\\nu\\). Support: \\(R\\), set real numbers Mean: Undefined unless \\(\\nu \\ge 2\\), case mean zero. Variance: $$ \\frac{\\nu}{\\nu - 2} $$ Undefined \\(\\nu < 1\\), infinite \\(1 < \\nu \\le 2\\). Probability density function (p.d.f): $$ f(x) = \\frac{\\Gamma(\\frac{\\nu + 1}{2})}{\\sqrt{\\nu \\pi} \\Gamma(\\frac{\\nu}{2})} (1 + \\frac{x^2}{\\nu} )^{- \\frac{\\nu + 1}{2}} $$ Cumulative distribution function (c.d.f): Nasty, omitted. Moment generating function (m.g.f): Undefined.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Student's T distribution — StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Tukey distribution — Tukey","title":"Create a Tukey distribution — Tukey","text":"Tukey's studentized range distribution, used Tukey's honestly significant differences test ANOVA.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Tukey distribution — Tukey","text":"","code":"Tukey(nmeans, df, nranges)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Tukey distribution — Tukey","text":"nmeans Sample size range. df Degrees freedom. nranges Number groups compared.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Tukey distribution — Tukey","text":"Tukey object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Tukey distribution — Tukey","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. Support: \\(R^+\\), set positive real numbers. properties Tukey's Studentized Range Distribution omitted, largely distribution fun work .","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Tukey distribution — Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Continuous Uniform distribution — Uniform","title":"Create a Continuous Uniform distribution — Uniform","text":"distribution constant density interval. continuous analogue Categorical() distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Continuous Uniform distribution — Uniform","text":"","code":"Uniform(a = 0, b = 1)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Continuous Uniform distribution — Uniform","text":"parameter. can value set real numbers. Defaults 0. b parameter. b can value set real numbers. strictly bigger , , order parameters inverted. Defaults 1.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Continuous Uniform distribution — Uniform","text":"Uniform object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Continuous Uniform distribution — Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a Weibull distribution — Weibull","title":"Create a Weibull distribution — Weibull","text":"Generalization gamma distribution. Often used survival time--event analyses.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a Weibull distribution — Weibull","text":"","code":"Weibull(shape, scale)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a Weibull distribution — Weibull","text":"shape shape parameter \\(k\\). Can positive real number. scale scale parameter \\(\\lambda\\). Can positive real number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a Weibull distribution — Weibull","text":"Weibull object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a Weibull distribution — Weibull","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail much greater clarity. following, let \\(X\\) Weibull random variable success probability p = \\(p\\). Support: \\(R^+\\) zero. Mean: \\(\\lambda \\Gamma(1+1/k)\\), \\(\\Gamma\\) gamma function. Variance: \\(\\lambda [ \\Gamma (1 + \\frac{2}{k} ) - (\\Gamma(1+ \\frac{1}{k}))^2 ]\\) Probability density function (p.d.f): $$ f(x) = \\frac{k}{\\lambda}(\\frac{x}{\\lambda})^{k-1}e^{-(x/\\lambda)^k}, x \\ge 0 $$ Cumulative distribution function (c.d.f): $$F(x) = 1 - e^{-(x/\\lambda)^k}, x \\ge 0$$ Moment generating function (m.g.f): $$\\sum_{n=0}^\\infty \\frac{t^n\\lambda^n}{n!} \\Gamma(1+n/k), k \\ge 1$$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a Weibull distribution — Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"Zero-inflated negative binomial distributions frequently used model counts overdispersion many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"","code":"ZINegativeBinomial(mu, theta, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"mu Location parameter negative binomial component distribution. Can positive number. theta Overdispersion parameter negative binomial component distribution. Can positive number. pi Zero-inflation probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"ZINegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-inflated negative binomial random variable parameters mu = \\(\\mu\\) theta = \\(\\theta\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\((1 - \\pi) \\cdot \\mu\\) Variance: \\((1 - \\pi) \\cdot \\mu \\cdot (1 + (\\pi + 1/\\theta) \\cdot \\mu)\\) Probability mass function (p.m.f.): $$ P(X = k) = \\pi \\cdot I_{0}(k) + (1 - \\pi) \\cdot f(k; \\mu, \\theta) $$ \\(I_{0}(k)\\) indicator function zero \\(f(k; \\mu, \\theta)\\) p.m.f. NegativeBinomial distribution. Cumulative distribution function (c.d.f.): $$ P(X \\le k) = \\pi + (1 - \\pi) \\cdot F(k; \\mu, \\theta) $$ \\(F(k; \\mu, \\theta)\\) c.d.f. NegativeBinomial distribution. Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-inflated negative binomial distribution — ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-inflated Poisson distribution — ZIPoisson","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"Zero-inflated Poisson distributions frequently used model counts many zero observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"","code":"ZIPoisson(lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"lambda Parameter Poisson component distribution. Can positive number. pi Zero-inflation probability, can value [0, 1].","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"ZIPoisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-inflated Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{0, 1, 2, 3, ...\\}\\) Mean: \\((1 - \\pi) \\cdot \\lambda\\) Variance: \\((1 - \\pi) \\cdot \\lambda \\cdot (1 + \\pi \\cdot \\lambda)\\) Probability mass function (p.m.f.): $$ P(X = k) = \\pi \\cdot I_{0}(k) + (1 - \\pi) \\cdot f(k; \\lambda) $$ \\(I_{0}(k)\\) indicator function zero \\(f(k; \\lambda)\\) p.m.f. Poisson distribution. Cumulative distribution function (c.d.f.): $$ P(X \\le k) = \\pi + (1 - \\pi) \\cdot F(k; \\lambda) $$ \\(F(k; \\lambda)\\) c.d.f. Poisson distribution. Moment generating function (m.g.f.): $$ E(e^{tX}) = \\pi + (1 - \\pi) \\cdot e^{\\lambda (e^t - 1)} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-inflated Poisson distribution — ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"Zero-truncated negative binomial distributions frequently used model counts zero observations occur excluded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"","code":"ZTNegativeBinomial(mu, theta)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"mu Location parameter negative binomial component distribution. Can positive number. theta Overdispersion parameter negative binomial component distribution. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"ZTNegativeBinomial object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-truncated negative binomial random variable parameter mu = \\(\\mu\\). Support: \\(\\{1, 2, 3, ...\\}\\) Mean: $$ \\mu \\cdot \\frac{1}{1 - F(0; \\mu, \\theta)} $$ \\(F(k; \\mu, \\theta)\\) c.d.f. NegativeBinomial distribution. Variance: \\(m \\cdot (\\mu + 1 - m)\\), \\(m\\) mean . Probability mass function (p.m.f.): $$ P(X = k) = \\frac{f(k; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ \\(f(k; \\mu, \\theta)\\) p.m.f. NegativeBinomial distribution. Cumulative distribution function (c.d.f.): $$ P(X = k) = \\frac{F(k; \\mu, \\theta)}{1 - F(0; \\mu, \\theta)} $$ Moment generating function (m.g.f.): Omitted now.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-truncated negative binomial distribution — ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a zero-truncated Poisson distribution — ZTPoisson","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"Zero-truncated Poisson distributions frequently used model counts zero observations occur excluded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"","code":"ZTPoisson(lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"lambda Parameter underlying untruncated Poisson distribution. Can positive number.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"ZTPoisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"recommend reading documentation https://alexpghayes.github.io/distributions3/, math render additional detail. following, let \\(X\\) zero-truncated Poisson random variable parameter lambda = \\(\\lambda\\). Support: \\(\\{1, 2, 3, ...\\}\\) Mean: $$ \\lambda \\cdot \\frac{1}{1 - e^{-\\lambda}} $$ Variance: \\(m \\cdot (\\lambda + 1 - m)\\), \\(m\\) mean . Probability mass function (p.m.f.): $$ P(X = k) = \\frac{f(k; \\lambda)}{1 - f(0; \\lambda)} $$ \\(f(k; \\lambda)\\) p.m.f. Poisson distribution. Cumulative distribution function (c.d.f.): $$ P(X = k) = \\frac{F(k; \\lambda)}{1 - F(0; \\lambda)} $$ \\(F(k; \\lambda)\\) c.d.f. Poisson distribution. Moment generating function (m.g.f.): $$ E(e^{tX}) = \\frac{1}{1 - e^{-\\lambda}} \\cdot e^{\\lambda (e^t - 1)} $$","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a zero-truncated Poisson distribution — ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":null,"dir":"Reference","previous_headings":"","what":"Utilities for distributions3 objects — apply_dpqr","title":"Utilities for distributions3 objects — apply_dpqr","text":"Various utility functions implement methods distributions unified workflow, particular facilitate working vectorized distributions3 objects. particularly useful computation densities, probabilities, quantiles, random samples classical d/p/q/r functions readily available distribution interest.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Utilities for distributions3 objects — apply_dpqr","text":"","code":"apply_dpqr(d, FUN, at, elementwise = NULL, drop = TRUE, type = NULL, ...) make_support(min, max, d, drop = TRUE) make_positive_integer(n)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Utilities for distributions3 objects — apply_dpqr","text":"d distributions3 object. FUN Function computed. Function type FUN(, d), argument function evaluated (e.g., quantile, probability, sample size) d distributions3 object. Specification values FUN evaluated, typically numeric vector (e.g., quantiles, probabilities, etc.) possibly also matrix data frame. elementwise logical. element d evaluated corresponding element (elementwise = TRUE) elements (elementwise = FALSE). Elementwise evaluation possible length d case vector length returned. Otherwise matrix returned. default use elementwise = TRUE possible, otherwise elementwise = FALSE. drop logical. result simplified vector possible (dropping dimension attribute)? FALSE matrix always returned. type Character string used naming, typically one \"density\", \"logLik\", \"probability\", \"quantile\", \"random\". Note \"random\" case processed differently internally order vectorize random number generation efficiently. ... Arguments passed FUN. min, max Numeric vectors. Minima maxima supports distributions3 object. n numeric. Number observations computing random draws. length(n) > 1, length taken number required (consistent base R , e.g., rnorm()).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/apply_dpqr.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Utilities for distributions3 objects — apply_dpqr","text":"","code":"## Implementing a new distribution based on the provided utility functions ## Illustration: Gaussian distribution ## Note: Gaussian() is really just a copy of Normal() with a different class/distribution name ## Generator function for the distribution object. Gaussian <- function(mu = 0, sigma = 1) { stopifnot( \"parameter lengths do not match (only scalars are allowed to be recycled)\" = length(mu) == length(sigma) | length(mu) == 1 | length(sigma) == 1 ) d <- data.frame(mu = mu, sigma = sigma) class(d) <- c(\"Gaussian\", \"distribution\") d } ## Set up a vector Y containing four Gaussian distributions: Y <- Gaussian(mu = 1:4, sigma = c(1, 1, 2, 2)) Y #> [1] \"Gaussian(mu = 1, sigma = 1)\" \"Gaussian(mu = 2, sigma = 1)\" #> [3] \"Gaussian(mu = 3, sigma = 2)\" \"Gaussian(mu = 4, sigma = 2)\" ## Extract the underlying parameters: as.matrix(Y) #> mu sigma #> [1,] 1 1 #> [2,] 2 1 #> [3,] 3 2 #> [4,] 4 2 ## Extractor functions for moments of the distribution include ## mean(), variance(), skewness(), kurtosis(). ## These can be typically be defined as functions of the list of parameters. mean.Gaussian <- function(x, ...) { rlang::check_dots_used() setNames(x$mu, names(x)) } ## Analogously for other moments, see distributions3:::variance.Normal etc. mean(Y) #> [1] 1 2 3 4 ## The support() method should return a matrix of \"min\" and \"max\" for the ## distribution. The make_support() function helps to set the right names and ## dimension. support.Gaussian <- function(d, drop = TRUE, ...) { min <- rep(-Inf, length(d)) max <- rep(Inf, length(d)) make_support(min, max, d, drop = drop) } support(Y) #> min max #> [1,] -Inf Inf #> [2,] -Inf Inf #> [3,] -Inf Inf #> [4,] -Inf Inf ## Evaluating certain functions associated with the distribution, e.g., ## pdf(), log_pdf(), cdf() quantile(), random(), etc. The apply_dpqr() ## function helps to call the typical d/p/q/r functions (like dnorm, ## pnorm, etc.) and set suitable names and dimension. pdf.Gaussian <- function(d, x, elementwise = NULL, drop = TRUE, ...) { FUN <- function(at, d) dnorm(x = at, mean = d$mu, sd = d$sigma, ...) apply_dpqr(d = d, FUN = FUN, at = x, type = \"density\", elementwise = elementwise, drop = drop) } ## Evaluate all densities at the same argument (returns vector): pdf(Y, 0) #> [1] 0.24197072 0.05399097 0.06475880 0.02699548 ## Evaluate all densities at several arguments (returns matrix): pdf(Y, c(0, 5)) #> d_0 d_5 #> [1,] 0.24197072 0.0001338302 #> [2,] 0.05399097 0.0044318484 #> [3,] 0.06475880 0.1209853623 #> [4,] 0.02699548 0.1760326634 ## Evaluate each density at a different argument (returns vector): pdf(Y, 4:1) #> [1] 0.004431848 0.241970725 0.176032663 0.064758798 ## Force evaluation of each density at a different argument (returns vector) ## or at all arguments (returns matrix): pdf(Y, 4:1, elementwise = TRUE) #> [1] 0.004431848 0.241970725 0.176032663 0.064758798 pdf(Y, 4:1, elementwise = FALSE) #> d_4 d_3 d_2 d_1 #> [1,] 0.004431848 0.05399097 0.2419707 0.3989423 #> [2,] 0.053990967 0.24197072 0.3989423 0.2419707 #> [3,] 0.176032663 0.19947114 0.1760327 0.1209854 #> [4,] 0.199471140 0.17603266 0.1209854 0.0647588 ## Drawing random() samples also uses apply_dpqr() with the argument ## n assured to be a positive integer. random.Gaussian <- function(x, n = 1L, drop = TRUE, ...) { n <- make_positive_integer(n) if (n == 0L) { return(numeric(0L)) } FUN <- function(at, d) rnorm(n = at, mean = d$mu, sd = d$sigma) apply_dpqr(d = x, FUN = FUN, at = n, type = \"random\", drop = drop) } ## One random sample for each distribution (returns vector): random(Y, 1) #> [1] -0.596718 2.490967 3.843207 7.747808 ## Several random samples for each distribution (returns matrix): random(Y, 3) #> r_1 r_2 r_3 #> [1,] 2.034514 0.1125799 -0.134331 #> [2,] 2.081810 2.1054214 3.462352 #> [3,] 2.834952 3.7057489 4.404233 #> [4,] 5.212147 5.1007867 9.014222 ## For further analogous methods see the \"Normal\" distribution provided ## in distributions3. methods(class = \"Normal\") #> [1] cdf fit_mle is_continuous is_discrete kurtosis #> [6] log_pdf mean pdf quantile random #> [11] skewness suff_stat support variance #> see '?methods' for accessing help and source code"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"Evaluate cumulative distribution function Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"d Bernoulli object created call Bernoulli(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Bernoulli distribution — cdf.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"Evaluate cumulative distribution function Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"","code":"# S3 method for class 'Beta' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"d Beta object created call Beta(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pbeta. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Beta distribution — cdf.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"Evaluate cumulative distribution function Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"","code":"# S3 method for class 'Binomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"d Binomial object created call Binomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Binomial distribution — cdf.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"Evaluate cumulative distribution function Categorical distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"","code":"# S3 method for class 'Categorical' cdf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"d Categorical object created call Categorical(). x vector elements whose cumulative probabilities like determine given distribution d. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"vector probabilities, one element x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Categorical distribution — cdf.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"Evaluate cumulative distribution function Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"","code":"# S3 method for class 'Cauchy' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"d Cauchy object created call Cauchy(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pcauchy. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Cauchy distribution — cdf.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"Evaluate cumulative distribution function chi square distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"d ChiSquare object created call ChiSquare(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pchisq. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a chi square distribution — cdf.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"Evaluate cumulative distribution function Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"","code":"# S3 method for class 'Erlang' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"d Erlang object created call Erlang(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an Erlang distribution — cdf.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"Evaluate cumulative distribution function Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"","code":"# S3 method for class 'Exponential' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"d Exponential object created call Exponential(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pexp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an Exponential distribution — cdf.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"Evaluate cumulative distribution function F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"","code":"# S3 method for class 'FisherF' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"d FisherF object created call FisherF(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pf. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an F distribution — cdf.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"Evaluate cumulative distribution function Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"","code":"# S3 method for class 'Frechet' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"d Frechet object created call Frechet(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Frechet distribution — cdf.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"Evaluate cumulative distribution function GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"","code":"# S3 method for class 'GEV' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"d GEV object created call GEV(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a GEV distribution — cdf.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"Evaluate cumulative distribution function GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"","code":"# S3 method for class 'GP' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"d GP object created call GP(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a GP distribution — cdf.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"Evaluate cumulative distribution function Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"","code":"# S3 method for class 'Gamma' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"d Gamma object created call Gamma(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Gamma distribution — cdf.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"Evaluate cumulative distribution function Geometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"","code":"# S3 method for class 'Geometric' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"d Geometric object created call Geometric(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgeom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Geometric distribution — cdf.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"Evaluate cumulative distribution function Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"","code":"# S3 method for class 'Gumbel' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"d Gumbel object created call Gumbel(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Gumbel distribution — cdf.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"Evaluate cumulative distribution function hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"d HurdleNegativeBinomial object created call HurdleNegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed phnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a hurdle negative binomial distribution — cdf.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"Evaluate cumulative distribution function hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"d HurdlePoisson object created call HurdlePoisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed phpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a hurdle Poisson distribution — cdf.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"Evaluate cumulative distribution function HyperGeometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"d HyperGeometric object created call HyperGeometric(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed phyper. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a HyperGeometric distribution — cdf.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"Evaluate cumulative distribution function LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"","code":"# S3 method for class 'LogNormal' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"d LogNormal object created call LogNormal(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed plnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a LogNormal distribution — cdf.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"Evaluate cumulative distribution function Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"","code":"# S3 method for class 'Logistic' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"d Logistic object created call Logistic(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed plogis. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Logistic distribution — cdf.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"Evaluate cumulative distribution function negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"d NegativeBinomial object created call NegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a negative binomial distribution — cdf.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"Evaluate cumulative distribution function Normal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"","code":"# S3 method for class 'Normal' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"d Normal object created call Normal(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Normal distribution — cdf.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"Evaluate cumulative distribution function Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"","code":"# S3 method for class 'Poisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"d Poisson object created call Poisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed ppois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Poisson distribution — cdf.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"Evaluate cumulative distribution function PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' cdf( d, x, drop = TRUE, elementwise = NULL, lower.tail = TRUE, log.p = FALSE, verbose = TRUE, ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"d PoissonBinomial object created call PoissonBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. lower.tail, log.p, ... Arguments passed ppbinom pnorm, respectively. verbose logical. warning issued normal approximation applied PoissonBinomial package installed?","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a PoissonBinomial distribution — cdf.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"Evaluate cumulative distribution function RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"d RevWeibull object created call RevWeibull(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of an RevWeibull distribution — cdf.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"Evaluate cumulative distribution function StudentsT distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"","code":"# S3 method for class 'StudentsT' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"d StudentsT object created call StudentsT(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pt. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a StudentsT distribution — cdf.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"Evaluate cumulative distribution function Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"","code":"# S3 method for class 'Tukey' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"d Tukey distribution created call Tukey(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed ptukey. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Tukey distribution — cdf.Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"Evaluate cumulative distribution function continuous Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"","code":"# S3 method for class 'Uniform' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"d Uniform object created call Uniform(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed punif. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a continuous Uniform distribution — cdf.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"Evaluate cumulative distribution function Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"","code":"# S3 method for class 'Weibull' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"d Weibull object created call Weibull(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pweibull. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a Weibull distribution — cdf.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"Evaluate cumulative distribution function zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"d ZINegativeBinomial object created call ZINegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pzinbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-inflated negative binomial distribution — cdf.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"Evaluate cumulative distribution function zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"d ZIPoisson object created call ZIPoisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pzipois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-inflated Poisson distribution — cdf.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"Evaluate cumulative distribution function zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"d ZTNegativeBinomial object created call ZTNegativeBinomial(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pztnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-truncated negative binomial distribution — cdf.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"Evaluate cumulative distribution function zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' cdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"d ZTPoisson object created call ZTPoisson(). x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed pztpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a zero-truncated Poisson distribution — cdf.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the cumulative distribution function of a probability distribution — cdf","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"Generic function computing probabilities distribution objects based cumulative distribution function (CDF).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"","code":"cdf(d, x, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector elements whose cumulative probabilities like determine given distribution d. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"Probabilities corresponding vector x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/cdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the cumulative distribution function of a probability distribution — cdf","text":"","code":"## distribution object X <- Normal() ## probabilities from CDF cdf(X, c(1, 2, 3, 4, 5)) #> [1] 0.8413447 0.9772499 0.9986501 0.9999683 0.9999997"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/distributions3-package.html","id":null,"dir":"Reference","previous_headings":"","what":"distributions3: Probability Distributions as S3 Objects — distributions3-package","title":"distributions3: Probability Distributions as S3 Objects — distributions3-package","text":"Tools create manipulate probability distributions using S3. Generics pdf(), cdf(), quantile(), random() provide replacements base R's d/p/q/r style functions. Functions arguments named carefully minimize confusion students intro stats courses. documentation distribution contains detailed mathematical notes.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/distributions3-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"distributions3: Probability Distributions as S3 Objects — distributions3-package","text":"Maintainer: Alex Hayes alexpghayes@gmail.com (ORCID) Authors: Ralph Moller-Trane Daniel Jordan dandermotj@gmail.com Paul Northrop p.northrop@ucl.ac.uk Moritz N. Lang moritz.n.lang@gmail.com (ORCID) Achim Zeileis Achim.Zeileis@R-project.org (ORCID) contributors: Emil Hvitfeldt emilhhvitfeldt@gmail.com (ORCID) [contributor] Bruna Wundervald brunadaviesw@gmail.com [contributor] Alessandro Gasparini alessandro.gasparini@ki.se [contributor]","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"Fit Bernoulli distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"d Bernoulli object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Bernoulli distribution to data — fit_mle.Bernoulli","text":"Bernoulli object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Binomial distribution to data — fit_mle.Binomial","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"fit distribution inherit size parameter Binomial object passed.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"","code":"# S3 method for class 'Binomial' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"d Binomial object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Binomial distribution to data — fit_mle.Binomial","text":"Binomial object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit an Exponential distribution to data — fit_mle.Exponential","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"Fit Exponential distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"","code":"# S3 method for class 'Exponential' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"d Exponential object created call Exponential(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit an Exponential distribution to data — fit_mle.Exponential","text":"Exponential object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Gamma distribution to data — fit_mle.Gamma","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"Fit Gamma distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"","code":"# S3 method for class 'Gamma' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"d Gamma object created call Gamma(). x vector fit Gamma distribution . ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Gamma distribution to data — fit_mle.Gamma","text":"Gamma object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Geometric distribution to data — fit_mle.Geometric","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"Fit Geometric distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"","code":"# S3 method for class 'Geometric' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"d Geometric object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Geometric distribution to data — fit_mle.Geometric","text":"Geometric object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Log Normal distribution to data — fit_mle.LogNormal","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"Fit Log Normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"","code":"# S3 method for class 'LogNormal' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"d LogNormal object created call LogNormal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Log Normal distribution to data — fit_mle.LogNormal","text":"LogNormal object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a Normal distribution to data — fit_mle.Normal","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"Fit Normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"","code":"# S3 method for class 'Normal' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"d Normal object created call Normal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a Normal distribution to data — fit_mle.Normal","text":"Normal object.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit an Poisson distribution to data — fit_mle.Poisson","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"Fit Poisson distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"","code":"# S3 method for class 'Poisson' fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"d Poisson object created call Poisson(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit an Poisson distribution to data — fit_mle.Poisson","text":"Poisson object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a distribution to data — fit_mle","title":"Fit a distribution to data — fit_mle","text":"Generic function fitting maximum-likelihood estimates (MLEs) distribution based empirical data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a distribution to data — fit_mle","text":"","code":"fit_mle(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a distribution to data — fit_mle","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector data compute likelihood. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a distribution to data — fit_mle","text":"distribution (kind d) parameters MLE estimates based x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/fit_mle.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fit a distribution to data — fit_mle","text":"","code":"X <- Normal() fit_mle(X, c(-1, 0, 0, 0, 3)) #> [1] \"Normal(mu = 0.4, sigma = 1.517)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":null,"dir":"Reference","previous_headings":"","what":"Fill out area under the curve for a plotted PDF — stat_auc","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"Fill area curve plotted PDF","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"","code":"stat_auc( mapping = NULL, data = NULL, geom = \"auc\", position = \"identity\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, from = -Inf, to = Inf, annotate = FALSE, digits = 3, ... ) geom_auc( mapping = NULL, data = NULL, stat = \"auc\", position = \"identity\", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, from = -Inf, to = Inf, annotate = FALSE, digits = 3, ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"mapping Set aesthetic mappings created aes(). specified inherit.aes = TRUE (default), combined default mapping top level plot. must supply mapping plot mapping. data data displayed layer. three options: NULL, default, data inherited plot data specified call ggplot(). data.frame, object, override plot data. objects fortified produce data frame. See fortify() variables created. function called single argument, plot data. return value must data.frame, used layer data. function can created formula (e.g. ~ head(.x, 10)). geom geometric object use display data layer. using stat_*() function construct layer, geom argument can used override default coupling stats geoms. geom argument accepts following: Geom ggproto subclass, example GeomPoint. string naming geom. give geom string, strip function name geom_ prefix. example, use geom_point(), give geom \"point\". information ways specify geom, see layer geom documentation. position position adjustment use data layer. can used various ways, including prevent overplotting improving display. position argument accepts following: result calling position function, position_jitter(). method allows passing extra arguments position. string naming position adjustment. give position string, strip function name position_ prefix. example, use position_jitter(), give position \"jitter\". information ways specify position, see layer position documentation. na.rm FALSE, default, missing values removed warning. TRUE, missing values silently removed. show.legend logical. layer included legends? NA, default, includes aesthetics mapped. FALSE never includes, TRUE always includes. can also named logical vector finely select aesthetics display. inherit.aes FALSE, overrides default aesthetics, rather combining . useful helper functions define data aesthetics inherit behaviour default plot specification, e.g. borders(). Left end-point interval Right end-point interval annotate P() added upper left corner annotation? Works also colour character, e.g., \"red\". digits Number digits shown annotation ... arguments passed layer()'s params argument. arguments broadly fall one 4 categories . Notably, arguments position argument, aesthetics required can passed .... Unknown arguments part 4 categories ignored. Static aesthetics mapped scale, fixed value apply layer whole. example, colour = \"red\" linewidth = 3. geom's documentation Aesthetics section lists available options. 'required' aesthetics passed params. Please note passing unmapped aesthetics vectors technically possible, order required length guaranteed parallel input data. constructing layer using stat_*() function, ... argument can used pass parameters geom part layer. example stat_density(geom = \"area\", outline.type = \"\"). geom's documentation lists parameters can accept. Inversely, constructing layer using geom_*() function, ... argument can used pass parameters stat part layer. example geom_area(stat = \"density\", adjust = 0.5). stat's documentation lists parameters can accept. key_glyph argument layer() may also passed .... can one functions described key glyphs, change display layer legend. stat statistical transformation use data layer. using geom_*() function construct layer, stat argument can used override default coupling geoms stats. stat argument accepts following: Stat ggproto subclass, example StatCount. string naming stat. give stat string, strip function name stat_ prefix. example, use stat_count(), give stat \"count\". information ways specify stat, see layer stat documentation.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/geom_auc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fill out area under the curve for a plotted PDF — stat_auc","text":"","code":"N1 <- Normal() plot_pdf(N1) + geom_auc(to = -0.645) plot_pdf(N1) + geom_auc(from = -0.645, to = 0.1, annotate = TRUE) N2 <- Normal(0, c(1, 2)) plot_pdf(N2) + geom_auc(to = 0) plot_pdf(N2) + geom_auc(from = -2, to = 2, annotate = TRUE)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":null,"dir":"Reference","previous_headings":"","what":"The hurdle negative binomial distribution — dhnbinom","title":"The hurdle negative binomial distribution — dhnbinom","text":"Density, distribution function, quantile function, random generation zero-hurdle negative binomial distribution parameters mu, theta (size), pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The hurdle negative binomial distribution — dhnbinom","text":"","code":"dhnbinom(x, mu, theta, size, pi, log = FALSE) phnbinom(q, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) qhnbinom(p, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) rhnbinom(n, mu, theta, size, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The hurdle negative binomial distribution — dhnbinom","text":"x vector (non-negative integer) quantiles. mu vector (non-negative) negative binomial location parameters. theta, size vector (non-negative) negative binomial overdispersion parameters. theta , equivalently, size may specified. pi vector zero-hurdle probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The hurdle negative binomial distribution — dhnbinom","text":"functions follow usual conventions d/p/q/r functions base R. particular, four hnbinom functions hurdle negative binomial distribution call corresponding nbinom functions negative binomial distribution base R internally. Note, however, precision qhnbinom large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hnbinom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The hurdle negative binomial distribution — dhnbinom","text":"","code":"## theoretical probabilities for a hurdle negative binomial distribution x <- 0:8 p <- dhnbinom(x, mu = 2.5, theta = 1, pi = 0.75) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rhnbinom(500, mu = 2.5, theta = 1, pi = 0.75) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":null,"dir":"Reference","previous_headings":"","what":"The hurdle Poisson distribution — dhpois","title":"The hurdle Poisson distribution — dhpois","text":"Density, distribution function, quantile function, random generation zero-hurdle Poisson distribution parameters lambda pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The hurdle Poisson distribution — dhpois","text":"","code":"dhpois(x, lambda, pi, log = FALSE) phpois(q, lambda, pi, lower.tail = TRUE, log.p = FALSE) qhpois(p, lambda, pi, lower.tail = TRUE, log.p = FALSE) rhpois(n, lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The hurdle Poisson distribution — dhpois","text":"x vector (non-negative integer) quantiles. lambda vector (non-negative) Poisson parameters. pi vector zero-hurdle probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The hurdle Poisson distribution — dhpois","text":"functions follow usual conventions d/p/q/r functions base R. particular, four hpois functions hurdle Poisson distribution call corresponding pois functions Poisson distribution base R internally. Note, however, precision qhpois large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/hpois.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The hurdle Poisson distribution — dhpois","text":"","code":"## theoretical probabilities for a hurdle Poisson distribution x <- 0:8 p <- dhpois(x, lambda = 2.5, pi = 0.75) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rhpois(500, lambda = 2.5, pi = 0.75) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine whether a distribution is discrete or continuous — is_discrete","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"Generic functions determining whether certain probability distribution discrete continuous, respectively.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"","code":"is_discrete(d, ...) is_continuous(d, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"d object. package provides methods distribution objects Normal() Binomial() etc. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"logical vector indicating whether distribution(s) d /discrete continuous, respectively.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"generic function is_discrete intended return TRUE every distribution whose entire support discrete FALSE otherwise. Analogously, is_continuous intended return TRUE every distribution whose entire support continuous FALSE otherwise. mixed discrete-continuous distributions methods return FALSE. Methods generics provided distribution classes set package.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_discrete.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine whether a distribution is discrete or continuous — is_discrete","text":"","code":"X <- Normal() is_discrete(X) #> [1] FALSE is_continuous(X) #> [1] TRUE Y <- Binomial(size = 10, p = c(0.2, 0.5, 0.8)) is_discrete(Y) #> [1] TRUE TRUE TRUE is_continuous(Y) #> [1] FALSE FALSE FALSE"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":null,"dir":"Reference","previous_headings":"","what":"Is an object a distribution? — is_distribution","title":"Is an object a distribution? — is_distribution","text":"is_distribution tests x inherits \"distribution\".","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is an object a distribution? — is_distribution","text":"","code":"is_distribution(x)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is an object a distribution? — is_distribution","text":"x object test.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/is_distribution.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Is an object a distribution? — is_distribution","text":"","code":"Z <- Normal() is_distribution(Z) #> [1] TRUE is_distribution(1L) #> [1] FALSE"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"Functions computing (log-)likelihood based distribution object observed data. log-likelihood computed sum log-density contributions likelihood taking exponential thereof.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"","code":"log_likelihood(d, x, ...) likelihood(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector data compute likelihood. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"Numeric value (log-)likelihood.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/log_likelihood.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute the (log-)likelihood of a probability distribution given data — log_likelihood","text":"","code":"## distribution object X <- Normal() ## sum of log_pdf() contributions log_likelihood(X, c(-1, 0, 0, 0, 3)) #> [1] -9.594693 ## exp of log_likelihood() likelihood(X, c(-1, 0, 0, 0, 3)) #> [1] 6.808915e-05"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"Evaluate probability mass function Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Bernoulli' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"d Bernoulli object created call Bernoulli(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Bernoulli distribution — pdf.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"Evaluate probability mass function Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"","code":"# S3 method for class 'Beta' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Beta' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"d Beta object created call Beta(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dbeta. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Beta distribution — pdf.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"Evaluate probability mass function Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"","code":"# S3 method for class 'Binomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Binomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"d Binomial object created call Binomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Binomial distribution — pdf.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"Evaluate probability mass function Categorical discrete distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"","code":"# S3 method for class 'Categorical' pdf(d, x, ...) # S3 method for class 'Categorical' log_pdf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"d Categorical object created call Categorical(). x vector elements whose probabilities like determine given distribution d. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"vector probabilities, one element x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Categorical discrete distribution — pdf.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"Evaluate probability mass function Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"","code":"# S3 method for class 'Cauchy' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Cauchy' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"d Cauchy object created call Cauchy(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dcauchy. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Cauchy distribution — pdf.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"Evaluate probability mass function chi square distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ChiSquare' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"d ChiSquare object created call ChiSquare(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dchisq. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a chi square distribution — pdf.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"Evaluate probability mass function Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"","code":"# S3 method for class 'Erlang' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Erlang' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"d Erlang object created call Erlang(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of an Erlang distribution — pdf.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"Evaluate probability density function Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"","code":"# S3 method for class 'Exponential' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Exponential' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"d Exponential object created call Exponential(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dexp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability density function of an Exponential distribution — pdf.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of an F distribution — pdf.FisherF","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"Evaluate probability mass function F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"","code":"# S3 method for class 'FisherF' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'FisherF' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"d FisherF object created call FisherF(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed df. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of an F distribution — pdf.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"Evaluate probability mass function Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"","code":"# S3 method for class 'Frechet' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Frechet' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"d Frechet object created call Frechet(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Frechet distribution — pdf.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"Evaluate probability mass function GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"","code":"# S3 method for class 'GEV' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'GEV' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"d GEV object created call GEV(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a GEV distribution — pdf.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a GP distribution — pdf.GP","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"Evaluate probability mass function GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"","code":"# S3 method for class 'GP' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'GP' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"d GP object created call GP(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a GP distribution — pdf.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"Evaluate probability mass function Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"","code":"# S3 method for class 'Gamma' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Gamma' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"d Gamma object created call Gamma(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Gamma distribution — pdf.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"Please see documentation Geometric() properties Geometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"","code":"# S3 method for class 'Geometric' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Geometric' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"d Geometric object created call Geometric(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgeom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Geometric distribution — pdf.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"Evaluate probability mass function Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"","code":"# S3 method for class 'Gumbel' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Gumbel' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"d Gumbel object created call Gumbel(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Gumbel distribution — pdf.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"Evaluate probability mass function hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'HurdleNegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"d HurdleNegativeBinomial object created call HurdleNegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dhnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a hurdle negative binomial distribution — pdf.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"Evaluate probability mass function hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'HurdlePoisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"d HurdlePoisson object created call HurdlePoisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dhpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a hurdle Poisson distribution — pdf.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"Please see documentation HyperGeometric() properties HyperGeometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'HyperGeometric' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"d HyperGeometric object created call HyperGeometric(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dhyper. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a HyperGeometric distribution — pdf.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"Please see documentation LogNormal() properties LogNormal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"","code":"# S3 method for class 'LogNormal' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'LogNormal' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"d LogNormal object created call LogNormal(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dlnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a LogNormal distribution — pdf.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"Please see documentation Logistic() properties Logistic distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"","code":"# S3 method for class 'Logistic' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Logistic' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"d Logistic object created call Logistic(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dlogis. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Logistic distribution — pdf.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"Please see documentation Multinomial() properties Multinomial distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"","code":"# S3 method for class 'Multinomial' pdf(d, x, ...) # S3 method for class 'Multinomial' log_pdf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"d Multinomial object created call Multinomial(). x vector elements whose probabilities like determine given distribution d. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"vector probabilities, one element x.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Multinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Multinomial distribution — pdf.Multinomial","text":"","code":"set.seed(27) X <- Multinomial(size = 5, p = c(0.3, 0.4, 0.2, 0.1)) X #> Multinomial distribution (size = 5, p = [0.3, 0.4, ..., 0.1]) random(X, 10) #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 4 3 1 0 2 2 4 2 0 1 #> [2,] 1 1 4 4 1 1 1 3 1 1 #> [3,] 0 1 0 1 1 1 0 0 3 3 #> [4,] 0 0 0 0 1 1 0 0 1 0 # pdf(X, 2) # log_pdf(X, 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"Evaluate probability mass function NegativeBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'NegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"d NegativeBinomial object created call NegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a NegativeBinomial distribution — pdf.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"","code":"# S3 method for class 'Normal' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Normal' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"d Normal object created call Normal(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Normal distribution — pdf.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"Evaluate probability mass function Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"","code":"# S3 method for class 'Poisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Poisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"d Poisson object created call Poisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Poisson distribution — pdf.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"Evaluate probability mass function PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, log = FALSE, verbose = TRUE, ...) # S3 method for class 'PoissonBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"d PoissonBinomial object created call PoissonBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. log, ... Arguments passed dpbinom pnorm, respectively. verbose logical. warning issued normal approximation applied PoissonBinomial package installed?","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a PoissonBinomial distribution — pdf.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"Evaluate probability mass function RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'RevWeibull' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"d RevWeibull object created call RevWeibull(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of an RevWeibull distribution — pdf.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"Please see documentation StudentsT() properties StudentsT distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"","code":"# S3 method for class 'StudentsT' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'StudentsT' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"d StudentsT object created call StudentsT(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dt. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a StudentsT distribution — pdf.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"Evaluate probability mass function continuous Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"","code":"# S3 method for class 'Uniform' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Uniform' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"d Uniform object created call Uniform(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dunif. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a continuous Uniform distribution — pdf.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"Please see documentation Weibull() properties Weibull distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"","code":"# S3 method for class 'Weibull' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'Weibull' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"d Weibull object created call Weibull(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dweibull. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a Weibull distribution — pdf.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"Evaluate probability mass function zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZINegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"d ZINegativeBinomial object created call ZINegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dzinbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-inflated negative binomial distribution — pdf.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"Evaluate probability mass function zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZIPoisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"d ZIPoisson object created call ZIPoisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dzipois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-inflated Poisson distribution — pdf.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"Evaluate probability mass function zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZTNegativeBinomial' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"d ZTNegativeBinomial object created call ZTNegativeBinomial(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dztnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-truncated negative binomial distribution — pdf.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"Evaluate probability mass function zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' pdf(d, x, drop = TRUE, elementwise = NULL, ...) # S3 method for class 'ZTPoisson' log_pdf(d, x, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"d ZTPoisson object created call ZTPoisson(). x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? elementwise logical. distribution d evaluated elements x (elementwise = FALSE, yielding matrix)? , d x length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed dztpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(x) columns (drop = FALSE). case vectorized distribution object, matrix length(x) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability mass function of a zero-truncated Poisson distribution — pdf.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Evaluate the probability density of a probability distribution — pdf","title":"Evaluate the probability density of a probability distribution — pdf","text":"Generic function computing probability density function (PDF) contributions based distribution object observed data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Evaluate the probability density of a probability distribution — pdf","text":"","code":"pdf(d, x, drop = TRUE, ...) log_pdf(d, x, ...) pmf(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Evaluate the probability density of a probability distribution — pdf","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector elements whose probabilities like determine given distribution d. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Evaluate the probability density of a probability distribution — pdf","text":"Probabilities corresponding vector x.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Evaluate the probability density of a probability distribution — pdf","text":"generic function pdf() computes probability density, continuous discrete distributions. pmf() (probability mass function) alias just calls pdf() internally. computing log-density contributions (e.g., log-likelihood) either pdf(..., log = TRUE) can used generic function log_pdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/pdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Evaluate the probability density of a probability distribution — pdf","text":"","code":"## distribution object X <- Normal() ## probability density pdf(X, c(1, 2, 3, 4, 5)) #> [1] 2.419707e-01 5.399097e-02 4.431848e-03 1.338302e-04 1.486720e-06 pmf(X, c(1, 2, 3, 4, 5)) #> [1] 2.419707e-01 5.399097e-02 4.431848e-03 1.338302e-04 1.486720e-06 ## log-density pdf(X, c(1, 2, 3, 4, 5), log = TRUE) #> [1] -1.418939 -2.918939 -5.418939 -8.918939 -13.418939 log_pdf(X, c(1, 2, 3, 4, 5)) #> [1] -1.418939 -2.918939 -5.418939 -8.918939 -13.418939"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"Plot method object inheriting class \"distribution\". default probability density function (p.d.f.), continuous variable, probability mass function (p.m.f.), discrete variable, plotted. cumulative distribution function (c.d.f.) plotted cdf = TRUE. Multiple functions included plot parameter vectors x length greater 1. See argument .","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"","code":"# S3 method for class 'distribution' plot( x, cdf = FALSE, p = c(0.1, 99.9), len = 1000, all = FALSE, legend_args = list(), ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"x object class c(\"name\", \"distribution\"), \"name\" name distribution. cdf logical scalar. cdf = TRUE cumulative distribution function (c.d.f.) plotted. Otherwise, probability density function (p.d.f.), continuous variable, probability mass function (p.m.f.), discrete variable, plotted. p numeric vector. xlim passed ... p fallback option setting range values p.m.f, p.d.f. c.d.f plotted. See Details. len integer scalar. x continuous distribution object len number values p.d.f c.d.f. evaluated produce plot. larger len smoother curve. logical scalar. = TRUE separate distribution plotted combinations parameter values present parameter vectors present x. combinations generated using expand.grid. = FALSE number distributions plotted equal maximum lengths parameter vectors, shorter vectors recycled length necessary using rep_len. legend_args list arguments passed legend. particular, argument x (perhaps conjunction legend_args$y) can used set position legend. legend_args$x supplied \"bottomright\" used cdf = TRUE \"topright\" cdf = FALSE. ... arguments passed plot, plot.ecdf lines, xlim, ylim, xlab, ylab, main, lwd, lty, col, pch.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"object class x, parameter vectors expanded contain parameter combination function plotted.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"xlim passed ... determines range values variable plotted horizontal axis. x discrete distribution object values p.m.f. c.d.f. plotted smallest set consecutive integers contains components xlim. Otherwise, xlim used directly. xlim passed ... range values spans support distribution, following proviso: lower (upper) endpoint distribution -Inf (Inf) lower (upper) limit plotting range set p[1]\\ name x single upper case letter name used labels axes plot. Otherwise, x P(X = x) f(x) used. legend included least one parameter vectors x length greater 1. Plots c.d.f.s produced using calls approxfun plot.ecdf.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot.distribution.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot the p.m.f, p.d.f or c.d.f. of a univariate distribution — plot.distribution","text":"","code":"B <- Binomial(20, 0.7) plot(B) plot(B, cdf = TRUE) B2 <- Binomial(20, c(0.1, 0.5, 0.9)) plot(B2, legend_args = list(x = \"top\")) x <- plot(B2, cdf = TRUE) x$size #> [1] 20 20 20 x$p #> [1] 0.1 0.5 0.9 X <- Poisson(2) plot(X) plot(X, cdf = TRUE) G <- Gamma(c(1, 3), 1:2) plot(G) plot(G, all = TRUE) plot(G, cdf = TRUE) C <- Cauchy() plot(C, p = c(1, 99), len = 10000) plot(C, cdf = TRUE, p = c(1, 99))"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot the CDF of a distribution — plot_cdf","title":"Plot the CDF of a distribution — plot_cdf","text":"function easily plot CDF distribution using ggplot2. Requires ggplot2 loaded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot the CDF of a distribution — plot_cdf","text":"","code":"plot_cdf(d, limits = NULL, p = 0.001, plot_theme = NULL)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot the CDF of a distribution — plot_cdf","text":"d distribution object limits either NULL (default) vector length 2 specifies range x-axis p limits NULL, range x-axis support d bounded interval, quantile(d, p) quantile(d, 1 - p) lower /upper limits support -Inf/Inf. Defaults 0.001. plot_theme specify theme resulting plot using ggplot2. Default theme_minimal","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_cdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot the CDF of a distribution — plot_cdf","text":"","code":"N1 <- Normal() plot_cdf(N1) N2 <- Normal(0, c(1, 2)) plot_cdf(N2) B1 <- Binomial(10, 0.2) plot_cdf(B1) B2 <- Binomial(10, c(0.2, 0.5)) plot_cdf(B2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot the PDF of a distribution — plot_pdf","title":"Plot the PDF of a distribution — plot_pdf","text":"function easily plot PDF distribution using ggplot2. Requires ggplot2 loaded.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot the PDF of a distribution — plot_pdf","text":"","code":"plot_pdf(d, limits = NULL, p = 0.001, plot_theme = NULL)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot the PDF of a distribution — plot_pdf","text":"d distribution object limits either NULL (default) vector length 2 specifies range x-axis p limits NULL, range x-axis support d bounded interval, quantile(d, p) quantile(d, 1 - p) lower /upper limits support -Inf/Inf. Defaults 0.001. plot_theme specify theme resulting plot using ggplot2. Default theme_minimal","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/plot_pdf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot the PDF of a distribution — plot_pdf","text":"","code":"N1 <- Normal() plot_pdf(N1) N2 <- Normal(0, c(1, 2)) plot_pdf(N2) B1 <- Binomial(10, 0.2) plot_pdf(B1) B2 <- Binomial(10, c(0.2, 0.5)) plot_pdf(B2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":null,"dir":"Reference","previous_headings":"","what":"Extracting fitted or predicted probability distributions from models — prodist","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"Generic function methods various model classes extracting fitted (-sample) predicted (--sample) probability distributions3 objects.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"","code":"prodist(object, ...) # S3 method for class 'lm' prodist(object, ..., sigma = \"ML\") # S3 method for class 'glm' prodist(object, ..., dispersion = NULL) # S3 method for class 'distribution' prodist(object, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"object model object. ... Arguments passed methods, typically calling underlying predict methods, e.g., newdata lm glm objects n.ahead arima objects. sigma character numeric NULL. Specification standard deviation sigma used Normal distribution lm method. default \"ML\" (equivalently \"MLE\" NULL) uses maximum likelihood estimate based residual sum squares divided number observations, n. Alternatively, sigma = \"OLS\" uses least-squares estimate (divided residual degrees freedom, n - k). Finally, concrete numeric value can also specified sigma. dispersion character numeric NULL. Specification dispersion parameter glm method. default NULL (equivalently \"deviance\") use deviance divided number observations, n. Alternatively, dispersion = \"Chisquared\" uses Chi-squared statistic divided residual degrees freedom, n - k. Finally, concrete numeric value can also specified dispersion.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"object inheriting distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"facilitate making probabilistic forecasts based regression time series model objects, function prodist extracts fitted predicted probability distribution objects. Currently, methods provided objects fitted lm, glm, arima base R well glm.nb MASS package hurdle/zeroinfl/zerotrunc pscl countreg packages. methods essentially proceed two steps: First, standard predict method model objects used compute fitted (-sample, default) predicted (--sample) distribution parameters. Typically, includes mean plus parameters describing scale, dispersion, shape, etc.). Second, distributions objects set using generator functions distributions3. Note probability distributions reflect random variation dependent variable based model employed (associated distributional assumpation dependent variable). capture uncertainty parameter estimates. linear regression models generalized linear models, estimated lm glm respectively, ambiguity estimate dispersion parameter model used. logLik methods use maximum-likelihood (ML) estimate implicitly, summary methods report estimate standardized residual degrees freedom, n - k (rather number observations, n). prodist methods objects follow logLik method default summary behavior can mimicked setting sigma dispersion arguments accordingly.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/prodist.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extracting fitted or predicted probability distributions from models — prodist","text":"","code":"## Model: Linear regression ## Fit: lm ## Data: 1920s cars data data(\"cars\", package = \"datasets\") ## Stopping distance (ft) explained by speed (mph) reg <- lm(dist ~ speed, data = cars) ## Extract fitted normal distributions (in-sample, with constant variance) pd <- prodist(reg) head(pd) #> 1 2 #> \"Normal(mu = -1.849, sigma = 15.07)\" \"Normal(mu = -1.849, sigma = 15.07)\" #> 3 4 #> \"Normal(mu = 9.948, sigma = 15.07)\" \"Normal(mu = 9.948, sigma = 15.07)\" #> 5 6 #> \"Normal(mu = 13.880, sigma = 15.07)\" \"Normal(mu = 17.813, sigma = 15.07)\" ## Extract log-likelihood from model object logLik(reg) #> 'log Lik.' -206.5784 (df=3) ## Replicate log-likelihood via distributions object sum(log_pdf(pd, cars$dist)) #> [1] -206.5784 log_likelihood(pd, cars$dist) #> [1] -206.5784 ## Compute corresponding medians and 90% interval qd <- quantile(pd, c(0.05, 0.5, 0.95)) head(qd) #> q_0.05 q_0.5 q_0.95 #> 1 -26.635522 -1.849460 22.93660 #> 2 -26.635522 -1.849460 22.93660 #> 3 -14.838296 9.947766 34.73383 #> 4 -14.838296 9.947766 34.73383 #> 5 -10.905887 13.880175 38.66624 #> 6 -6.973478 17.812584 42.59865 ## Visualize observations with predicted quantiles plot(dist ~ speed, data = cars) matplot(cars$speed, qd, add = TRUE, type = \"l\", col = 2, lty = 1) ## Sigma estimated by maximum-likelihood estimate (default, used in logLik) ## vs. least-squares estimate (used in summary) nd <- data.frame(speed = 50) prodist(reg, newdata = nd, sigma = \"ML\") #> 1 #> \"Normal(mu = 179, sigma = 15.07)\" prodist(reg, newdata = nd, sigma = \"OLS\") #> 1 #> \"Normal(mu = 179, sigma = 15.38)\" summary(reg)$sigma #> [1] 15.37959 ## Model: Poisson generalized linear model ## Fit: glm ## Data: FIFA 2018 World Cup data data(\"FIFA2018\", package = \"distributions3\") ## Number of goals per team explained by ability differences poisreg <- glm(goals ~ difference, data = FIFA2018, family = poisson) summary(poisreg) #> #> Call: #> glm(formula = goals ~ difference, family = poisson, data = FIFA2018) #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) 0.21272 0.08125 2.618 0.00885 ** #> difference 0.41344 0.10579 3.908 9.31e-05 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 #> #> (Dispersion parameter for poisson family taken to be 1) #> #> Null deviance: 144.20 on 127 degrees of freedom #> Residual deviance: 128.69 on 126 degrees of freedom #> AIC: 359.39 #> #> Number of Fisher Scoring iterations: 5 #> ## Interpretation: When the ratio of abilities increases by 1 percent, ## the expected number of goals increases by around 0.4 percent ## Predict fitted Poisson distributions for teams with equal ability (out-of-sample) nd <- data.frame(difference = 0) prodist(poisreg, newdata = nd) #> 1 #> \"Poisson(lambda = 1.237)\" ## Extract fitted Poisson distributions (in-sample) pd <- prodist(poisreg) head(pd) #> 1 2 #> \"Poisson(lambda = 1.7680)\" \"Poisson(lambda = 0.8655)\" #> 3 4 #> \"Poisson(lambda = 1.0297)\" \"Poisson(lambda = 1.4862)\" #> 5 6 #> \"Poisson(lambda = 1.4354)\" \"Poisson(lambda = 1.0661)\" ## Extract log-likelihood from model object logLik(poisreg) #> 'log Lik.' -177.6971 (df=2) ## Replicate log-likelihood via distributions object sum(log_pdf(pd, FIFA2018$goals)) #> [1] -177.6971 log_likelihood(pd, FIFA2018$goals) #> [1] -177.6971 ## Model: Autoregressive integrated moving average model ## Fit: arima ## Data: Quarterly approval ratings of U.S. presidents (1945-1974) data(\"presidents\", package = \"datasets\") ## ARMA(2,1) model arma21 <- arima(presidents, order = c(2, 0, 1)) ## Extract predicted normal distributions for next two years p <- prodist(arma21, n.ahead = 8) p #> 1975 Qtr1 1975 Qtr2 #> \"Normal(mu = 29.58, sigma = 9.013)\" \"Normal(mu = 32.41, sigma = 11.118)\" #> 1975 Qtr3 1975 Qtr4 #> \"Normal(mu = 36.45, sigma = 12.935)\" \"Normal(mu = 38.61, sigma = 13.821)\" #> 1976 Qtr1 1976 Qtr2 #> \"Normal(mu = 41.54, sigma = 14.648)\" \"Normal(mu = 43.19, sigma = 15.092)\" #> 1976 Qtr3 1976 Qtr4 #> \"Normal(mu = 45.32, sigma = 15.507)\" \"Normal(mu = 46.58, sigma = 15.743)\" ## Compute median (= mean) forecast along with 80% and 95% interval quantile(p, c(0.5, 0.1, 0.9, 0.025, 0.975)) #> q_0.5 q_0.1 q_0.9 q_0.025 q_0.975 #> 1975 Qtr1 29.58398 18.03366 41.13430 11.91929 47.24867 #> 1975 Qtr2 32.40878 18.15989 46.65767 10.61698 54.20058 #> 1975 Qtr3 36.44588 19.86888 53.02287 11.09355 61.79820 #> 1975 Qtr4 38.61415 20.90236 56.32594 11.52630 65.70199 #> 1976 Qtr1 41.53897 22.76708 60.31085 12.82984 70.24809 #> 1976 Qtr2 43.19489 23.85376 62.53602 13.61519 72.77459 #> 1976 Qtr3 45.31799 25.44445 65.19152 14.92404 75.71194 #> 1976 Qtr4 46.57728 26.40232 66.75224 15.72234 77.43222"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"x Bernoulli object created call Bernoulli(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Bernoulli distribution — quantile.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Beta distribution — quantile.Beta","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"","code":"# S3 method for class 'Beta' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"x Beta object created call Beta(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qbeta. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Beta distribution — quantile.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Binomial distribution — quantile.Binomial","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"","code":"# S3 method for class 'Binomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"x Binomial object created call Binomial(). probs vector probabilities. drop logical. Shoul result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Binomial distribution — quantile.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"","code":"# S3 method for class 'Categorical' quantile(x, probs, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"x Categorical object created call Categorical(). probs vector probabilities. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"vector quantiles, one element probs.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Categorical discrete distribution — quantile.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"","code":"# S3 method for class 'Cauchy' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"x Cauchy object created call Cauchy(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qcauchy. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Cauchy distribution — quantile.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a chi square distribution — quantile.ChiSquare","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"x ChiSquare object created call ChiSquare(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qchisq. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a chi square distribution — quantile.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of an Erlang distribution — quantile.Erlang","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"","code":"# S3 method for class 'Erlang' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"x Erlang object created call Erlang(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of an Erlang distribution — quantile.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of an Exponential distribution — quantile.Exponential","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"","code":"# S3 method for class 'Exponential' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"x Exponential object created call Exponential(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qexp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of an Exponential distribution — quantile.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of an F distribution — quantile.FisherF","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"","code":"# S3 method for class 'FisherF' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"x FisherF object created call FisherF(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qf. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of an F distribution — quantile.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Frechet distribution — quantile.Frechet","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"","code":"# S3 method for class 'Frechet' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"x Frechet object created call Frechet(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Frechet distribution — quantile.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a GEV distribution — quantile.GEV","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"","code":"# S3 method for class 'GEV' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"x GEV object created call GEV(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a GEV distribution — quantile.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a GP distribution — quantile.GP","title":"Determine quantiles of a GP distribution — quantile.GP","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a GP distribution — quantile.GP","text":"","code":"# S3 method for class 'GP' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a GP distribution — quantile.GP","text":"x GP object created call GP(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgp. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a GP distribution — quantile.GP","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a GP distribution — quantile.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Gamma distribution — quantile.Gamma","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"","code":"# S3 method for class 'Gamma' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"x Gamma object created call Gamma(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgamma. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Gamma distribution — quantile.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Geometric distribution — quantile.Geometric","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"Determine quantiles Geometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"","code":"# S3 method for class 'Geometric' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"x Geometric object created call Geometric(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgeom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Geometric distribution — quantile.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"","code":"# S3 method for class 'Gumbel' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"x Gumbel object created call Gumbel(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Gumbel distribution — quantile.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"x HurdleNegativeBinomial object created call HurdleNegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qhnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a hurdle negative binomial distribution — quantile.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"x HurdlePoisson object created call HurdlePoisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qhpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a hurdle Poisson distribution — quantile.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"Determine quantiles HyperGeometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"x HyperGeometric object created call HyperGeometric(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qhyper. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a HyperGeometric distribution — quantile.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"Determine quantiles LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"","code":"# S3 method for class 'LogNormal' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"x LogNormal object created call LogNormal(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qlnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a LogNormal distribution — quantile.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Logistic distribution — quantile.Logistic","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"Determine quantiles Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"","code":"# S3 method for class 'Logistic' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"x Logistic object created call Logistic(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qlogis. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Logistic distribution — quantile.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"Determine quantiles NegativeBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"x NegativeBinomial object created call NegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a NegativeBinomial distribution — quantile.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Normal distribution — quantile.Normal","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals. quantile()","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"","code":"# S3 method for class 'Normal' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"x Normal object created call Normal(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qnorm. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"function returns values get Z-table. Note quantile() inverse cdf(). Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Normal distribution — quantile.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Poisson distribution — quantile.Poisson","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"","code":"# S3 method for class 'Poisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"x Poisson object created call Poisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Poisson distribution — quantile.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' quantile( x, probs, drop = TRUE, elementwise = NULL, lower.tail = TRUE, log.p = FALSE, verbose = TRUE, ... )"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"x PoissonBinomial object created call PoissonBinomial(). probs vector probabilities. drop logical. Shoul result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. lower.tail, log.p, ... Arguments passed qpbinom qnorm, respectively. verbose logical. warning issued normal approximation applied PoissonBinomial package installed?","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a PoissonBinomial distribution — quantile.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"x RevWeibull object created call RevWeibull(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qgev. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a RevWeibull distribution — quantile.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"Please see documentation StudentsT() properties StudentsT distribution, well extensive examples showing calculate p-values confidence intervals. quantile()","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"","code":"# S3 method for class 'StudentsT' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"x StudentsT object created call StudentsT(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qt. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"function returns values get Z-table. Note quantile() inverse cdf(). Please see documentation StudentsT() properties StudentsT distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a StudentsT distribution — quantile.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Tukey distribution — quantile.Tukey","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"Determine quantiles Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"","code":"# S3 method for class 'Tukey' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"x vector elements whose cumulative probabilities like determine given distribution d. probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qtukey. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Tukey distribution — quantile.Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"","code":"# S3 method for class 'Uniform' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"x Uniform object created call Uniform(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qunif. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a continuous Uniform distribution — quantile.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a Weibull distribution — quantile.Weibull","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"Determine quantiles Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"","code":"# S3 method for class 'Weibull' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"x Weibull object created call Weibull(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qweibull. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a Weibull distribution — quantile.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"x ZINegativeBinomial object created call ZINegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qzinbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-inflated negative binomial distribution — quantile.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"x ZIPoisson object created call ZIPoisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qzipois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-inflated Poisson distribution — quantile.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"x ZTNegativeBinomial object created call ZTNegativeBinomial(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qztnbinom. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-truncated negative binomial distribution — quantile.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"quantile() inverse cdf().","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' quantile(x, probs, drop = TRUE, elementwise = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"x ZTPoisson object created call ZTPoisson(). probs vector probabilities. drop logical. result simplified vector possible? elementwise logical. distribution x evaluated elements probs (elementwise = FALSE, yielding matrix)? , x probs length, evaluation done element element (elementwise = TRUE, yielding vector)? default NULL means elementwise = TRUE used lengths match otherwise elementwise = FALSE used. ... Arguments passed qztpois. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"case single distribution object, either numeric vector length probs (drop = TRUE, default) matrix length(probs) columns (drop = FALSE). case vectorized distribution object, matrix length(probs) columns containing possible combinations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/quantile.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Determine quantiles of a zero-truncated Poisson distribution — quantile.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"Draw random sample Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"x Bernoulli object created call Bernoulli(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Bernoulli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Bernoulli distribution — random.Bernoulli","text":"","code":"set.seed(27) X <- Bernoulli(0.7) X #> [1] \"Bernoulli(p = 0.7)\" mean(X) #> [1] 0.7 variance(X) #> [1] 0.21 skewness(X) #> [1] -0.8728716 kurtosis(X) #> [1] -1.238095 random(X, 10) #> [1] 0 1 0 1 1 1 1 1 1 1 pdf(X, 1) #> [1] 0.7 log_pdf(X, 1) #> [1] -0.3566749 cdf(X, 0) #> [1] 0.3 quantile(X, 0.7) #> [1] 1 cdf(X, quantile(X, 0.7)) #> [1] 1 quantile(X, cdf(X, 0.7)) #> [1] 0"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Beta distribution — random.Beta","title":"Draw a random sample from a Beta distribution — random.Beta","text":"Draw random sample Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Beta distribution — random.Beta","text":"","code":"# S3 method for class 'Beta' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Beta distribution — random.Beta","text":"x Beta object created call Beta(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Beta distribution — random.Beta","text":"Values [0, 1]. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Beta.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Beta distribution — random.Beta","text":"","code":"set.seed(27) X <- Beta(1, 2) X #> [1] \"Beta(alpha = 1, beta = 2)\" random(X, 10) #> [1] 0.014327255 0.067309943 0.636292291 0.864804440 0.758869543 0.237550867 #> [7] 0.330895959 0.065843704 0.008265406 0.254705779 pdf(X, 0.7) #> [1] 0.6 log_pdf(X, 0.7) #> [1] -0.5108256 cdf(X, 0.7) #> [1] 0.91 quantile(X, 0.7) #> [1] 0.4522774 mean(X) #> [1] 0.3333333 variance(X) #> [1] 0.05555556 skewness(X) #> [1] 1.131371 kurtosis(X) #> [1] -0.6 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Binomial distribution — random.Binomial","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"Draw random sample Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"","code":"# S3 method for class 'Binomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"x Binomial object created call Binomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"Integers containing values 0 x$size. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Binomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Binomial distribution — random.Binomial","text":"","code":"set.seed(27) X <- Binomial(10, 0.2) X #> [1] \"Binomial(size = 10, p = 0.2)\" mean(X) #> [1] 2 variance(X) #> [1] 1.6 skewness(X) #> [1] 0.4743416 kurtosis(X) #> [1] 0.025 random(X, 10) #> [1] 5 0 3 1 1 2 0 0 1 1 pdf(X, 2L) #> [1] 0.3019899 log_pdf(X, 2L) #> [1] -1.197362 cdf(X, 4L) #> [1] 0.9672065 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8791261 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Categorical distribution — random.Categorical","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"Draw random sample Categorical distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"","code":"# S3 method for class 'Categorical' random(x, n = 1L, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"x Categorical object created call Categorical(). n number samples draw. Defaults 1L. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"vector containing values outcomes length n.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Categorical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Categorical distribution — random.Categorical","text":"","code":"set.seed(27) X <- Categorical(1:3, p = c(0.4, 0.1, 0.5)) X #> Categorical distribution #> outcomes = [1, 2, 3] #> p = [0.4, 0.1, 0.5] Y <- Categorical(LETTERS[1:4]) Y #> Categorical distribution #> outcomes = [A, B, ..., D] #> p = [0.25, 0.25, ..., 0.25] random(X, 10) #> [1] 2 3 1 3 3 3 3 3 3 3 random(Y, 10) #> [1] \"D\" \"A\" \"D\" \"D\" \"A\" \"A\" \"A\" \"B\" \"D\" \"B\" pdf(X, 1) #> [1] 0.4 log_pdf(X, 1) #> [1] -0.9162907 cdf(X, 1) #> [1] 0.4 quantile(X, 0.5) #> [1] 2 # cdfs are only defined for numeric sample spaces. this errors! # cdf(Y, \"a\") # same for quantiles. this also errors! # quantile(Y, 0.7)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Cauchy distribution — random.Cauchy","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"Draw random sample Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"","code":"# S3 method for class 'Cauchy' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"x Cauchy object created call Cauchy(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Cauchy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Cauchy distribution — random.Cauchy","text":"","code":"set.seed(27) X <- Cauchy(10, 0.2) X #> [1] \"Cauchy(location = 10, scale = 0.2)\" mean(X) #> [1] NaN variance(X) #> [1] NaN skewness(X) #> [1] NaN kurtosis(X) #> [1] NaN random(X, 10) #> [1] 9.982203 10.053876 9.916324 10.336325 10.167877 10.626557 10.046357 #> [8] 10.001540 10.091892 10.137681 pdf(X, 2) #> [1] 0.0009940971 log_pdf(X, 2) #> [1] -6.913676 cdf(X, 2) #> [1] 0.00795609 quantile(X, 0.7) #> [1] 10.14531 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a chi square distribution — random.ChiSquare","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"Draw random sample chi square distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"x ChiSquare object created call ChiSquare(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ChiSquare.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a chi square distribution — random.ChiSquare","text":"","code":"set.seed(27) X <- ChiSquare(5) X #> [1] \"ChiSquare(df = 5)\" mean(X) #> [1] 5 variance(X) #> [1] 10 skewness(X) #> [1] 1.264911 kurtosis(X) #> [1] 2.4 random(X, 10) #> [1] 11.2129049 7.8935724 2.1298341 5.2084236 5.4563211 3.6636712 #> [7] 10.9823299 0.7858347 4.8748588 1.7938110 pdf(X, 2) #> [1] 0.1383692 log_pdf(X, 2) #> [1] -1.97783 cdf(X, 4) #> [1] 0.450584 quantile(X, 0.7) #> [1] 6.06443 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an Erlang distribution — random.Erlang","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"Draw random sample Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"","code":"# S3 method for class 'Erlang' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"x Erlang object created call Erlang(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Erlang.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an Erlang distribution — random.Erlang","text":"","code":"set.seed(27) X <- Erlang(5, 2) X #> [1] \"Erlang(k = 5, lambda = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an Exponential distribution — random.Exponential","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"Draw random sample Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"","code":"# S3 method for class 'Exponential' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"x Exponential object created call Exponential(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Exponential.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an Exponential distribution — random.Exponential","text":"","code":"set.seed(27) X <- Exponential(5) X #> [1] \"Exponential(rate = 5)\" mean(X) #> [1] 0.2 variance(X) #> [1] 25 skewness(X) #> [1] 2 kurtosis(X) #> [1] 6 random(X, 10) #> [1] 0.01161126 0.28730930 1.15993941 0.29660927 0.38431337 0.04643808 #> [7] 0.06969554 0.10900366 0.50608948 0.03759968 pdf(X, 2) #> [1] 0.0002269996 log_pdf(X, 2) #> [1] -8.390562 cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 0.2407946 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 6.989008"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an F distribution — random.FisherF","title":"Draw a random sample from an F distribution — random.FisherF","text":"Draw random sample F distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an F distribution — random.FisherF","text":"","code":"# S3 method for class 'FisherF' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an F distribution — random.FisherF","text":"x FisherF object created call FisherF(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an F distribution — random.FisherF","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.FisherF.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an F distribution — random.FisherF","text":"","code":"set.seed(27) X <- FisherF(5, 10, 0.2) X #> [1] \"FisherF(df1 = 5, df2 = 10, lambda = 0.2)\" random(X, 10) #> [1] 3.1450634 0.2781146 0.5846266 0.8103721 0.6263227 2.4989529 0.6281965 #> [8] 0.3110039 0.5357005 0.4882204 pdf(X, 2) #> [1] 0.1699603 log_pdf(X, 2) #> [1] -1.77219 cdf(X, 4) #> [1] 0.9667464 quantile(X, 0.7) #> [1] 1.467954 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Frechet distribution — random.Frechet","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"Draw random sample Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"","code":"# S3 method for class 'Frechet' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"x Frechet object created call Frechet(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Frechet.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Frechet distribution — random.Frechet","text":"","code":"set.seed(27) X <- Frechet(0, 2) X #> [1] \"Frechet(location = 0, scale = 2, shape = 1)\" random(X, 10) #> [1] 69.7922625 0.8065071 14.8341823 1.8001889 1.3299308 2.1925530 #> [7] 0.7621402 0.3326917 1.0064977 1.2115825 pdf(X, 0.7) #> [1] 0.2344189 log_pdf(X, 0.7) #> [1] -1.450646 cdf(X, 0.7) #> [1] 0.05743262 quantile(X, 0.7) #> [1] 5.607347 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a GEV distribution — random.GEV","title":"Draw a random sample from a GEV distribution — random.GEV","text":"Draw random sample GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a GEV distribution — random.GEV","text":"","code":"# S3 method for class 'GEV' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a GEV distribution — random.GEV","text":"x GEV object created call GEV(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a GEV distribution — random.GEV","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GEV.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a GEV distribution — random.GEV","text":"","code":"set.seed(27) X <- GEV(1, 2, 0.1) X #> [1] \"GEV(mu = 1, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 9.53039102 -0.73633998 5.43730770 0.79059280 0.20038342 1.18468635 #> [7] -0.83938790 -2.28404509 -0.32725032 0.02226797 pdf(X, 0.7) #> [1] 0.1845098 log_pdf(X, 0.7) #> [1] -1.690052 cdf(X, 0.7) #> [1] 0.3124986 quantile(X, 0.7) #> [1] 3.171891 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a GP distribution — random.GP","title":"Draw a random sample from a GP distribution — random.GP","text":"Draw random sample GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a GP distribution — random.GP","text":"","code":"# S3 method for class 'GP' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a GP distribution — random.GP","text":"x GP object created call GP(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a GP distribution — random.GP","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.GP.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a GP distribution — random.GP","text":"","code":"set.seed(27) X <- GP(0, 2, 0.1) X #> [1] \"GP(mu = 0, sigma = 2, xi = 0.1)\" random(X, 10) #> [1] 8.571201574 0.175715851 4.600737645 0.814822940 0.509138521 1.053986338 #> [7] 0.151089620 0.004907082 0.297083889 0.430734122 pdf(X, 0.7) #> [1] 0.3424729 log_pdf(X, 0.7) #> [1] -1.071563 cdf(X, 0.7) #> [1] 0.2910812 quantile(X, 0.7) #> [1] 2.558897 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Gamma distribution — random.Gamma","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"Draw random sample Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"","code":"# S3 method for class 'Gamma' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"x Gamma object created call Gamma(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gamma.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Gamma distribution — random.Gamma","text":"","code":"set.seed(27) X <- Gamma(5, 2) X #> [1] \"Gamma(shape = 5, rate = 2)\" random(X, 10) #> [1] 4.727510 3.628168 1.512156 4.771854 2.257310 3.645070 5.083710 2.509344 #> [9] 1.093361 2.021506 pdf(X, 2) #> [1] 0.3907336 log_pdf(X, 2) #> [1] -0.9397292 cdf(X, 4) #> [1] 0.9003676 quantile(X, 0.7) #> [1] 2.945181 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Geometric distribution — random.Geometric","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"Please see documentation Geometric() properties Geometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"","code":"# S3 method for class 'Geometric' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"x Geometric object created call Geometric(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Geometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Geometric distribution — random.Geometric","text":"","code":"set.seed(27) X <- Geometric(0.3) X #> [1] \"Geometric(p = 0.3)\" random(X, 10) #> [1] 0 1 9 2 4 6 4 2 3 1 pdf(X, 2) #> [1] 0.147 log_pdf(X, 2) #> [1] -1.917323 cdf(X, 4) #> [1] 0.83193 quantile(X, 0.7) #> [1] 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Gumbel distribution — random.Gumbel","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"Draw random sample Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"","code":"# S3 method for class 'Gumbel' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"x Gumbel object created call Gumbel(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Gumbel.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Gumbel distribution — random.Gumbel","text":"","code":"set.seed(27) X <- Gumbel(1, 2) X #> [1] \"Gumbel(mu = 1, sigma = 2)\" random(X, 10) #> [1] 8.104751940 -0.816379582 5.007573903 0.789488808 0.183959497 #> [6] 1.183838833 -0.929543900 -2.587372533 -0.373340977 -0.002439646 pdf(X, 0.7) #> [1] 0.1817758 log_pdf(X, 0.7) #> [1] -1.704981 cdf(X, 0.7) #> [1] 0.3129117 quantile(X, 0.7) #> [1] 3.061861 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"Draw random sample hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"x HurdleNegativeBinomial object created call HurdleNegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdleNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a hurdle negative binomial distribution — random.HurdleNegativeBinomial","text":"","code":"## set up a hurdle negative binomial distribution X <- HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75) X #> [1] \"HurdleNegativeBinomial(mu = 2.5, theta = 1, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.25000000 0.21428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 #> [8] 0.02845935 0.02032811 cdf(X, 0:8) #> [1] 0.2500000 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 #> [8] 0.9288516 0.9491797 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"Draw random sample hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"x HurdlePoisson object created call HurdlePoisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HurdlePoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a hurdle Poisson distribution — random.HurdlePoisson","text":"","code":"## set up a hurdle Poisson distribution X <- HurdlePoisson(lambda = 2.5, pi = 0.75) X #> [1] \"HurdlePoisson(lambda = 2.5, pi = 0.75)\" ## standard functions pdf(X, 0:8) #> [1] 0.250000000 0.167672793 0.209590992 0.174659160 0.109161975 0.054580987 #> [7] 0.022742078 0.008122171 0.002538178 cdf(X, 0:8) #> [1] 0.2500000 0.4176728 0.6272638 0.8019229 0.9110849 0.9656659 0.9884080 #> [8] 0.9965302 0.9990683 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"Please see documentation HyperGeometric() properties HyperGeometric distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"x HyperGeometric object created call HyperGeometric(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.HyperGeometric.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a HyperGeometric distribution — random.HyperGeometric","text":"","code":"set.seed(27) X <- HyperGeometric(4, 5, 8) X #> [1] \"HyperGeometric(m = 4, n = 5, k = 8)\" random(X, 10) #> [1] 3 4 3 4 4 4 4 4 4 4 pdf(X, 2) #> [1] 0 log_pdf(X, 2) #> [1] -Inf cdf(X, 4) #> [1] 1 quantile(X, 0.7) #> [1] 4"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a LogNormal distribution — random.LogNormal","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"Draw random sample LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"","code":"# S3 method for class 'LogNormal' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"x LogNormal object created call LogNormal(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.LogNormal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a LogNormal distribution — random.LogNormal","text":"","code":"set.seed(27) X <- LogNormal(0.3, 2) X #> [1] \"LogNormal(log_mu = 0.3, log_sigma = 2)\" random(X, 10) #> [1] 61.21089083 13.32648994 0.29256703 0.07317767 0.15153514 2.43630473 #> [7] 1.36857751 13.66478070 96.47421603 2.17208867 pdf(X, 2) #> [1] 0.09782712 log_pdf(X, 2) #> [1] -2.324553 cdf(X, 4) #> [1] 0.7064858 quantile(X, 0.7) #> [1] 3.852803"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Logistic distribution — random.Logistic","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"Draw random sample Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"","code":"# S3 method for class 'Logistic' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"x Logistic object created call Logistic(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Logistic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Logistic distribution — random.Logistic","text":"","code":"set.seed(27) X <- Logistic(2, 4) X #> [1] \"Logistic(location = 2, scale = 4)\" random(X, 10) #> [1] 16.1520541 -7.5694209 9.7424712 -0.8466541 -3.0098187 0.4055911 #> [7] -8.1957130 -22.0364748 -5.3585558 -3.7506119 pdf(X, 2) #> [1] 0.0625 log_pdf(X, 2) #> [1] -2.772589 cdf(X, 4) #> [1] 0.6224593 quantile(X, 0.7) #> [1] 5.389191"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Multinomial distribution — random.Multinomial","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"Draw random sample Multinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"","code":"# S3 method for class 'Multinomial' random(x, n = 1L, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"x Multinomial object created call Multinomial(). n number samples draw. Defaults 1L. ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"integer vector length n.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Multinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Multinomial distribution — random.Multinomial","text":"","code":"set.seed(27) X <- Multinomial(size = 5, p = c(0.3, 0.4, 0.2, 0.1)) X #> Multinomial distribution (size = 5, p = [0.3, 0.4, ..., 0.1]) random(X, 10) #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 4 3 1 0 2 2 4 2 0 1 #> [2,] 1 1 4 4 1 1 1 3 1 1 #> [3,] 0 1 0 1 1 1 0 0 3 3 #> [4,] 0 0 0 0 1 1 0 0 1 0 # pdf(X, 2) # log_pdf(X, 2)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"Draw random sample negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"x NegativeBinomial object created call NegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.NegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a negative binomial distribution — random.NegativeBinomial","text":"","code":"set.seed(27) X <- NegativeBinomial(size = 5, p = 0.1) X #> [1] \"NegativeBinomial(size = 5, p = 0.1)\" random(X, 10) #> [1] 95 37 48 93 18 16 32 43 27 17 pdf(X, 50) #> [1] 0.01629887 log_pdf(X, 50) #> [1] -4.11666 cdf(X, 50) #> [1] 0.6548517 quantile(X, 0.7) #> [1] 53 ## alternative parameterization of X Y <- NegativeBinomial(mu = 45, size = 5) Y #> [1] \"NegativeBinomial(mu = 45, size = 5)\" cdf(Y, 50) #> [1] 0.6548517 quantile(Y, 0.7) #> [1] 53"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Normal distribution — random.Normal","title":"Draw a random sample from a Normal distribution — random.Normal","text":"Please see documentation Normal() properties Normal distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Normal distribution — random.Normal","text":"","code":"# S3 method for class 'Normal' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Normal distribution — random.Normal","text":"x Normal object created call Normal(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Normal distribution — random.Normal","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Normal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Normal distribution — random.Normal","text":"","code":"set.seed(27) X <- Normal(5, 2) X #> [1] \"Normal(mu = 5, sigma = 2)\" mean(X) #> [1] 5 variance(X) #> [1] 4 skewness(X) #> [1] 0 kurtosis(X) #> [1] 0 random(X, 10) #> [1] 8.814325 7.289754 3.470939 2.085135 2.813062 5.590482 5.013772 7.314822 #> [9] 9.269276 5.475689 pdf(X, 2) #> [1] 0.0647588 log_pdf(X, 2) #> [1] -2.737086 cdf(X, 4) #> [1] 0.3085375 quantile(X, 0.7) #> [1] 6.048801 ### example: calculating p-values for two-sided Z-test # here the null hypothesis is H_0: mu = 3 # and we assume sigma = 2 # exactly the same as: Z <- Normal(0, 1) Z <- Normal() # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the z-statistic z_stat <- (mean(x) - 3) / (2 / sqrt(nx)) z_stat #> [1] 2.371708 # calculate the two-sided p-value 1 - cdf(Z, abs(z_stat)) + cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # exactly equivalent to the above 2 * cdf(Z, -abs(z_stat)) #> [1] 0.01770607 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(Z, z_stat) #> [1] 0.008853033 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(Z, z_stat) #> [1] 0.991147 ### example: calculating a 88 percent Z CI for a mean # same `x` as before, still assume `sigma = 2` # lower-bound mean(x) - quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 # upper-bound mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 # equivalent to mean(x) + c(-1, 1) * quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 5.483325 # also equivalent to mean(x) + quantile(Z, 0.12 / 2) * 2 / sqrt(nx) #> [1] 3.516675 mean(x) + quantile(Z, 1 - 0.12 / 2) * 2 / sqrt(nx) #> [1] 5.483325 ### generating random samples and plugging in ks.test() set.seed(27) # generate a random sample ns <- random(Normal(3, 7), 26) # test if sample is Normal(3, 7) ks.test(ns, pnorm, mean = 3, sd = 7) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.20352, p-value = 0.2019 #> alternative hypothesis: two-sided #> # test if sample is gamma(8, 3) using base R pgamma() ks.test(ns, pgamma, shape = 8, rate = 3) #> #> \tExact one-sample Kolmogorov-Smirnov test #> #> data: ns #> D = 0.46154, p-value = 1.37e-05 #> alternative hypothesis: two-sided #> ### MISC # note that the cdf() and quantile() functions are inverses cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Poisson distribution — random.Poisson","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"Draw random sample Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"","code":"# S3 method for class 'Poisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"x Poisson object created call Poisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Poisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Poisson distribution — random.Poisson","text":"","code":"set.seed(27) X <- Poisson(2) X #> [1] \"Poisson(lambda = 2)\" random(X, 10) #> [1] 5 0 4 1 1 1 0 0 1 1 pdf(X, 2) #> [1] 0.2706706 log_pdf(X, 2) #> [1] -1.306853 cdf(X, 4) #> [1] 0.947347 quantile(X, 0.7) #> [1] 3 cdf(X, quantile(X, 0.7)) #> [1] 0.8571235 quantile(X, cdf(X, 7)) #> [1] 7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"Draw random sample PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"x PoissonBinomial object created call PoissonBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"Integers containing values 0 x$size. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.PoissonBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a PoissonBinomial distribution — random.PoissonBinomial","text":"","code":"set.seed(27) X <- PoissonBinomial(0.5, 0.3, 0.8) X #> [1] \"PoissonBinomial(p1 = 0.5, p2 = 0.3, p3 = 0.8)\" mean(X) #> [1] 1.6 variance(X) #> [1] 0.62 skewness(X) #> [1] -0.02458067 kurtosis(X) #> [1] -0.4505723 random(X, 10) #> [1] 0 2 3 2 2 2 2 2 2 2 pdf(X, 2) #> [1] 0.43 log_pdf(X, 2) #> [1] -0.8439701 cdf(X, 2) #> [1] 0.88 quantile(X, 0.8) #> [1] 2 cdf(X, quantile(X, 0.8)) #> [1] 0.88 quantile(X, cdf(X, 2)) #> [1] 2 ## equivalent definitions of four Poisson binomial distributions ## each summing up three Bernoulli probabilities p <- cbind( p1 = c(0.1, 0.2, 0.1, 0.2), p2 = c(0.5, 0.5, 0.5, 0.5), p3 = c(0.8, 0.7, 0.9, 0.8)) PoissonBinomial(p) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1], p[, 2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\" PoissonBinomial(p[, 1:2], p[, 3]) #> [1] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.8)\" #> [2] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.7)\" #> [3] \"PoissonBinomial(p1 = 0.1, p2 = 0.5, p3 = 0.9)\" #> [4] \"PoissonBinomial(p1 = 0.2, p2 = 0.5, p3 = 0.8)\""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"Draw random sample RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"x RevWeibull object created call RevWeibull(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.RevWeibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from an RevWeibull distribution — random.RevWeibull","text":"","code":"set.seed(27) X <- RevWeibull(1, 2) X #> [1] \"RevWeibull(location = 1, scale = 2, shape = 1)\" random(X, 10) #> [1] 0.9426871 -3.9596589 0.7303525 -1.2219891 -2.0076752 -0.8243573 #> [7] -4.2483783 -11.0231439 -2.9741769 -2.3014673 pdf(X, 0.7) #> [1] 0.430354 log_pdf(X, 0.7) #> [1] -0.8431472 cdf(X, 0.7) #> [1] 0.860708 quantile(X, 0.7) #> [1] 0.2866501 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 0.7"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a StudentsT distribution — random.StudentsT","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"Please see documentation StudentsT() properties T distribution, well extensive examples showing calculate p-values confidence intervals.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"","code":"# S3 method for class 'StudentsT' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"x StudentsT object created call StudentsT(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.StudentsT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a StudentsT distribution — random.StudentsT","text":"","code":"set.seed(27) X <- StudentsT(3) X #> [1] \"StudentsT(df = 3)\" random(X, 10) #> [1] 1.4854556 -0.3809239 -1.8376741 0.1105147 0.3005249 0.1558420 #> [7] -1.5135073 -0.6088114 -2.4080689 -1.1878884 pdf(X, 2) #> [1] 0.06750966 log_pdf(X, 2) #> [1] -2.695485 cdf(X, 4) #> [1] 0.9859958 quantile(X, 0.7) #> [1] 0.5843897 ### example: calculating p-values for two-sided T-test # here the null hypothesis is H_0: mu = 3 # data to test x <- c(3, 7, 11, 0, 7, 0, 4, 5, 6, 2) nx <- length(x) # calculate the T-statistic t_stat <- (mean(x) - 3) / (sd(x) / sqrt(nx)) t_stat #> [1] 1.378916 # null distribution of statistic depends on sample size! T <- StudentsT(df = nx - 1) # calculate the two-sided p-value 1 - cdf(T, abs(t_stat)) + cdf(T, -abs(t_stat)) #> [1] 0.2012211 # exactly equivalent to the above 2 * cdf(T, -abs(t_stat)) #> [1] 0.2012211 # p-value for one-sided test # H_0: mu <= 3 vs H_A: mu > 3 1 - cdf(T, t_stat) #> [1] 0.1006105 # p-value for one-sided test # H_0: mu >= 3 vs H_A: mu < 3 cdf(T, t_stat) #> [1] 0.8993895 ### example: calculating a 88 percent T CI for a mean # lower-bound mean(x) - quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 # upper-bound mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402 # equivalent to mean(x) + c(-1, 1) * quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 6.368402 # also equivalent to mean(x) + quantile(T, 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 2.631598 mean(x) + quantile(T, 1 - 0.12 / 2) * sd(x) / sqrt(nx) #> [1] 6.368402"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Tukey distribution — random.Tukey","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"Draw random sample Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"","code":"# S3 method for class 'Tukey' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"x Tukey object created call Tukey(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Tukey.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Tukey distribution — random.Tukey","text":"","code":"set.seed(27) X <- Tukey(4L, 16L, 2L) X #> [1] \"Tukey(nmeans = 4, df = 16, nranges = 2)\" cdf(X, 4) #> [1] 0.9009192 quantile(X, 0.7) #> [1] 3.075961"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a continuous Uniform distribution — random.Uniform","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"Draw random sample continuous Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"","code":"# S3 method for class 'Uniform' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"x Uniform object created call Uniform(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"Values [, b]. case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Uniform.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a continuous Uniform distribution — random.Uniform","text":"","code":"set.seed(27) X <- Uniform(1, 2) X #> [1] \"Uniform(a = 1, b = 2)\" random(X, 10) #> [1] 1.971750 1.083758 1.873870 1.329231 1.222276 1.401648 1.072499 1.002450 #> [9] 1.137094 1.191909 pdf(X, 0.7) #> [1] 0 log_pdf(X, 0.7) #> [1] -Inf cdf(X, 0.7) #> [1] 0 quantile(X, 0.7) #> [1] 1.7 cdf(X, quantile(X, 0.7)) #> [1] 0.7 quantile(X, cdf(X, 0.7)) #> [1] 1"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a Weibull distribution — random.Weibull","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"Draw random sample Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"","code":"# S3 method for class 'Weibull' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"x Weibull object created call Weibull(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.Weibull.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a Weibull distribution — random.Weibull","text":"","code":"set.seed(27) X <- Weibull(0.3, 2) X #> [1] \"Weibull(shape = 0.3, scale = 2)\" random(X, 10) #> [1] 1.440254e-05 4.128282e+01 2.513340e-03 2.840554e+00 7.792913e+00 #> [6] 1.472187e+00 4.985175e+01 7.900541e+02 1.972819e+01 1.063212e+01 pdf(X, 2) #> [1] 0.05518192 log_pdf(X, 2) #> [1] -2.89712 cdf(X, 4) #> [1] 0.7080417 quantile(X, 0.7) #> [1] 3.713233"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"Draw random sample zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"x ZINegativeBinomial object created call ZINegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZINegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-inflated negative binomial distribution — random.ZINegativeBinomial","text":"","code":"## set up a zero-inflated negative binomial distribution X <- ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25) X #> [1] \"ZINegativeBinomial(mu = 2.5, theta = 1, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.46428571 0.15306122 0.10932945 0.07809246 0.05578033 0.03984309 0.02845935 #> [8] 0.02032811 0.01452008 cdf(X, 0:8) #> [1] 0.4642857 0.6173469 0.7266764 0.8047688 0.8605492 0.9003923 0.9288516 #> [8] 0.9491797 0.9636998 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 1 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"Draw random sample zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"x ZIPoisson object created call ZIPoisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZIPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-inflated Poisson distribution — random.ZIPoisson","text":"","code":"## set up a zero-inflated Poisson distribution X <- ZIPoisson(lambda = 2.5, pi = 0.25) X #> [1] \"ZIPoisson(lambda = 2.5, pi = 0.25)\" ## standard functions pdf(X, 0:8) #> [1] 0.311563749 0.153909372 0.192386716 0.160322263 0.100201414 0.050100707 #> [7] 0.020875295 0.007455462 0.002329832 cdf(X, 0:8) #> [1] 0.3115637 0.4654731 0.6578598 0.8181821 0.9183835 0.9684842 0.9893595 #> [8] 0.9968150 0.9991448 quantile(X, seq(0, 1, by = 0.25)) #> [1] 0 0 2 3 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"Draw random sample zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"x ZTNegativeBinomial object created call ZTNegativeBinomial(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTNegativeBinomial.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-truncated negative binomial distribution — random.ZTNegativeBinomial","text":"","code":"## set up a zero-truncated negative binomial distribution X <- ZTNegativeBinomial(mu = 2.5, theta = 1) X #> [1] \"ZTNegativeBinomial(mu = 2.5, theta = 1)\" ## standard functions pdf(X, 0:8) #> [1] 0.00000000 0.28571429 0.20408163 0.14577259 0.10412328 0.07437377 0.05312412 #> [8] 0.03794580 0.02710414 cdf(X, 0:8) #> [1] 0.0000000 0.2857143 0.4897959 0.6355685 0.7396918 0.8140656 0.8671897 #> [8] 0.9051355 0.9322396 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 1 3 5 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"Draw random sample zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' random(x, n = 1L, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"x ZTPoisson object created call ZTPoisson(). n number samples draw. Defaults 1L. drop logical. result simplified vector possible? ... Unused. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"case single distribution object n = 1, either numeric vector length n (drop = TRUE, default) matrix n columns (drop = FALSE).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.ZTPoisson.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a zero-truncated Poisson distribution — random.ZTPoisson","text":"","code":"## set up a zero-truncated Poisson distribution X <- ZTPoisson(lambda = 2.5) X #> [1] \"ZTPoisson(lambda = 2.5)\" ## standard functions pdf(X, 0:8) #> [1] 0.000000000 0.223563725 0.279454656 0.232878880 0.145549300 0.072774650 #> [7] 0.030322771 0.010829561 0.003384238 cdf(X, 0:8) #> [1] 0.0000000 0.2235637 0.5030184 0.7358973 0.8814466 0.9542212 0.9845440 #> [8] 0.9953735 0.9987578 quantile(X, seq(0, 1, by = 0.25)) #> [1] 1 2 2 4 Inf ## cdf() and quantile() are inverses for each other quantile(X, cdf(X, 3)) #> [1] 3 ## density visualization plot(0:8, pdf(X, 0:8), type = \"h\", lwd = 2) ## corresponding sample with histogram of empirical frequencies set.seed(0) x <- random(X, 500) hist(x, breaks = -1:max(x) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":null,"dir":"Reference","previous_headings":"","what":"Draw a random sample from a probability distribution — random","title":"Draw a random sample from a probability distribution — random","text":"Generic function drawing random samples distribution objects.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Draw a random sample from a probability distribution — random","text":"","code":"random(x, n = 1L, drop = TRUE, ...) # S3 method for class 'distribution' simulate(object, nsim = 1L, seed = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Draw a random sample from a probability distribution — random","text":"x, object object. package provides methods distribution objects Normal() Binomial() etc. n, nsim number samples draw. positive integer. Defaults 1L. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors. seed optional random seed set using set.seed prior drawing random sample. previous random seed global environment () restored afterwards.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Draw a random sample from a probability distribution — random","text":"Random samples drawn distriubtion x. random methods typically return either matrix , possible, vector. simulate method always returns data frame (attribute \"seed\" containing .Random.seed simulation).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Draw a random sample from a probability distribution — random","text":"random new generic drawing random samples S3 distribution objects provided package, Normal Binomial etc. respective methods typically call \"r\" function corresponding distribution functions provided base R rnorm, rbinom etc. addition new random generic also simulate method distribution objects simply calls random method internally.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/random.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Draw a random sample from a probability distribution — random","text":"","code":"## distribution object X <- Normal() ## 10 random samples random(X, 10) #> [1] 0.295241218 0.006885942 1.157410886 2.134637891 0.237844613 #> [6] -1.285127357 0.034827247 1.570295342 0.158010051 -0.745799472"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate responses from fitted model objects — simulate.default","title":"Simulate responses from fitted model objects — simulate.default","text":"Default method simulating new responses model object prodist method (extracting probability distribution object).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate responses from fitted model objects — simulate.default","text":"","code":"# Default S3 method simulate(object, nsim = 1, seed = NULL, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate responses from fitted model objects — simulate.default","text":"object object prodist method available. nsim number response vectors simulate. positive integer. Defaults 1. seed optional random seed set using set.seed prior drawing random sample. previous random seed global environment () restored afterwards. ... Arguments passed simulate.distribution.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate responses from fitted model objects — simulate.default","text":"data frame attribute \"seed\" containing .Random.seed simulation.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate responses from fitted model objects — simulate.default","text":"default method simply combines two building blocks provided package: (1) prodist extracting probability distribution fitted model object, (2) simulate.distribution simulating new observations distribution (internally calling random). Thus, enables simulation fitted model object provides prodist method. waives need implement dedicated simulate method model class.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/simulate.default.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate responses from fitted model objects — simulate.default","text":"","code":"## Poisson GLM for FIFA 2018 goals data(\"FIFA2018\", package = \"distributions3\") m <- glm(goals ~ difference, data = FIFA2018, family = poisson) ## simulate new goals via glm method set.seed(0) g_glm <- simulate(m, n = 3) ## alternatively use the new default method set.seed(0) g_default <- simulate.default(m, n = 3) ## same results all.equal(g_glm, g_default, check.attributes = FALSE) #> [1] TRUE"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"Compute sufficient statistics Bernoulli distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"d Bernoulli object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Bernoulli distribution from data — suff_stat.Bernoulli","text":"named list sufficient statistics Bernoulli distribution: successes: number successful trials (sum(x == 1)) failures: number failed trials (sum(x == 0)).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"Compute sufficient statistics Binomial distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"","code":"# S3 method for class 'Binomial' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"d Binomial object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for the Binomial distribution from data — suff_stat.Binomial","text":"named list sufficient statistics Binomial distribution: successes: total number successful trials. experiments: number experiments run. trials: number trials run per experiment.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"Compute sufficient statistics Exponential distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"","code":"# S3 method for class 'Exponential' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"d Exponential object created call Exponential(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics of an Exponential distribution from data — suff_stat.Exponential","text":"named list sufficient statistics exponential distribution: sum: sum observations. samples: number observations.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"sum: sum data. log_sum: log sum data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"","code":"# S3 method for class 'Gamma' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"d Gamma object created call Gamma(). x vector fit Gamma distribution . ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Gamma distribution from data — suff_stat.Gamma","text":"Gamma object","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"Compute sufficient statistics Geometric distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"","code":"# S3 method for class 'Geometric' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"d Geometric object. x vector zeroes ones. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for the Geometric distribution from data — suff_stat.Geometric","text":"named list sufficient statistics Geometric distribution: trials: total number trials ran first success. experiments: number experiments run.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"Compute sufficient statistics Log-normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"","code":"# S3 method for class 'LogNormal' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"d LogNormal object created call LogNormal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Log-normal distribution from data — suff_stat.LogNormal","text":"named list sufficient statistics normal distribution: mu: sample mean log data. sigma: sample standard deviation log data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"Compute sufficient statistics Normal distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"","code":"# S3 method for class 'Normal' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"d Normal object created call Normal(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics for a Normal distribution from data — suff_stat.Normal","text":"named list sufficient statistics normal distribution: mu: sample mean data. sigma: sample standard deviation data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"Compute sufficient statistics Poisson distribution data","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"","code":"# S3 method for class 'Poisson' suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"d Poisson object created call Poisson(). x vector data. ... Unused.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics of an Poisson distribution from data — suff_stat.Poisson","text":"named list sufficient statistics Poisson distribution: sum: sum data. samples: number samples data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the sufficient statistics of a distribution from data — suff_stat","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"Generic function computing sufficient statistics distribution based empirical data.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"","code":"suff_stat(d, x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"d object. package provides methods distribution objects Normal() Binomial() etc. x vector data compute likelihood. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"named list sufficient statistics","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/suff_stat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute the sufficient statistics of a distribution from data — suff_stat","text":"","code":"X <- Normal() suff_stat(X, c(-1, 0, 0, 0, 3)) #> $mu #> [1] 0.4 #> #> $sigma #> [1] 1.516575 #> #> $samples #> [1] 5 #>"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Bernoulli distribution — support.Bernoulli","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"Return support Bernoulli distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"","code":"# S3 method for class 'Bernoulli' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"d Bernoulli object created call Bernoulli(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Bernoulli.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Bernoulli distribution — support.Bernoulli","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Beta distribution — support.Beta","title":"Return the support of the Beta distribution — support.Beta","text":"Return support Beta distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Beta distribution — support.Beta","text":"","code":"# S3 method for class 'Beta' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Beta distribution — support.Beta","text":"d Beta object created call Beta(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Beta.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Beta distribution — support.Beta","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Binomial distribution — support.Binomial","title":"Return the support of the Binomial distribution — support.Binomial","text":"Return support Binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Binomial distribution — support.Binomial","text":"","code":"# S3 method for class 'Binomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Binomial distribution — support.Binomial","text":"d Binomial object created call Binomial(). drop logical. Shoul result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Binomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Binomial distribution — support.Binomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Cauchy distribution — support.Cauchy","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"Return support Cauchy distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"","code":"# S3 method for class 'Cauchy' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"d Cauchy object created call Cauchy(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Cauchy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Cauchy distribution — support.Cauchy","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the ChiSquare distribution — support.ChiSquare","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"Return support ChiSquare distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"","code":"# S3 method for class 'ChiSquare' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"d ChiSquare object created call ChiSquare(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ChiSquare.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the ChiSquare distribution — support.ChiSquare","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Erlang distribution — support.Erlang","title":"Return the support of the Erlang distribution — support.Erlang","text":"Return support Erlang distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Erlang distribution — support.Erlang","text":"","code":"# S3 method for class 'Erlang' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Erlang distribution — support.Erlang","text":"d Erlang object created call Erlang(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Erlang.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Erlang distribution — support.Erlang","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Exponential distribution — support.Exponential","title":"Return the support of the Exponential distribution — support.Exponential","text":"Return support Exponential distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Exponential distribution — support.Exponential","text":"","code":"# S3 method for class 'Exponential' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Exponential distribution — support.Exponential","text":"d Exponential object created call Exponential(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Exponential.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Exponential distribution — support.Exponential","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the FisherF distribution — support.FisherF","title":"Return the support of the FisherF distribution — support.FisherF","text":"Return support FisherF distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the FisherF distribution — support.FisherF","text":"","code":"# S3 method for class 'FisherF' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the FisherF distribution — support.FisherF","text":"d FisherF object created call FisherF(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.FisherF.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the FisherF distribution — support.FisherF","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Frechet distribution — support.Frechet","title":"Return the support of the Frechet distribution — support.Frechet","text":"Return support Frechet distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Frechet distribution — support.Frechet","text":"","code":"# S3 method for class 'Frechet' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Frechet distribution — support.Frechet","text":"d Frechet object created call Frechet(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Frechet.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Frechet distribution — support.Frechet","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of a GEV distribution — support.GEV","title":"Return the support of a GEV distribution — support.GEV","text":"Return support GEV distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of a GEV distribution — support.GEV","text":"","code":"# S3 method for class 'GEV' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of a GEV distribution — support.GEV","text":"d GEV object created call GEV(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GEV.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of a GEV distribution — support.GEV","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the GP distribution — support.GP","title":"Return the support of the GP distribution — support.GP","text":"Return support GP distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the GP distribution — support.GP","text":"","code":"# S3 method for class 'GP' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the GP distribution — support.GP","text":"d GP object created call GP(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.GP.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the GP distribution — support.GP","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Gamma distribution — support.Gamma","title":"Return the support of the Gamma distribution — support.Gamma","text":"Return support Gamma distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Gamma distribution — support.Gamma","text":"","code":"# S3 method for class 'Gamma' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Gamma distribution — support.Gamma","text":"d Gamma object created call Gamma(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gamma.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Gamma distribution — support.Gamma","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Geometric distribution — support.Geometric","title":"Return the support of the Geometric distribution — support.Geometric","text":"Return support Geometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Geometric distribution — support.Geometric","text":"","code":"# S3 method for class 'Geometric' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Geometric distribution — support.Geometric","text":"d Geometric object created call Geometric(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Geometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Geometric distribution — support.Geometric","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Gumbel distribution — support.Gumbel","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"Return support Gumbel distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"","code":"# S3 method for class 'Gumbel' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"d Gumbel object created call Gumbel(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Gumbel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Gumbel distribution — support.Gumbel","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"Return support hurdle negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"","code":"# S3 method for class 'HurdleNegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"d HurdleNegativeBinomial object created call HurdleNegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdleNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the hurdle negative binomial distribution — support.HurdleNegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"Return support hurdle Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"","code":"# S3 method for class 'HurdlePoisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"d HurdlePoisson object created call HurdlePoisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HurdlePoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the hurdle Poisson distribution — support.HurdlePoisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the HyperGeometric distribution — support.HyperGeometric","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"Return support HyperGeometric distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"","code":"# S3 method for class 'HyperGeometric' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"d HyperGeometric object created call HyperGeometric(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.HyperGeometric.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the HyperGeometric distribution — support.HyperGeometric","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the LogNormal distribution — support.LogNormal","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"Return support LogNormal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"","code":"# S3 method for class 'LogNormal' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"d LogNormal object created call LogNormal(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.LogNormal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the LogNormal distribution — support.LogNormal","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Logistic distribution — support.Logistic","title":"Return the support of the Logistic distribution — support.Logistic","text":"Return support Logistic distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Logistic distribution — support.Logistic","text":"","code":"# S3 method for class 'Logistic' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Logistic distribution — support.Logistic","text":"d Logistic object created call Logistic(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Logistic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Logistic distribution — support.Logistic","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"Return support NegativeBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"","code":"# S3 method for class 'NegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"d NegativeBinomial object created call NegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.NegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the NegativeBinomial distribution — support.NegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Normal distribution — support.Normal","title":"Return the support of the Normal distribution — support.Normal","text":"Return support Normal distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Normal distribution — support.Normal","text":"","code":"# S3 method for class 'Normal' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Normal distribution — support.Normal","text":"d Normal object created call Normal(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Normal.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Normal distribution — support.Normal","text":"case single distribution object, numeric vector length 2 minimum maximum value support (drop = TRUE, default) matrix 2 columns. case vectorized distribution object, matrix 2 columns containing minima maxima.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Poisson distribution — support.Poisson","title":"Return the support of the Poisson distribution — support.Poisson","text":"Return support Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Poisson distribution — support.Poisson","text":"","code":"# S3 method for class 'Poisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Poisson distribution — support.Poisson","text":"d Poisson object created call Poisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Poisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Poisson distribution — support.Poisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"Return support PoissonBinomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"","code":"# S3 method for class 'PoissonBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"d PoissonBinomial object created call PoissonBinomial(). drop logical. Shoul result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.PoissonBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the PoissonBinomial distribution — support.PoissonBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the RevWeibull distribution — support.RevWeibull","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"Return support RevWeibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"","code":"# S3 method for class 'RevWeibull' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"d RevWeibull object created call RevWeibull(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.RevWeibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the RevWeibull distribution — support.RevWeibull","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the StudentsT distribution — support.StudentsT","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"Return support StudentsT distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"","code":"# S3 method for class 'StudentsT' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"d StudentsT object created call StudentsT(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.StudentsT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the StudentsT distribution — support.StudentsT","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Tukey distribution — support.Tukey","title":"Return the support of the Tukey distribution — support.Tukey","text":"Return support Tukey distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Tukey distribution — support.Tukey","text":"","code":"# S3 method for class 'Tukey' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Tukey distribution — support.Tukey","text":"d Tukey object created call Tukey(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Tukey.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Tukey distribution — support.Tukey","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Uniform distribution — support.Uniform","title":"Return the support of the Uniform distribution — support.Uniform","text":"Return support Uniform distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Uniform distribution — support.Uniform","text":"","code":"# S3 method for class 'Uniform' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Uniform distribution — support.Uniform","text":"d Uniform object created call Uniform(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Uniform.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Uniform distribution — support.Uniform","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the Weibull distribution — support.Weibull","title":"Return the support of the Weibull distribution — support.Weibull","text":"Return support Weibull distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the Weibull distribution — support.Weibull","text":"","code":"# S3 method for class 'Weibull' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the Weibull distribution — support.Weibull","text":"d Weibull object created call Weibull(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.Weibull.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the Weibull distribution — support.Weibull","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"Return support zero-inflated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"","code":"# S3 method for class 'ZINegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"d ZINegativeBinomial object created call ZINegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZINegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-inflated negative binomial distribution — support.ZINegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"Return support zero-inflated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"","code":"# S3 method for class 'ZIPoisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"d ZIPoisson object created call ZIPoisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZIPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-inflated Poisson distribution — support.ZIPoisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"Return support zero-truncated negative binomial distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"","code":"# S3 method for class 'ZTNegativeBinomial' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"d ZTNegativeBinomial object created call ZTNegativeBinomial(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTNegativeBinomial.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-truncated negative binomial distribution — support.ZTNegativeBinomial","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"Return support zero-truncated Poisson distribution","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"","code":"# S3 method for class 'ZTPoisson' support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"d ZTPoisson object created call ZTPoisson(). drop logical. result simplified vector possible? ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.ZTPoisson.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of the zero-truncated Poisson distribution — support.ZTPoisson","text":"vector length 2 minimum maximum value support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":null,"dir":"Reference","previous_headings":"","what":"Return the support of a distribution — support","title":"Return the support of a distribution — support","text":"Generic function computing support interval (minimum maximum) given probability distribution object.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return the support of a distribution — support","text":"","code":"support(d, drop = TRUE, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return the support of a distribution — support","text":"d object. package provides methods distribution objects Normal() Binomial() etc. drop logical. result simplified vector possible? ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return the support of a distribution — support","text":"vector (matrix) two elements (columns) indicating range (minimum maximum) support.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/support.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return the support of a distribution — support","text":"","code":"X <- Normal() support(X) #> min max #> -Inf Inf Y <- Uniform(-1, 1:3) support(Y) #> min max #> [1,] -1 1 #> [2,] -1 2 #> [3,] -1 3"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute the moments of a probability distribution — variance","title":"Compute the moments of a probability distribution — variance","text":"Generic functions computing moments (variance, skewness, excess kurtosis) probability distributions.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute the moments of a probability distribution — variance","text":"","code":"variance(x, ...) skewness(x, ...) kurtosis(x, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute the moments of a probability distribution — variance","text":"x object. package provides methods distribution objects Normal() Binomial() etc. ... Arguments passed methods. Unevaluated arguments generate warning catch mispellings possible errors.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute the moments of a probability distribution — variance","text":"Numeric vector values moments.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/variance.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute the moments of a probability distribution — variance","text":"functions variance, skewness, kurtosis new generic functions computing moments probability distributions provided package. Additionally, probability distributions distributions3 methods mean generic. Moreover, quantiles can computed methods quantile. examples illustrating usage probability distribution objects, see manual pages respective distributions, e.g., Normal Binomial etc.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":null,"dir":"Reference","previous_headings":"","what":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"Methods vec_proxy vec_restore vctrs order include distribution objects tibble objects.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"","code":"vec_proxy.distribution(x, ...) vec_restore.distribution(x, to, ...)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"x, Objects inheriting distribution. ... Currently used.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"vec_proxy method returns distribution object additionally inherits data.frame vec_restore method restores original distribution classes.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"methods vec_proxy vec_restore vctrs needed distribution objects can included vector column (extracted ) tibble data frames. vec_proxy simply adds class data.frame actual underlying data structure used distribution objects. way number rows etc. can correctly determined. Conversely, vec_restore strips additional data.frame class restores original distribution classes. Users typically need call vec_proxy vec_restore directly.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/vec_proxy.distribution.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Methods for including distributions as vctrs in tibbles — vec_proxy.distribution","text":"","code":"## Poisson GLM for FIFA 2018 goals data data(\"FIFA2018\", package = \"distributions3\") m <- glm(goals ~ difference, data = FIFA2018, family = poisson) ## Predict fitted Poisson distributions for teams with ability differences ## of -1, 0, 1 (out-of-sample) using the new data as a data.frame nd <- data.frame(difference = -1:1) nd$dist <- prodist(m, newdata = nd) nd #> difference dist #> 1 -1 Poisson(lambda = 0.8181454) #> 2 0 Poisson(lambda = 1.2370397) #> 3 1 Poisson(lambda = 1.8704100) ## Do the same using the new data as a tibble library(\"tibble\") nt <- tibble(difference = -1:1) nt$dist <- prodist(m, newdata = nt) nt #> # A tibble: 3 × 2 #> difference dist #> #> 1 -1 Poisson(lambda = 0.8181) #> 2 0 Poisson(lambda = 1.2370) #> 3 1 Poisson(lambda = 1.8704)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-inflated negative binomial distribution — dzinbinom","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"Density, distribution function, quantile function, random generation zero-inflated negative binomial distribution parameters mu, theta (size), pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"","code":"dzinbinom(x, mu, theta, size, pi, log = FALSE) pzinbinom(q, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) qzinbinom(p, mu, theta, size, pi, lower.tail = TRUE, log.p = FALSE) rzinbinom(n, mu, theta, size, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"x vector (non-negative integer) quantiles. mu vector (non-negative) negative binomial location parameters. theta, size vector (non-negative) negative binomial overdispersion parameters. theta , equivalently, size may specified. pi vector zero-inflation probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"functions follow usual conventions d/p/q/r functions base R. particular, four zinbinom functions zero-inflated negative binomial distribution call corresponding nbinom functions negative binomial distribution base R internally. Note, however, precision qzinbinom large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zinbinom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-inflated negative binomial distribution — dzinbinom","text":"","code":"## theoretical probabilities for a zero-inflated negative binomial distribution x <- 0:8 p <- dzinbinom(x, mu = 2.5, theta = 1, pi = 0.25) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rzinbinom(500, mu = 2.5, theta = 1, pi = 0.25) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-inflated Poisson distribution — dzipois","title":"The zero-inflated Poisson distribution — dzipois","text":"Density, distribution function, quantile function, random generation zero-inflated Poisson distribution parameters lambda pi.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-inflated Poisson distribution — dzipois","text":"","code":"dzipois(x, lambda, pi, log = FALSE) pzipois(q, lambda, pi, lower.tail = TRUE, log.p = FALSE) qzipois(p, lambda, pi, lower.tail = TRUE, log.p = FALSE) rzipois(n, lambda, pi)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-inflated Poisson distribution — dzipois","text":"x vector (non-negative integer) quantiles. lambda vector (non-negative) Poisson parameters. pi vector zero-inflation probabilities unit interval. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-inflated Poisson distribution — dzipois","text":"functions follow usual conventions d/p/q/r functions base R. particular, four zipois functions zero-inflated Poisson distribution call corresponding pois functions Poisson distribution base R internally. Note, however, precision qzipois large probabilities (close 1) limited probabilities internally handled levels logs (even log.p = TRUE).","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/zipois.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-inflated Poisson distribution — dzipois","text":"","code":"## theoretical probabilities for a zero-inflated Poisson distribution x <- 0:8 p <- dzipois(x, lambda = 2.5, pi = 0.25) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rzipois(500, lambda = 2.5, pi = 0.25) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-truncated negative binomial distribution — dztnbinom","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"Density, distribution function, quantile function, random generation zero-truncated negative binomial distribution parameters mu theta (size).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"","code":"dztnbinom(x, mu, theta, size, log = FALSE) pztnbinom(q, mu, theta, size, lower.tail = TRUE, log.p = FALSE) qztnbinom(p, mu, theta, size, lower.tail = TRUE, log.p = FALSE) rztnbinom(n, mu, theta, size)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"x vector (non-negative integer) quantiles. mu vector (non-negative) negative binomial location parameters. theta, size vector (non-negative) negative binomial overdispersion parameters. theta , equivalently, size may specified. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"negative binomial distribution left-truncated zero (zero-truncated negative binomial short) distribution obtained, considering negative binomial variable Y conditional Y greater zero. functions follow usual conventions d/p/q/r functions base R. particular, four ztnbinom functions zero-truncated negative binomial distribution call corresponding nbinom functions negative binomial distribution base R internally.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztnbinom.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-truncated negative binomial distribution — dztnbinom","text":"","code":"## theoretical probabilities for a zero-truncated negative binomial distribution x <- 0:8 p <- dztnbinom(x, mu = 2.5, theta = 1) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rztnbinom(500, mu = 2.5, theta = 1) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":null,"dir":"Reference","previous_headings":"","what":"The zero-truncated Poisson distribution — dztpois","title":"The zero-truncated Poisson distribution — dztpois","text":"Density, distribution function, quantile function, random generation zero-truncated Poisson distribution parameter lambda.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"The zero-truncated Poisson distribution — dztpois","text":"","code":"dztpois(x, lambda, log = FALSE) pztpois(q, lambda, lower.tail = TRUE, log.p = FALSE) qztpois(p, lambda, lower.tail = TRUE, log.p = FALSE) rztpois(n, lambda)"},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"The zero-truncated Poisson distribution — dztpois","text":"x vector (non-negative integer) quantiles. lambda vector (non-negative) Poisson parameters. log, log.p logical indicating whether probabilities p given log(p). q vector quantiles. lower.tail logical indicating whether probabilities \\(P[X \\le x]\\) (lower tail) \\(P[X > x]\\) (upper tail). p vector probabilities. n number random values return.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"The zero-truncated Poisson distribution — dztpois","text":"Poisson distribution left-truncated zero (zero-truncated Poisson short) distribution obtained, considering Poisson variable Y conditional Y greater zero. functions follow usual conventions d/p/q/r functions base R. particular, four ztpois functions zero-truncated Poisson distribution call corresponding pois functions Poisson distribution base R internally.","code":""},{"path":[]},{"path":"https://alexpghayes.github.io/distributions3/dev/reference/ztpois.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"The zero-truncated Poisson distribution — dztpois","text":"","code":"## theoretical probabilities for a zero-truncated Poisson distribution x <- 0:8 p <- dztpois(x, lambda = 2.5) plot(x, p, type = \"h\", lwd = 2) ## corresponding empirical frequencies from a simulated sample set.seed(0) y <- rztpois(500, lambda = 2.5) hist(y, breaks = -1:max(y) + 0.5)"},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-development-version","dir":"Changelog","previous_headings":"","what":"distributions3 (development version)","title":"distributions3 (development version)","text":"warning, default (#100). prodist() methods various count regression objects now distinguish computations classic pscl package newer countreg package (currently R-Forge, soon released CRAN). simulate() method distribution objects now better aligned simulate.lm() base R: now always returns data.frame seed attribute. New simulate() default method leverages prodist() subsequently uses simulate() method distribution objects. New prodist() methods distribution objects just returns unmodified distribution object . format() method - hence print() method - distribution objects simplified. example, now Normal(mu = 0, sigma = 1) used instead Normal distribution (mu = 0, sigma = 1) order yield compact output, especially vectors distributions (#101). Added .character() method essentially calls format(..., digits = 15, drop0trailing = TRUE). mimics behavior precision base R real vectors. Note enables using match() distribution objects. Added duplicated() method relies corresponding method data.frame parameters distribution. Enabled inclusion distribution vectors columns tibble data objects, see ?vec_proxy.distribution details practical example. Fixed errors notation cumulative distribution function documentation HurdlePoisson() HurdleNegativeBinomial() (@dkwhu #94 #96). prodist() method glm objects can now also handle family specifications MASS::negative.binomial(theta) fixed theta (reported Christian Kleiber). Replace ellipsis dependency rlang former deprecated/archived (@olivroy #105). small improvements methods manual pages.","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-021","dir":"Changelog","previous_headings":"","what":"distributions3 0.2.1","title":"distributions3 0.2.1","text":"CRAN release: 2022-09-07 New generics is_discrete() is_continous() methods distribution objects package. is_discrete() methods return TRUE every distribution discrete entire support FALSE otherwise. Analogously, is_continuous() returns TRUE every distribution continuous entire support FALSE otherwise. Thus, mixed discrete-continuous distributions methods yield FALSE (#90). New logical argument elementwise = NULL apply_dpqr() hence inherited cdf(), pdf(), log_pdf(), quantile(). provides type-safety applying one functions vector distributions d numeric argument x d x length n > 1. setting elementwise = TRUE function applied element--element, also yielding vector length n. setting elementwise = FALSE function applied combinations yielding n--n matrix. default elementwise = NULL corresponds FALSE d x different lengths TRUE length n > 1 (#87). Extended support various count data distributions, now enompassing Poisson negative binomial distributions along various adjustments zero counts (hurdle, inflation, truncation, respectively). details provided following items (#86). New d/p/q/r functions hnbinom, zinbinom, ztnbinom, ztpois similar corresponding nbinom pois functions base R. New HurdleNegativeBinomial(), ZINegativeBinomial(), ZTNegativeBinomial(), ZTPoisson() distribution constructors along corresponding S3 methods “usual” generics (except skewness() kurtosis()). New prodist() methods extracting fitted/predicted probability distributions models estimated hurdle(), zeroinfl(), zerotrunc() objects either pscl package countreg package. Added argument prodist(..., sigma = \"ML\") lm method extracting fitted/predicted probability distribution linear regression model. previous version prodist() method always used least-squares estimate error variance (= residual sum squares divided residual degrees freedom, n - k), also reported summary() method. Now default use maximum-likelihood estimate instead (divided number observations, n) consistent logLik() method. previous behavior can obtained specifying sigma = \"OLS\" (#91). Similarly lm method glm method prodist(..., dispersion = NULL) now, default, uses dispersion estimate matches logLik() output. based deviance divided number observations, n. Alternatively, dispersion = \"Chisquared\" uses estimate employed summary() method, based Chi-squared statistic divided residual degrees freedom, n - k. Small improvements methods various distribution objects: Added support() method GEV-based distributions (GEV(), GP(), Gumbel(), Frechet()). Added random() method Tukey() distribution (using inversion method).","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-020","dir":"Changelog","previous_headings":"","what":"distributions3 0.2.0","title":"distributions3 0.2.0","text":"CRAN release: 2022-06-21 Vectorized univariate distribution objects Moritz Lang Achim Zeileis (#71 #82). allows representation fitted probability distributions regression models. New helper functions provided help setting distribution objects unified way. particular, apply_dpqr() helps apply standard d/p/q/r functions available base R many packages. accompanying manual page provides worked examples guidance. New vignette (Achim Zeileis) using distributions3 go basic probability theory probabilistic regression models. Illustrated Poisson GLMs number goals per team 2018 FIFA World Cup explained teams’ ability differences. (#74) New generic function prodist() extract fitted (-sample) predicted (--sample) probability distributions model objects like lm, glm, arima. (#83) Extended support count data distributions (Achim Zeileis): Alternative parameterization negative binomial distribution (commonly used regression models), zero-inflated Poisson, zero-hurdle Poisson. (#80 #81)","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-012","dir":"Changelog","previous_headings":"","what":"distributions3 0.1.2","title":"distributions3 0.1.2","text":"CRAN release: 2022-01-03 Added plotting generic univariate distributions (@paulnorthrop, PR #56) Added support Generalised Extreme Value (GEV), Frechet, Gumbel, reversed Weibull Generalised Pareto (GP) distributions (@paulnorthrop, PR #52) Added support Erlang distribution (@ellessenne, PR #54) Various minor bug fixes","code":""},{"path":"https://alexpghayes.github.io/distributions3/dev/news/index.html","id":"distributions3-011","dir":"Changelog","previous_headings":"","what":"distributions3 0.1.1","title":"distributions3 0.1.1","text":"CRAN release: 2019-09-03 Rename distributions3 CRAN","code":""}]