Problem C
Part 1
Suppose the number of bugs per 1,000 lines of code has a Poisson distribution with mean 4.5. Let’s find the probability of having more than 90 bugs in 20 sections of code, each 1,000 lines long. We’ll assume the different sections act independently in terms of bugs.
Please show the z-table lookup required to solve this problem if you didn’t have R, now show the R function call.
For the z-table lookup, we find the probability associated with a z-value greater than 0. This is exactly half the curve, meaning our probability is 0.5 (half).
Part 2
Part A
Generate 8 random numbers from a geometric distribution with p=.65.
Part B
Find the 94% confidence interval for
94% confidence interval:
In reality, for a geometric RV:
Part 3
Part A
Generate 8 random numbers from an exponential distribution with mean =32.
Part B
You are looking at the population of salmon in the Sacramento River and are interested in the weight of the salmon.
You catch and release 8 salmon and weigh them. Pretend that the weight data you collect for the 8 samples is the data from Part A where each number is the weight in lb.
Find the 94% confidence interval for the average weight salmon population
The ground truth value we created our data from is an exponential distribution with mean 32. This value is within our confidence interval, as we had a 94% probability of finding.
Part 4
Given two populations of salmon and tuna you have been told the length of the two fish has no difference however you sample the Sacramento river and see that the average length of tuna is 15in and salmon is 14in with st.dev of 1 and 2 respectively ( samples size of 15 and 20 respectively). Test the alternative hypothesis with .α =. 04
| Tuna | Salmon | |
|---|---|---|
| Sample Average ( | 15 | 14 |
| Sample Variance | 1 | 2 |
| Sample Size ( | 15 | 20 |
- State hypothesis
- Find 96% Confidence Interval Range
0 is not in this range, so we can reject our null hypothesis.
We can also test our alternative hypothesis like this:
- Find test statistic
- Analyze test statistic at our significance level
Since our test statistic is greater than our critical z-value (1.88, associated with a two tailed test with α=.04), we can reject our null hypothesis