Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Test the standard normal pseudo-random number generator on your computer by generating a sample of size 10,000 and drawing a normal quantile plot. How straight does the plot appear to be?

Short Answer

Expert verified

\(Generate using R with rnorm (n), and use q qnorm for Q - Q plot. \)

Step by step solution

01

Pseudo-random number

A fixed statistically random number as well as aspects that are obtained from a known preliminary step and therefore are usually repeated again and again.

02

To Test the standard normal pseudo-random number generator on your computer by generating a sample

In RStudio, generate a random sample of size n=10000 from a standard normal distribution using the built-in function r norm (n). Then, use the built-in function qqnorm to create the \(Q - Q\) plot. From the figure given below, one may see that the theoretical quantiles versus the sample quantiles create a reasonably straight line, meaning that the sample comes from a standard normal distribution.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Describe how to convert a random sample \({{\bf{U}}_{\bf{1}}}{\bf{, \ldots ,}}{{\bf{U}}_{\bf{n}}}\) from the uniform distribution on the interval \({\bf{[0,1]}}\) to a random sample of size \({\bf{n}}\) from the uniform distribution on the interval\({\bf{[a,b]}}\).

In Example 12.5.6, we used a hierarchical model. In that model, the parameters\({\mu _i},...,{\mu _P}\,\)were independent random variables with\({\mu _i}\)having the normal distribution with mean ฯˆ and precision\({\lambda _0}{T_i}\,\)conditional on ฯˆ and\({T_1},\,....{T_P}\). To make the model more general, we could also replace\({\lambda _0}\)with an unknown parameter\(\lambda \). That is, let the\({\mu _i}\)โ€™s be independent with\({\mu _i}\)having the normal distribution with mean ฯˆ and precision\(\,\lambda {T_i}\)conditional on\(\psi \),\(\lambda \) and\({T_1},\,....{T_P}\). Let\(\lambda \)have the gamma distribution with parameters\({\gamma _0}\)and\(\,{\delta _0}\), and let\(\lambda \)be independent of ฯˆ and\({T_1},\,....{T_P}\). The remaining parameters have the prior distributions stated in Example 12.5.6.

a. Write the product of the likelihood and the prior as a function of the parameters\({\mu _i},...,{\mu _P}\,\), \({T_1},\,....{T_P}\)ฯˆ, and\(\lambda \).

b. Find the conditional distributions of each parameter given all of the others. Hint: For all the parameters besides\(\lambda \), the distributions should be almost identical to those given in Example 12.5.6. It wherever\({\lambda _0}\)appears, of course, something will have to change.

c. Use a prior distribution in which ฮฑ0 = 1, ฮฒ0 = 0.1, u0 = 0.001, ฮณ0 = ฮด0 = 1, and \({\psi _0}\)= 170. Fit the model to the hot dog calorie data from Example 11.6.2. Compute the posterior means of the four ฮผiโ€™s and 1/ฯ„iโ€™s.

\({{\bf{x}}_{\scriptstyle{\bf{1}}\atop\scriptstyle\,}}.....{{\bf{x}}_{\scriptstyle{\bf{n}}\atop\scriptstyle\,}}\) be uncorrelated, each with variance \({\sigma ^2}\) Let \({{\bf{y}}_{\scriptstyle{\bf{1}}\atop\scriptstyle\,}}.....{{\bf{y}}_{\scriptstyle{\bf{n}}\atop\scriptstyle\,}}\) be positively correlated. each with variance, prove that the variance of \(\overline x \)is smaller than the variance of \(\overline y \)

Use the data consisting of 30 lactic acid concentrations in cheese,10 from example 8.5.4 and 20 from Exercise 16 in sec.8,6, Fit the same model used in Example 8.6.2 with the same prior distribution, but this time use the Gibbs sampling algorithm in Example 12.5.1. simulate 10,000 pairs of \(\left( {{\bf{\mu ,\tau }}} \right)\) parameters. Estimate the posterior mean of \({\left( {\sqrt {{\bf{\tau \mu }}} } \right)^{ - {\bf{1}}}}\), and compute the standard simulation error of the estimator.

The \({\chi ^2}\) goodness-of-fit test (see Chapter 10) is based on an asymptotic approximation to the distribution of the test statistic. For small to medium samples, the asymptotic approximation might not be very good. Simulation can be used to assess how good the approximation is. Simulation can also be used to estimate the power function of a goodness-of-fit test. For this exercise, assume that we are performing the test that was done in Example 10.1.6. The idea illustrated in this exercise applies to all such problems.

a. Simulate \(v = 10,000\) samples of size \(n = 23\) from the normal distribution with a mean of 3.912 and variance of 0.25. For each sample, compute the \({\chi ^2}\) goodness of fit statistic Q using the same four intervals that were used in Example 10.1.6. Use the simulations to estimate the probability that Q is greater than or equal to the 0.9,0.95 and 0.99 quantiles of the \({\chi ^2}\) distribution with three degrees of freedom.

b. Suppose that we are interested in the power function of a \({\chi ^2}\) goodness-of-fit test when the actual distribution of the data is the normal distribution with a mean of 4.2 and variance of 0.8. Use simulation to estimate the power function of the level 0.1,0.05 and 0.01 tests at the alternative specified.

See all solutions

Recommended explanations on Math Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free