Question

In: Statistics and Probability

In MAPLE or MATLAB A family with three children is chosen at random and the number...

In MAPLE or MATLAB

A family with three children is chosen at random and the number X of daughters is counted. Describe how to simulate an observation on X based on U ~ unif[0,1]. Then, simulate 20 observations on X.

Solutions

Expert Solution

Using Matlab.

The rand() function gives a random number in the range [0, 1] with a uniform distribution. Instead of directly using this function, we can use the randi() function which gives an integers in the range [1, n] with a uniform distribution where n is the first parameter to randi(). As we have 4 possiblilites (0, 1, 2, 3) for number of daughters, n = 4. We will also have to subtract one to get a number in [0, 3] range. So, the Matlab code will be:

>> randi(4,1,20)-1
ans =

   3   0   2   2   3   2   1   2   0   3   1   2   1   0   3   1   0   2   3   3

The first parameter to randi is the number of values we need. The second one is the number of rows. As we have passed one here, we will get a row vector. The third one is the number of columns. As we need 20 values, we pass 20 here.

Note: we can switch rows and columns to get a similar result as a column vector.

Note: We can get a similar result directly using rand(), but it will require some extra processing to get numbers in the right range:

>> fix(rand(1,20)*4)%4
ans =

   3   3   1   3   2   1   2   3   1   3   2   3   1   2   2   0   3   1   2   2

Here, rand() gives a number in [0,1] with uniform distribution. When we multiply by 4, we get a floating point number in [0. 4]. Using fix() we truncate the number to [0,4]. Note that we will be getting an integer with uniform distribution in [0,3] here. In a rare case when we get 4, we treat it as 0.

The first parameter to rand() is the number of rows. The second parameter to rand() is the number of columns.


Related Solutions

If one? three-digit number? (0 cannot be a left? digit) is chosen at random from all...
If one? three-digit number? (0 cannot be a left? digit) is chosen at random from all those that can be made from the following set of? digits, find the probability that the one chosen is not a multiple of 5 . (0,1,2,3,4,5,6)
Let X equal the number of female children in a three-child family. Among students who were...
Let X equal the number of female children in a three-child family. Among students who were taking statistics, 52 came from families with three children. For these families x = 0, 1, 2, and 3 for 5, 17, 24, and 6 families, respectively. (a) Conduct a Chi-square goodness-of-fit test to test the null hypothesis that the distribution of X is B(3, 0.5) at 0.05 significance level. (b) Conduct a Chi-square goodness-of-fit test to test the null hypothesis that the distribution...
A family decides to have children until it has three male children. Assuming ?(????) = ?(??????)...
A family decides to have children until it has three male children. Assuming ?(????) = ?(??????) = 0.5, a. what is the probability that the family has ? female children? b. Calculate ?(?) and ?(?).
A number between 1 and 10 is chosen at random . What is the probability of...
A number between 1 and 10 is chosen at random . What is the probability of getting a multiple of 5 or an even number?
9.1-5. Let X equal the number of female children in a three-child family. We shall use...
9.1-5. Let X equal the number of female children in a three-child family. We shall use a chi-square goodness-of- fit statistic to test the null hypothesis that the distribution of X is b (3, 0.5). (a) Define the test statistic and critical region, using an α = 0.05 significance level. (b) Among students who were taking statistics, 52 came from families with three children. For these families, x= 0, 1, 2, and 3 for 5, 17, 24, and 6 families,...
"What do you think is the ideal number of children for a family to have?" A...
"What do you think is the ideal number of children for a family to have?" A Gallup Poll asked this question of 1016 randomly chosen adults. Almost half (49%) thought two children was ideal.† We are supposing that the proportion of all adults who think that two children is ideal is p = 0.49. What is the probability that a sample proportion p̂ falls between 0.46 and 0.52 (that is, within ±3 percentage points of the true p) if the...
A girl who has two siblings is chosen at random and the number X of her...
A girl who has two siblings is chosen at random and the number X of her sisters is counted. Describe how to simulate an observation on X based on U ∼ unif[0, 1] in Matlab.
Estimate, by simulation, the average number of children there would be in a family if all people had children until they had a girl.
in R. Estimate, by simulation, the average number of children there would be in a family if all people had children until they had a girl. Do the same if all people had children until they had at least one boy and at least one girl. How many more children would you expect to find under the second scheme than under the first in 100,000 families? (Assume that girls and boys are equally likely.)
A GSS asked, "What do you think is the ideal number of children for a family...
A GSS asked, "What do you think is the ideal number of children for a family to have?" For the 555 males in the sample, the mean was 2.89 and the standard deviation was 1.77. Find the 95% confidence interval for the population mean. A. (2.743, 3.037) B. (2, 3) C. (3.243, 4.037) D. (0, 1)
it has been reported that the average number of children per family in the united staes...
it has been reported that the average number of children per family in the united staes is 2.3 per family. since the random variable "number of children"is discrete, justify reporting the value "2.3."
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT