Question: 1) Write the R code to create a vector x with integers 1, 2,10. Then using the command append( ) insert the number 1.11 between

1) Write the R code to create a vector x with integers 1, 2,10. Then using the command append( ) insert the number 1.11 between x[7] and x[8]. Do it also without using append( ).

Hint: run the command help(append).

2) What this R code does? (Hint: Review the concepts associated with this distribution)

> rx = replicate(10,mean(rexp(20, rate=0.05)))

> mean(rx)

Answer (circle please):

(a) calculates the mean of a set of random numbers

(b) calculates the mean of means of random numbers

(c) shows that the sample mean is an unbiased parameter estimator

does the command below confirm your answer above? YES NO

> rrx = sapply(1:10, function(i) mean(rexp(20, rate=0.05)))

> mean(rrx)

In addition, write the R code to plot the means generated above.

3) Write the R code that generate a sample vector z of five random numbers from the uniform distribution, and plot the quantile values as a function of x, where x values are 0%, 25%, 50%, 75% and 100%.

4) Show the R code and calculate the probability for each of the following events:

(a) A standard normally distributed variable is larger than 3.

(b) A normally distributed variable with mean 35 and standard deviation 6 is larger than 42.

(c) Getting 10 out of 10 successes in a binomial distribution with probability 0.8.

(d) X < 0.9 when X has the standard uniform distribution.

(e) X > 6.5 in a chi-squared distribution with 2 degrees of freedom.

5) Write the R code to plot a histogram for the variables age and circumference from the Orange data set (see help(Orange)). Since these data are very discretized, you may want to try truehist from the MASS package as a replacement. (Hint: data(Orange); attach(Orange); enter library(MASS) to activate the function truehist). Do you have any different approach for this plot?

6) Before computers, and approximation to pnorm() was the expression (1+(sqrt(1-e^((-2x^2)/pi))/2.

Define a function, say pn, equals to this expression, and find the region in (0, +) where the

difference between pnorm() and pn() is minimum and maximum. (Hint: plot the difference

between pnorm() and pn ())

Note: the command to create a function is pn = function(x) { statements }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!