Below are the solutions to these exercises on simulations. #################### # # # Exercise 1 # # # #################### birth.sample<-function(n.people,n.sample) { success<-0 for(i in 1:n.sample) { samples<-sample(1:365,n.people,replace = TRUE) #Sort the date of birth from the earlyest to the latest samples<-sort(samples) #Boolean variable which indicate if we find two identical birth date find.identical<-FALSE #Pointer for […]

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-9)

Statistics are often taught in school by and for people who like Mathematics. As a consequence, in those class emphasis is put on leaning equations, solving calculus problems and creating mathematics models instead of building an intuition for probabilistic problems. But, if you read this, you know a bit of R programming and have access […]

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-8)

Statistics are often taught in school by and for people who like Mathematics. As a consequence, in those class emphasis is put on leaning equations, solving calculus problems and creating mathematics models instead of building an intuition for probabilistic problems. But, if you read this, you know a bit of R programming and have access […]

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Solutions (Part-8)

Below are the solutions to these exercises on conditional probability. #################### # # # Exercise 1 # # # #################### #1 library(VennDiagram) data.ex1<-read.csv(“https://www.r-exercises.com/wp-content/uploads/2017/09/data.ex1_.set8_.csv”) str(data.ex1) ## ‘data.frame’: 34 obs. of 3 variables: ## $ X : int 1 2 3 4 5 6 7 8 9 10 … ## $ Graphic : int 1 1 0 […]

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-7)

Statistics are often taught in school by and for people who like Mathematics. As a consequence, in those class emphasis is put on leaning equations, solving calculus problems and creating mathematics models instead of building an intuition for probabilistic problems. But, if you read this, you know a bit of R programming and have access […]

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Solutions (Part-7)

Below are the solutions to these exercises on permutation tests. #################### # # # Exercise 1 # # # #################### #1 set.seed(42) beta1<-rbeta(500,2,1.5) #2 set.seed(24) beta2<-rbeta(500,2,1.5) #3 beta.data<-matrix(c(beta1,beta2),nrow = 1000,ncol = 1) #4 plot(ecdf(beta1), do.points=FALSE) plot(ecdf(beta2), do.points=FALSE, add=TRUE, col=’blue’) #5 for(i in 1:5) { index<-sample(1:length(beta.data), 500, replace = FALSE) plot(ecdf(beta.data[index]),do.points=FALSE, add=TRUE, col=’red’) } #6 Since […]

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Solutions (Part-6)

Below are the solutions to these exercises on statistical tests. #################### # # # Exercise 1 # # # #################### sample.norm<-function(size) { data<-rnorm(size,mean=5+8/12,sd=2.94/12) return(sum(data>=5+8/12&data<=5+9/12)/size) } set.seed(42) sample.norm(200) ## [1] 0.135 #################### # # # Exercise 2 # # # #################### prob<-pnorm(5+9/12,mean=5+8/12,sd=2.94/12)-pnorm(5+8/12,mean=5+8/12,sd=2.94/12) print(prob) ## [1] 0.133123 sample.diff<-function(size1,size2) { results<-NULL for(i in size1:size2) { results<-c( results,((sample.norm(i)-prob)/prob)*100) } […]

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-6)

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Exercises (Part-5)

## Hacking statistics or: How I Learned to Stop Worrying About Calculus and Love Stats Solutions (Part-5)

Below are the solutions to these exercises on probability. #################### # # # Exercise 1 # # # #################### #1-You can use a binomial distribution. If we knew the average number of failure instead of a failure rate, we would have use the Poisson distribution. #2- Since there’s a 1% failure rate each engine have […]