This R-package contains four useful, documented functions that were used throughout this course, along with a documented data set. These functions largely pertain to plotting data and statistical relationships that require computational power to complete. However, there is one function that performs a simple probabilistic calculation. This vignette will demonstrate the usage of these four functions. First, we load the package (named "MATH4753") from our library.

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
knitr::opts_chunk$set(fig.width=7, fig.height=5) 
library(MATH4753)

1. mynbin function

MATH4753::mynbin(y = 10, r = 2, p = 0.5)

# This function is the most simple of the four in the package. 
#It performs a standard binomial probability calculation, 
#where y is the number of trials, r is the number of successes, 
#and p is the probability of success.

# Use ?mynbin for more information 

2. myclt function

a = MATH4753::myclt(n = 100, iter = 1000, a = 2, b = 8)
a[1]

# This function produces a histogram. n defines how many 
#samples you wish to analyze, iter determines how many 
#iterations the function will perform for n number of samples, 
#while a and b determine the left and right bound of the n 
#samples of the uniform distribution. 

# Use ?myclt for more information

3. myNRML function

MATH4753::myNRML(x0=1,delta=0.001,llik=function(x)log(dpois(4,x)*dpois(6,x)*dpois(7,x)*dpois(6,x)*dpois(5,x)),xrange=c(0,10),parameter="param")

# The myNRML function graphically displays the work of the 
#Newton-Raphson graphical approach to finding the maximum likelihood. 
#Decreasing the value of delta (i.e. the "step") improves the accuracy 
#of this approach. This example is from Lab 10. 

# use ?myNRML for more information 

4. myboot2 function

MATH4753::myboot2(iter = 1000000, x = 1000, fun = "mean", alpha = 0.05, cx = 1.5)

# This function creates a density histogram of the bootstrap sample 
#statistics. You define the function that you wish to analyze. 
#Increasing the value of iter will result in greater "accuracy." 


# Use ?myboot2 for more information


andrewtornado11/MATH4753 documentation built on May 10, 2022, 7:34 p.m.