Vignette Title
Vignette Author
2023-11-24
#Negative binomial distribution
p <- 0.3 # Success probability
k <- 5 # Number of successes
x <- 10 # Number of trials
dnbinom(10,5,0.3)
#> [1] 0.06871013
pnbinom(10,5,0.3)
#> [1] 0.4845089
qnbinom(0.25,5,0.3)
#> [1] 7
rnbinom(5,5,0.3)
#> [1] 20 19 6 15 7
plot(0:10,dnbinom(0:10,5,0.3), type = "h", col = "purple", lwd = 2, main = "Negative Binomial PMF")

#Beta distribution
alpha <- 2 # Shape parameter
beta <- 5 # Shape parameter
x <- 0.4 # Specific value
dbeta(0.4,2,5)
#> [1] 1.5552
pbeta(0.4,2,5)
#> [1] 0.76672
qbeta(0.75,2,5)
#> [1] 0.3894795
qbeta(0.5,2,5)
#> [1] 0.26445
rbeta(5,2,5)
#> [1] 0.33001391 0.58199860 0.08339534 0.26484725 0.40881723
plot(0:5,dbeta(0:5,2,5), type = "l", col = "blue", lwd = 2, main = "Beta PDF")

#Chi square distribution
k <- 3 # Degrees of freedom
x <- 5 # Specific value
dchisq(5,3)
#> [1] 0.07322491
pchisq(5,3)
#> [1] 0.8282029
qchisq(0.25,3)
#> [1] 1.212533
qchisq(0.75,3)
#> [1] 4.108345
rchisq(5,3)
#> [1] 0.1778849 4.1446265 3.1726775 0.1467054 3.9963095
plot(0:5, dchisq(0:5,3), type = "l", col = "purple", lwd = 2, main = "Chi-Square PDF")

#weibull distribution
alpha <- 2 # Shape parameter
beta <- 1 # Scale parameter
x <- 1.5 # Specific value
dweibull(1.5,2,1)
#> [1] 0.3161977
pweibull(1.5,2,1)
#> [1] 0.8946008
qweibull(0.75,2,1)
#> [1] 1.17741
rweibull(5,2,1)
#> [1] 0.5558865 1.6611841 0.2809581 0.9625213 1.7739511
plot(0:2, dweibull(0:2,2,1), type = "l", col = "orange", lwd = 2, main = "Weibull PDF")

#student's t-distribution
df <- 5 # Degrees of freedom
x <- 1.5 # Specific value
dt(1.5,5)
#> [1] 0.1245173
pt(1.5,5)
#> [1] 0.9030482
qt(0.5, 5)
#> [1] 0
qt(0.25, 5)
#> [1] -0.7266868
rt(5,5)
#> [1] 1.2331757 0.6459839 -0.6003523 3.0210811 0.8937938
plot(0:5,dt(0:5,5),type = "l",col = "purple",lwd = 2,main = "t-Distribution PDF")
