Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Let X1, . . . ,Xn be iid with the Exponential distribution with mean a '.> U. {a} (4 points) Write an R function
2. Let X1, . . . ,Xn be iid with the Exponential distribution with mean a '.> U. {a} (4 points) Write an R function called myrexp that generates a realization of X1, . . . , X\". Only calls to R's standard uniform generator '1'111'1'I'lll are permitted; eg. calling 'I'E'IP is not allowed. This function should have two arguments: - n, the random sample size a mu, the user-specied mean of the exponential distribution This function should return a vector of 11 entries with the generated realization of X1, . . . , X\". (b) (5 points) Test myrexp by generating a realization of X1, . . . , X2000 iid with the Expo- nential distribution with some mean ,u > 0 that you pick. Create a QQplot to compare the data percentiles (of the realization of the random sample) to the percentiles of the Exponential distribution with mean a. Only use the 1st, 2nd, 3rd, . . ., 99th percentiles (so the plot has 99 points). Calling the function qexp is not allowed here. (c) (10 points} Let X = 111 2:1 Xi; be the (random) sample mean. Write an R function called run.exp.sim that generates a realization of reps independent copies of X with sample size n. This function should have three arguments: - n the sample size - mu the mean of the exponential distribution - reps the number of realizations of If The function should return a vector of raps realizations of J? and display a QQplot of comparing the data percentiles of the entries in this vector to the percentiles of the tted Normal distribution. Use reps data percentiles (so the plot has reps points}. Calling the function qqnorm is not allowed. However, you can use the function qnorm. (d) (5 points) A civil engineer measured the times between vehicle arrivals at a rural bridge on a Sunday afternoon. For a simple model, she assumes that her measured inter- arrival times {in minutes) 9:1, . . . , 1:30 are a realization of X1, . . . , X30 with the exponential distribution with unknown mean it. She computes the observed sample mean :1: = (lf) 1.15:- to estimate a. Is this sample size of 30 large enough for :7; to be a rcalization of random variable with a distribution wcll approximated by thc Normal distribution? To respond1 pretend that p. : 2.5 minutes and perform a simulation study using the function run . exp. 31:11 with reps=10000. Comment on the result
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started