In: Statistics and Probability
Use R and perform following:
Generate 1000 observations from an exponential distribution with
mean 10.
Generate 1000 observations from a central t-distribution with 8
degree of freedom.
Make a qqplot of observations in problem 1 versus quantiles
generated from a t-distribution
with 8 degree of freedom. Can the t distribution be used to
approximate data in part 1?Submit
the plot.
Repeat above part but submit a qqplot of the observations in 1
versus quantiles from an exponential
with mean 1. What is your conclusion?
Random exponential distribution in R:-
For generating random exponential distribution in R is rexp(n,lamda) where n refers to the sample size and lambda is the rate parameter. The mean of exponential distribution is 1/lambda and the standard deviation is also 1/lambda
rexp(n,lamda)
>x<- rexp(1000, 0.1)
>x[0:20]
[1] 11.8374577 0.6041982 2.6490437 4.5841595 33.2941223 11.1561669 [7] 12.0257420 2.4585212 0.5783512 22.8702997 2.6110438 8.5349925 [13] 23.9149159 3.8423621 8.8366142 11.0909087 5.4228406 5.6150966 [19] 7.9317064 16.0707504
Random t distribution in R:-
rt(a,b) returns a random draws from a t distribution centered at 0 with b degrees of freedom.
rt(a,b)
>y <- rt(1000,8)
>y[0:20]
[1] -1.855119123 0.802409732 -0.366512326 0.348991110 -0.889810771 [6] 1.316007092 1.243631552 -3.505593271 -0.181419213 0.654032170 [11] 1.156344566 -0.556387657 -0.669780166 0.236448825 1.071076264 [16] 0.472816531 0.004414854 -0.471919606 -1.579729421 0.529356835
qqplot-
>qqplot(x,y)
qqplot of observations in problem 1 versus quantiles generated
from a t-distribution
with 8 degree of freedom
>qqplot(y,x)
qqplot of the observations in 1 versus quantiles from an exponential
It data follows straight line means >> normally distributed