R CODE PROGRAM
1. Suppose we want to simulate an experiment that can take outcomes 1; : : : ; n with probabilies p1; : : : ; pn. To be specic, suppose the R-vector p=c(.1,.2,.3,.35, .02, .03) gives the desired probabilities. Write R code that produces a number from 1 to 6 with the given probabilities, without using if statements. I recommend using the R command cumsum to do this, though there many possible approaches.
2. Suppose we are interested in P(A) for some event A. While the n^(1/2) rule
is simple, a better 95% confidence interval is given by
p +- 1.96((p(1-p)/n)^(1/2))
where ^p is still the proportion of times A occurs in our sample. This
confidence is smaller, which is better, but still contains the true probability
about 95% of the time.
Suppose our event of interest has P(A) = 1/10.
(a) Simulate 300 trials of the experiment and print out the resulting
confidence interval using the formula above.
(b) In your simulation above, for each trial, 1,. . . , 300, plot the upper
and lower endponts of the confidence interval. That is, if n is the
number of trials done so far, and un and ln are the upper and lower
limits of the confidence interval based on n trials, plot the points
(x; y ) = (n; Un ) and (x; y ) = (n; Ln ) for n = 1; : : : ; 300.
(c) Repeat the experiment above 1000 times and compute the fraction of
the time the confidence interval contains the true probability, 1/10.
This should happen about 95% of the time.
R CODE PROGRAM 1. Suppose we want to simulate an experiment that can take outcomes 1;...
Ps A random experiment can result in one of the outcomes (a b, dh with respective probabilities of o2, 02, 05.0.1. Let A denote the event (a. b). B the event (b, c, d and C the event (d). 1) Find P(A U C. 2) P(A intersection B) Each sample of water has a 5% chance of containing a particular organic pollutant Assume that the samples are independent with regard to the presence of the pollutant. Find the probability that...
THTCos (200Tt) -oo<t< oo. We want to convert = {0,1,2,...} Problem 1. Suppose we have a continuous-time signal r(t) (t) into a discrete-time signal yn] where we sample the signal every t= nT, seconds for n a. Determine the frequency fo of the cosine in Hertz and its corresponding period (T = 1/fo). b. Plot the continuous signal rt) for t = [0,4T] seconds so that four periods of the signal are plot command) plotted (use the (0, 1, 2,...
What is the code and result in Rstudio or R 1. Suppose we have a random sample 1.12, 0.44, -1.49, 0.02, 0.81, -1.34,1.34, 0.51,-0.12, 0.97. (a). Use two methods to find the sample mean (b). Use two methods to find the sample variance. (c). Find the sample standard deviation. 2. We can use function rt(n 100, df 2) to generate a random sample from a t-distribution with two degrees of freedom. The sample size is n 100. (a). Generate a...
NOTE: NEED HELP FINDING TWO QUESTIONS FOR LOWER AND UPPER BOUND 1) The manufacturer of hardness testing equipment uses steel-ball indenters to penetrate metal that is being tested. However, the manufacturer thinks it would be better to use a diamond indenter so that all types of metal can be tested. Because of differences between the two types of indenters, it is suspected that the two methods will produce different hardness readings. The metal specimens to be tested are large enough...
4. In class, we analyzed Buffon's needle experiment. We showed that if a large sheet of paper has parallel lines that are 1 inch apart, and we throw a needle of length 1/2 inch at it, the probability that the needle hits a line is 1/ . We can estimate by throwing many needles and seeing how many throws hit a ine. Suppose we throw a needle n times, and each throw is independent. Let X be the number of...
In class, we analyzed Buffon's needle experiment. We showed that if a large sheet of paper has parallel lines that are 1 inch apart, and we throw a needle of length 1/2 inch at it, the probability that the needle hits a line is l/r. We can estimate π by throwing many needles and seeing how many throws hit a line. Suppose we throw a needle n times, and each throw is independent. Let X be the number of throws...
Problem 6 Five applicants for a job are ranked according to ability, with being the best. These rankings are unknown to an employer, who simply hires two applicants at random. What is the probability that this employer hires exactly one of the two best applicants? Problem 7 Five motors ( through 5) are available for use, and motor 2 is defective. Motors 1 and 2 come from supplier I, and motors 3, 4, and 5 come from supplierIL. Suppose two...
Suppose observations X1, X2,.. are recorded. We assume these to be conditionally independent and exponen- tially distributed given a parameter θ: Xi ~' Exponential(θ), for all i 1, . . . , n. The exponential distribution is controlled by one rate parameter θ > 0, and its density is for r ER+ 1. Plot the graph of p(x:0) for θ 1 in the interval x E [0,4] 2. What is the visual representation of the likelihood of individual data points?...
If you can help me with 1-6 that would be great thank you! Don't ANSWER THIS THIS WAS BY MISTAKE SORRY Don't ANSWER THESE THEY WERE POSTED BY MISTAKE!!!!! Scenario 1: Sexes of birds In an ecological study of the Carolina Junco, 53 birds were captured from a certain population; of these, 40 were male. Is this evidence that males outnumber females in the broader population? The researchers used this sample data to conduct a test of the hypotheses below......
Suppose the salinity of water samples taken from 3 new and separate sites in the Bimini Lagoon was measured with the results given below: Site 1: 49.59 49.60 54.11 50.06 47.42 45.40 42.32 Site 2: 54.66 54.67 59.74 55.19 52.22 49.95 46.50 54.69 54.95 45.04 54.88 54.02 Site 3: 45.65 45.66 50.72 46.18 43.22 40.95 37.50 45.68 45.94 36.05 45.87 Basic Statistics for the 3 samples: Level N Mean SD 1 7 48.36 3.77 2 12 53.04 4.07 3 11...