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)

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-5)

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-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 […]

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

Below are the solutions to these exercises on probability mass function. #################### # # # Exercise 1 # # # #################### dbinom(5, size=200, prob=1/20) ## [1] 0.0358957 #################### # # # Exercise 2 # # # #################### print(dbinom(0,10,1/2)+dbinom(1,10,1/2)+dbinom(2,10,1/2)+dbinom(3,10,1/2)+dbinom(4,10,1/2)+dbinom(5,10,1/2)+dbinom(6,10,1/2)) ## [1] 0.828125 print(pbinom(6,10,1/2)) ## [1] 0.828125 #################### # # # Exercise 3 # # # #################### […]

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

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-3)

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

Below are the solutions to these exercises on bootstrapping. #################### # # # Exercise 1 # # # #################### data<-read.csv("http://www.r-exercises.com/wp-content/uploads/2017/07/Exercise1.HS3_.csv",header = TRUE) str(data) ## ‘data.frame’: 200 obs. of 2 variables: ## $ X : int 1 2 3 4 5 6 7 8 9 10 … ## $ V1: num 1.371 -0.565 0.363 0.633 0.404 […]

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

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

Below are the solutions to these exercises on statistics. #################### # # # Exercise 1 # # # #################### x.norm <- seq(-4, 4, 0.01) plot(x.norm,dnorm(x.norm, mean=0, sd=1)) abline(v=mean(rnorm(1000, mean=0, sd=1))) x.exp <- seq(0, 5, 0.01) plot(x.exp ,dexp(x.exp , rate=1)) abline(v=mean(rexp(1000 ,rate=1))) #################### # # # Exercise 2 # # # #################### set.seed(42) hist(rexp(500,rate=0.5)) data.2.2<-rexp(500,rate=0.5) print(mean(data.2.2)) […]