
R Programming Homework Help on Distribution
- 11th Feb, 2022
- 17:52 PM
# i) x <- rep(1, 100000) for (i in 1:100000) { x[i] = (sum(runif(3)) - 3/2)/(sqrt(3/12)) } qqnorm(x) mean(x) sd(x) # For 95% CI data should lies between qnorm(0.025) # and qnorm(0.975) #now from the data we need to see the proportion of observations in this interval length(x[x < 1> -1.959964])/100000 # So proportion of data between given range is given above # Similarly for 0.5 and 99.5 percentile is length(x[x < qnorm> qnorm(0.005)])/100000 # now for (ii) x1 <- rep(1, 100000) for (i in 1:100000) { x1[i] = qnorm(runif(1)) } qqnorm(x1) mean(x1) sd(x1) # For 95% CI data should lies between qnorm(0.025) # and qnorm(0.975) #now from the data we need to see the proportion of observations in this interval length(x1[x1 < 1> -1.959964])/100000 # So proportion of data between given range is given above # Similarly for 0.5 and 99.5 percentile is length(x1[x1 < qnorm> qnorm(0.005)])/100000 # So as we can see that both the distribution are following normal distribution # Q 2 x <- rnorm(1000) y <- x^2 #A) # So here we will find the probability from sample in such a way that number of observation less than 1.2 divided by total number of observations length(y[y<=1.2])/1000 #B) pchisq(1.2, 1) #C) # There is a difference between both of them because one of them is determining the probabilty based on the random sample drawn. And another one is determining the exact probability. #D) #Estimate of m is given by : mean(y) #E) # As we know that here m = 1 accorording to theoritical distribution # So if we increase N then value of m will close to 1