Reference no: EM13765589
Problem 1
The goal of this simulation problem is to examine how accurate the normal approximation to binomial is without the continuity correction.
Create a function that takes in x (the number of successes we are interested in), n the total sample size, p the proportion of successes, and Which Way which will take on characters "<", ">","<=",">=". This function should perform the following steps:
Step i. Find the exact probability we are interested in using the built in R function pbinom (see handout for details). Notice you should have an if else chain which calculates the probability based on Which Way. Call this value True Prob.
Step ii. Inside the if else chain, you should also calculate the normal approximation to binomial for the value of x. Do not implement the continuity correction. Call this value Approx Prob.
Step iii. Your function should output the difference between the exact probability and the approximate probability. Then, use your function to calculate the absolute value of the difference between the exact and approximate probability for the following probabilities and parameters:
(a) P(X < 7) for n = 15, p = 0.40
(b) P(X ≥ 5) for n = 30, p = 0.20
(c) P(X ≤ 10) for n = 50, p = 0.25
(d) P(X > 50) for n = 200, p = 0.10
Problem 2
The goal of this simulation problem is to examine how accurate the normal approximation to binomial is with the continuity correction.
Create a function that takes in x (the number of successes we are interested in), n the total sample size, p the proportion of successes, and Which Way which will take on characters "<", ">","<=",">=".
Notice that you should be able to modify your previous function (give it a new name though), and this time implement the continuity correction. Then, use your function to calculate the absolute value of the difference between the exact and approximate probability for the following probabilities and parameters:
(a) P(X < 7) for n = 15, p = 0.40
(b) P(X ≥ 5) for n = 30, p = 0.20
(c) P(X ≤ 10) for n = 50, p = 0.25
(d) P(X > 50) for n = 200, p = 0.10
Problem 3
This problem will use your functions from Problem 1 and Problem 2 to see how the approximations perform when n increases. Your function should take in a vector of sample sizes all.n, the probability of success p, and Which Way which will take on characters "<", ">","<=",">=".
Create a function that calculates the following binomial probability:
P(X ≤ (n/2)) and returns a matrix of all. n rows, and two columns; the first column being the difference between the actual probability and the normal approximation to binomial without the continuity correction for all values in all. n, and the second being the difference between the actual probability and the normal approximation to binomial with the continuity correction for all values in all. n.
Hint: sapply will automatically create a matrix if you return two values in your sapply loop. If it is the reverse of what you want, you can use X = t(X) to flip the matrix.
Then, use your function to do the following:
(a) For all.n = seq(10,400,2), p = 0.50, and the appropriate value of WhichWay, use your function to get back a large matrix of the differences. Do not print out this matrix!. Find the mean of each column and report the two means.
(b) Then, create a histogram of the differences between the actual and approximate probabilities for each method (with and without continuity). Report these two histograms (make sure you label them!).
(c) Also create two separate line plots where the values of all.n are on the x-axis, and the difference between the actual and approximate probabilities are on the y-axis. Report the two line graphs (make sure you label them!) Notice the default axis limits.
(d) Do you think the continuity correction is worth implementing? I.e, if you were approximating a binomial probability with a normal distribution, would you use the continuity correction? You can use parts (a), (b) and (c) to support your answer.
Describing your personal criminological theory
: Write a 700- to 1,050-word paper describing your personal criminological theory. Address the following in your paper: How would you explain the occurrence of crime and why people commit crime
|
Estimate the quantity of connectivity routers-switches
: Your organization opened seven new branch offices in five states. Each branch office has five floors. All the branch offices use the same Internet domain name. The organization has approximately 25 servers and anticipates that an additional 30 ser..
|
Product using the production method
: Assuming Sunny Day accounts for the by product using the production method, what is the inventoriable cost for each product and Sunny Day's gross margin?
|
Explain why many children growing up in poor families
: explain why many children growing up in poor families succeed in school and in life citing your Learning Resources for this week to validate your thinking and ideas.
|
Create a function that takes in x
: Create a function that takes in x (the number of successes we are interested in), n the total sample size, p the proportion of successes, and Which Way which will take on characters " "," =". This function should perform the following steps:
|
Identification and analysis and effective decision-making
: Considering the context as described above, how do organizations - in terms of culture, structure, and traditional ways of doing things (processes), impact both risk identification and analysis (RIA) and effective decision-making
|
Managing health care quality issue
: Write clearly and concisely about health care management using proper writing mechanics.
|
Identify the philosophical basis for each theory
: Write a 1,050- to 1,750-word paper in which you evaluate your selected criminological theory. Identify the philosophical basis for each theory
|
Define the accounting equation
: Define the accounting equation. Define, explain, and example the following: Asset, Liability, Equity, Revenue, and Expense.
|