Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The command 'sample', as the name suggests, allows you to simulate a random sample. It is however limited to simulating samples from an arbitrary
The command 'sample', as the name suggests, allows you to simulate a random sample. It is however limited to simulating samples from an arbitrary known discrete distribution. We will use this command in what is to follow. Simulating a sample from an arbitrary continuous random variable is also possible. Suppose a vendor stocks four types of pens, each sold for $2., $3.5, $6, and $10. Sup- pose X keeps track of revenue from a single sale, and we know that X has the following distribution: x 246 10 P(X=x) .3 .35.25.1 1. Compute = E(X) and o= V ar(X) (this does not require any simulations). 2. Assume that every sale of a pen is independent from any other sale. Further assume that the probability distribution for every sale is given by X (for example sales on one day are independent from sales on any other day). Write code to simulate an experiment that allows you to "find" the distribution of the average earnings of the vendor assuming that he sells exactly n pens, where n = 2,6,12,20,100,150. Notice that sampling once for a fixed value of n does not allow you to "find" the distribution of the (sample) average. You have to simulate picking a sample of size n many time. Use the 'replicate' function for this with the number replicates B set to 8000. Summarize your findings by following the outline given below: 3. For each n, suppose Xn is the sample mean when working with sample of size n. Using the simulation: (a) compute the sample mean Xn and the sample standard deviation sXn. (b) compute the histogram for the distribution of Xn (for the 8000 replicates). (c) Write a short summary of your observations from this experiment. You could consider commenting on: i. The effect of increasing the sample size on the sample mean and it's distribution ii. The effect of increasing the number of replicates on the accuracy distribution of Xn approximated by the simulation.
Step by Step Solution
★★★★★
3.44 Rating (154 Votes )
There are 3 Steps involved in it
Step: 1
However I can provide guidance on how to approach the problem To calculate the expected value u and ...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