R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

(Omega = 1:6)
## [1] 1 2 3 4 5 6
set.seed(12345)
N = 6  ## number of die rolls
repeat_process = 20000

Dice <- sample(x = 1:6, size = 6, replace = TRUE) # roll 6 times
sum(Dice>4)
## [1] 2
AllData <- 
data <- replicate(20000, { Dice <- sample(x = 1:6, size = 6, replace = TRUE);  sum(Dice > 4)})
table(data)
## data
##    0    1    2    3    4    5    6 
## 1809 5316 6552 4344 1634  321   24
mean(data)
## [1] 1.98685
hist(data)

## from the histogram the data is not normally distributed.

#Perform a normality test; What test did you select? Is this data normal?
# Anderson-Darling normality test
library(nortest)
ad.test(data)
## 
##  Anderson-Darling normality test
## 
## data:  data
## A = 631.67, p-value < 2.2e-16
## from the p-value is  we can conclude that the data is not normally distributed



#Perform a binomial test; What parameters did you use? Is this data binomial?
# Exact binomial test
binom.test(x = 18199, n = 20000, p = 0.9095, "two.sided", conf.level = 0.95)
## 
##  Exact binomial test
## 
## data:  18199 and 20000
## number of successes = 18199, number of trials = 20000, p-value = 0.8341
## alternative hypothesis: true probability of success is not equal to 0.9095
## 95 percent confidence interval:
##  0.9058980 0.9138824
## sample estimates:
## probability of success 
##                0.90995
## from the exact binominal test we can say the data is binominal and the parameters are number of success, total trials, probability of success, tail type and confidence level

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.