README.md

Overview

binomial is a package that provides functions for bino mial distributions.

Motivation

This package has been developed for the model of binomial distribution.

Usage

library(binomial)

bin_choose(n = 5, k = 2)
## [1] 10
# probability of getting 2 successes in 5 trials
# (assuming prob of success = 0.5) 
bin_probability(success = 2, trials = 5, prob = 0.5)
## [1] 0.3125
bin_distribution(trials=5, prob = 0.5)
##   success probability
## 1       0     0.03125
## 2       1     0.15625
## 3       2     0.31250
## 4       3     0.31250
## 5       4     0.15625
## 6       5     0.03125
dis1 <- bin_distribution(trials = 5, prob = 0.5)
plot(dis1)

bin_cumulative(trials=5, prob = 0.5)
##   success probability cumulative
## 1       0     0.03125    0.03125
## 2       1     0.15625    0.18750
## 3       2     0.31250    0.50000
## 4       3     0.31250    0.81250
## 5       4     0.15625    0.96875
## 6       5     0.03125    1.00000
dis2 <- bin_cumulative(trials = 5, prob = 0.5)
plot(dis2)

bin_variable(trials = 10, p = 0.3)
## "Binomial variable"
## 
## Parameters
## - number of trials:  10 
## - prob of success:  0.3
bin1 <- bin_variable(trials = 10, p = 0.3)
binsum1 <- summary(bin1)
binsum1
## "Summary Binomial"
## 
## Parameters
## - number of trials:  10 
## - prob of success:  0.3 
## 
## Measures
## - mean:  3 
## - variance:  2.1 
## - mode:  3 
## - skewness:  0.2760262 
## - kurtosis:  -0.1238095
bin_mean(trials = 10, prob = 0.3)
## [1] 3
bin_variance(trials = 10, prob = 0.3)
## [1] 2.1
bin_mode(trials = 10, prob = 0.3)
## [1] 3
bin_skewness(trials = 10, prob = 0.3)
## [1] 0.2760262
bin_kurtosis(trials = 10, prob = 0.3)
## [1] -0.1238095


SophieSXR/Workout03 documentation built on May 4, 2019, 12:54 a.m.