Two pea plants are crossed. One is homozygous for white flowers and the other is heterozygous for purple flowers. Both are heterozygous for being tall plants. In pea plants, tall is dominant to short, and purple flowers are dominant to white.
Fill out the table below for the probability of each possible phenotype. Report probability as a decimal rounded to four places (e.g. 0.1250, not 1/8 or 12.5%).
| Phenotype | Probability |
| tall purple | |
| short purple | |
| tall white | |
| short white |
In a population of 150 pea plants, there are 50 tall-purple plants, 18 short-purple plants, 62 tall-white plants, and 20 short-white plants. In order to test if the two traits are experiencing independent assortment researchers would perform a chi squared test.
1.) The (null/alternative) hypothesis states that the two genes are independently assorted while the (null/alternative) hypothesis states the two genes are dependent.
2.) What is your calculated Chi Squared statistic?
3.) What is the corresponding P value?
4.) Do you fail to reject or reject the null hypothesis?
5.) As a result of this statistical analysis, it is possible to conclude that pea plant height and pea plant blossom color (are or are not) linked traits.
In: Statistics and Probability
Design a function called middle_value, that takes 3 integers, and returns the integer with the middle value. If there is a tie, any of the possible middle values can be returned. Example: middle_value(1, 2, 8) -> 2 middle_value(9, 7, 7) -> 7 middle_value(3, 3, 3) -> 3
Design a function called combine_strings that takes two phrases and appends the longer string onto the back of the shorter one with no space between the two phrases joined. Example: If the phrases are “thought” and “after” the function should return “afterthought”, or “sea” and “food” would return “seafood”.
Design a function called get_letter_at that takes a phrase and a
number and returns the letter at the phrase at the given index
(note that 0 would return the first letter in the phrase). If the
number is too large, then just return an empty string: “ ”.
Examples:
get_letter_at("Anthony", 0) -> "A" get_letter_at("Anthony", 4) -> "o" get_letter_at("Anthony", 7) -> " "
Design a function called brightness_modifier that takes an integer value that is either 0, 1, 2, or 3 representing the brightness level of a smartphone (0 means screen is off, up to 3 which means full brightness). The function should return a decimal number representing the modifier that the brightness level will affect the lifetime of battery of the device. For example:
- 0 brightness does not affect the battery life at all (returns 1.0)
- 1 brightness returns a 0.9 (the battery will last 90% of maximum battery lifetime)
- 2 brightness returns a .75 (the battery lasts 75% of maximum battery lifetime)
- 3 brightness returns a .5 (the battery only last 50% of maximum lifetime)
Design a function called hours_remaining that takes two integers and a boolean as parameters and returns the total hours of battery life left. The parameters represent the percentage of battery life left, the brightness (0, 1, 2, 3) and whether the device is currently streaming video. This function MUST call and use the brightness_modifier function you designed for exercise 4.
The hours left is calculated by the following formula:
The amount of battery life left is calculated by the maximum battery life (15 hours – see the
CONSTANT defined at the top of the file) multiplied by percentage of battery left.
Applying the brightness_modifier to the total amount of battery life left.
If the phone is currently streaming video, the hours remaining is cut in half.
For example, given hours_remaining(80, 2, true) produces:
(Note the FULL_BATTERY_LIFE = 15 constant defined at the top of the
file) 15*80% = 12 hours of regular battery remaining.
12 hours remaining at 2 brightness level = 12*.75 modifier = 9
hours
9 hours of streaming video = 9*0.5 = 4.5 actual hours remaining
tests = 0
passed = 0
FULL_BATTERY_LIFE = 15
def main():
print('Assignment 3')
'''
Complete this assignment by doing the following
for each function:
- uncommenting one test function call in main
NOTE: each test function has at least one test,
but you should add additional tests to ensure
the correctness of your functions
- complete a full function design for each function
(write the documentation and define the function)
NOTE: follow the documentation provided for
implementing each function in the csc110-assign3.pdf
- process to the next function by doing the steps
outlined above until all functions are designed with
proper documentation, implementation and testing
'''
test_middle_value()
test_combine_strings()
test_get_letter_at()
test_brightness_modifer()
test_hours_remaining()
print("TEST RESULTS:", passed, "/", tests)
def test_middle_value():
print("beginning tests for middle_value...")
#TODO: add tests here (and erase this line if you want)
def test_combine_strings():
print("beginning tests for combine_strings...")
#TODO: add tests here (and erase this line if you want)
def test_get_letter_at():
print("beginning tests for get_letter_at...")
#TODO: add tests here (and erase this line if you want)
def test_brightness_modifer():
print("beginning tests for brightness_modifer...")
#TODO: add tests here (and erase this line if you want)
def test_hours_remaining():
print("beginning tests for hours_remaining...")
#TODO: add tests here (and erase this line if you want)
# (str, bool -> None)
# takes the name or description of a test and whether the
# test produced the expected output (True) or not (False)
# and prints out whether that test passed or failed
# NOTE: You should not have to modify this in any way.
def print_test(test_name, result_correct):
global tests
global passed
tests += 1
if(result_correct):
print(test_name + ": passed")
passed += 1
else:
print(test_name + ": failed")
# The following code will call your main function
# It also allows our grading script to call your main
# DO NOT ADD OR CHANGE ANYTHING PAST THIS LINE
# DOING SO WILL RESULT IN A ZERO GRADE
if __name__ == '__main__':
main()In: Computer Science
Test the given claim. Assume that a simple random sample is selected from a normally distributed population. Use either the P-value method or the traditional method of testing hypotheses.
Company A uses a new production method to manufacture aircraft altimeters. A simple random sample of new altimeters resulted in errors listed below. Use a 0.05 level of significance to test the claim that the new production method has errors with a standard deviation greater than 32.2 ft, which was the standard deviation for the old production method. If it appears that the standard deviation is greater, does the new production method appear to be better or worse than the old method? Should the company take any action?
negative 44−44,
7777,
negative 24−24,
negative 75−75,
negative 45−45,
1212,
1616,
5353,
negative 7−7,
negative 54−54,
negative 107−107,
negative 107−107
What are the null and alternative hypotheses?
A.
H0:
sigmaσless than<32.2
ft
H1:
sigmaσequals=32.2
ft
B.
H0:
sigmaσequals=32.2
ft
H1:
sigmaσgreater than>32.2
ft
C.
H0:
sigmaσequals=32.2
ft
H1:
sigmaσless than<32.2
ft
D.
H0:
sigmaσgreater than>32.2
ft
H1:
sigmaσequals=32.2
ft
E.
H0:
sigmaσequals=32.2
ft
H1:
sigmaσnot equals≠32.2
ft
F.
H0:
sigmaσnot equals≠32.2
ft
H1:
sigmaσequals=32.2
ft
Find the test statistic.
chi squaredχ2equals=nothing
(Round to two decimal places as needed.)
Determine the critical value(s).
The critical value(s) is/are
nothing.
(Use a comma to separate answers as needed. Round to two decimal places as needed.)
Since the test statistic is
▼
equal to
greater than
between
less than
the critical value(s),
▼
fail to rejectfail to reject
rejectreject
Upper H 0H0.
There is
▼
insufficient
sufficient
evidence to support the claim that the new production method has errors with a standard deviation greater than 32.2 ft.
In: Statistics and Probability
A random sample of 9 history students produced the following data,
| first test Score, x | second test Score, y |
| 12 | 38 |
| 23 | 36 |
| 41 | 19 |
| 66 | 66 |
| 35 | 40 |
| 17 | 44 |
| 72 | 40 |
| 19 | 72 |
| 30 | 78 |
where x measures the first test score and y measures the second test score. What is the estimate of the y = a x + b regression intercept coefficient?
In: Statistics and Probability
Randomly pair 4 keys {a, b, c, d} with 3 locks {a, b, c}. What is P(at least one match)?
In: Statistics and Probability
Propose an algorithm in C to match numbers / tokens (words) from one array to another array and pull out the matching numbers.
In: Computer Science
| Product | Cereal Name | Manufacturer | Calories | Sodium | Fiber | Carbs | Sugars | Cost/box | Weight/OZ | Protein | Cholesterol | |
| 53 | Rice Chex | Ralston Purina | 110 | 240 | 0 | 11 | 2 | 2.3 | 16 | 2 | 1 | |
| 54 | Rice Krispies | Kellogg | 110 | 290 | 0 | 12 | 3 | 2.4 | 16 | 2 | 2 | |
| 30 | Golden Grahams | General Mills | 110 | 280 | 0 | 16 | 9 | 2.5 | 16 | 2 | 1 | |
| 64 | Trix | General Mills | 110 | 140 | 0 | 18 | 12 | 1.35 | 18 | 2 | 3 | |
| 18 | Count Chocula | General Mills | 110 | 180 | 0 | 21 | 13 | 2.8 | 18 | 2 | 2 | |
| 61 | Total Corn Flakes | General Mills | 110 | 200 | 0 | 12 | 3 | 1.54 | 14 | 3 | 2 | |
| 39 | Kix | General Mills | 110 | 260 | 0 | 12 | 3 | 2.65 | 12.5 | 3 | 0 | |
| 48 | Puffed Rice | Quaker | 50 | 0 | 0 | 13 | 0 | 1.8 | 12 | 3 | 2 | |
| 44 | Nut & Honey Crunch | Kellogg | 120 | 190 | 0 | 15 | 9 | 2.4 | 14.5 | 3 | 0 | |
| 34 | Honey Comb | Post | 110 | 180 | 0 | 17 | 11 | 3.1 | 12 | 3 | 2 | |
| 29 | Fruity Pebbles | Post | 110 | 135 | 0 | 18 | 12 | 2.3 | 13 | 3 | 0 | |
| 41 | Lucky Charms | General Mills | 110 | 180 | 0 | 19 | 12 | 3.1 | 15.4 | 3 | 0 | |
| 10 | Cap'n'Crunch | Quaker | 120 | 220 | 0 | 20 | 12 | 1.8 | 18 | 3 | 0 | |
| 12 | Cinnamon Toast Crunch | General Mills | 120 | 210 | 0 | 15 | 9 | 3.3 | 16 | 4 | 1 | |
| 15 | Corn Chex | Ralston Purina | 110 | 280 | 0 | 12 | 3 | 2.6 | 14.5 | 5 | 0 | |
| 14 | Cocoa Puffs | General Mills | 110 | 180 | 0 | 21 | 13 | 2.9 | 14 | 5 | 2 | |
| 20 | Cream of Wheat | Nabisco | 100 | 80 | 1 | 10 | 0 | 3.1 | 14 | 1 | 1 | |
| 21 | Crispix | Kellogg | 110 | 220 | 1 | 12 | 3 | 2.1 | 14 | 1 | 2 | |
| 37 | Just Right Crunchy Nugget | Kellogg | 110 | 170 | 1 | 14 | 6 | 3 | 14 | 1 | 2 | |
| 17 | Corn Pops | Kellogg | 110 | 90 | 1 | 18 | 12 | 2.4 | 18 | 2 | 0 | |
| 24 | Froot Loops | Kellogg | 110 | 125 | 1 | 21 | 13 | 2.8 | 14 | 2 | 0 | |
| 49 | Puffed Wheat | Quaker | 50 | 0 | 1 | 5 | 0 | 3 | 14 | 3 | 0 | |
| 25 | Frosted Flakes | Kellogg | 110 | 200 | 1 | 17 | 11 | 2.4 | 18 | 3 | 0 | |
| 6 | Apple Jacks | Kellogg | 110 | 125 | 1 | 21 | 14 | 3.1 | 12 | 3 | 0 | |
| 58 | Smacks | Kellogg | 110 | 70 | 1 | 23 | 15 | 2.54 | 12.5 | 3 | 0 | |
| 59 | Special K | Kellogg | 110 | 230 | 1 | 12 | 3 | 2 | 18 | 4 | 0 | |
| 47 | Product 19 | Kellogg | 100 | 320 | 1 | 13 | 3 | 2.6 | 18 | 4 | 1 | |
| 23 | Double Chex | Ralston Purina | 100 | 190 | 1 | 13 | 5 | 3.5 | 14 | 4 | 0 | |
| 4 | Almond Delight | Ralston Purina | 110 | 200 | 1 | 15 | 8 | 2.3 | 14 | 4 | 0 | |
| 35 | Honey Graham Ohs | Quaker | 120 | 220 | 1 | 17 | 11 | 1.97 | 12 | 4 | 1 | |
| 16 | Corn Flakes | Kellogg | 100 | 290 | 1 | 11 | 2 | 1.8 | 12.5 | 6 | 0 | |
| 67 | Wheaties Honey Gold | General Mills | 110 | 200 | 1 | 15 | 8 | 2 | 14 | 6 | 1 | |
| 5 | Apple Cinn Cheerios | General Mills | 110 | 180 | 1.50 | 17 | 10 | 3.2 | 18 | 2 | 0 | |
| 36 | Honey Nut Cheerios | General Mills | 110 | 250 | 1.50 | 17 | 10 | 2.33 | 14 | 3 | 1 | |
| 45 | Oatmeal Raisin Crisp | General Mills | 130 | 170 | 1.50 | 17 | 10 | 2.3 | 14.5 | 4 | 2 | |
| 40 | Life | Quaker | 100 | 150 | 2 | 14 | 6 | 2.65 | 12.5 | 2 | 0 | |
| 11 | Cheerios | General Mills | 110 | 290 | 2 | 10.50 | 1 | 2.2 | 16 | 3 | 0 | |
| 38 | Just Right Fruit &Nut | Kellogg | 140 | 170 | 2 | 15 | 9 | 2.87 | 14.3 | 3 | 0 | |
| 22 | Crispy Wheat & Raisins | General Mills | 100 | 140 | 2 | 16 | 10 | 3.6 | 14 | 3 | 0 | |
| 50 | Quaker Oat Squares | Quaker | 100 | 135 | 2 | 14 | 6 | 2.6 | 14 | 5 | 0 | |
| 43 | Multi-Grain Cheerios | General Mills | 100 | 220 | 2 | 14 | 6 | 2.3 | 14.5 | 5 | 0 | |
| 13 | Clusters | General Mills | 110 | 140 | 2 | 15 | 7 | 2.3 | 18 | 5 | 1 | |
| 7 | Basic 4 | General Mills | 130 | 210 | 2 | 15 | 8 | 1.9 | 14 | 5 | 1 | |
| 52 | Raisin Squares | Kellogg | 90 | 0 | 2 | 13.50 | 6 | 2.3 | 18 | 6 | 0 | |
| 56 | Shredded Wheat | Nabisco | 80 | 0 | 3 | 7 | 0 | 1.86 | 14 | 1 | 1 | |
| 33 | Great Grains Pecan | Post | 120 | 75 | 3 | 13 | 4 | 2 | 14 | 1 | 0 | |
| 31 | Grape Nuts Flakes | Post | 100 | 140 | 3 | 13 | 5 | 1.76 | 16 | 1 | 1 | |
| 32 | Grape-Nuts | Post | 110 | 170 | 3 | 11 | 3 | 1.94 | 16.6 | 2 | 0 | |
| 63 | Total Whole Grain | General Mills | 100 | 200 | 3 | 11 | 3 | 3 | 12.5 | 2 | 2 | |
| 60 | Strawberry Fruit Wheels | Nabisco | 90 | 15 | 3 | 13 | 5 | 3.3 | 18 | 2 | 2 | |
| 55 | Shrdded Wht Spn Size | Nabisco | 90 | 0 | 3 | 8 | 0 | 1.76 | 18 | 3 | 1 | |
| 26 | Frosted Mini-Whests | Kellogg | 100 | 0 | 3 | 14 | 7 | 2.4 | 18 | 4 | 1 | |
| 42 | Mueslix Crispy Blend | Kellogg | 160 | 150 | 3 | 21 | 13 | 1.9 | 12 | 4 | 1 | |
| 66 | Wheaties | General Mills | 100 | 200 | 3 | 11.50 | 3 | 1.98 | 14 | 5 | 2 | |
| 65 | Wheat Chex | Ralston Purina | 100 | 230 | 3 | 12 | 3 | 1.65 | 16.5 | 5 | 3 | |
| 57 | Shredded Wheat n Bran | Nabisco | 90 | 0 | 4 | 9 | 0 | 2.65 | 14.5 | 1 | 1 | |
| 8 | Bran Chex | Ralston Purina | 90 | 200 | 4 | 14 | 6 | 2.25 | 14 | 1 | 2 | |
| 19 | Cracklin' Oat Bran | Kellogg | 110 | 140 | 4 | 15 | 7 | 2.7 | 14 | 3 | 1 | |
| 62 | Total Raisin Bran | General Mills | 140 | 190 | 4 | 22 | 14 | 2 | 14 | 4 | 1 | |
| 27 | Fruit & Fibre | Post | 120 | 160 | 5 | 16 | 10 | 3.1 | 14.5 | 2 | 1 | |
| 28 | Fruitful Bran | Kellogg | 120 | 240 | 5 | 20 | 12 | 3.6 | 14 | 2 | 0 | |
| 9 | Bran Flakes | Post | 90 | 210 | 5 | 13 | 5 | 1.9 | 14.5 | 4 | 1 | |
| 51 | Raisin Bran | Kellogg | 120 | 210 | 5 | 20 | 12 | 2.6 | 14.5 | 5 | 0 | |
| 46 | Post Nat. Raisin Bran | Post | 120 | 200 | 6 | 22 | 14 | 2.8 | 14 | 3 | 1 | |
| 2 | AlI-Bran | Kellogg | 70 | 260 | 9 | 13 | 5 | 3.5 | 15.4 | 4 | 2 | |
| 1 | 100% Bran | Nabisco | 70 | 130 | 10 | 14 | 6 | 3 | 16 | 4 | 1 | |
| 3 | All-Bran w/Extra Fiber | Kellogg | 50 | 140 | 14 | 10 | 0 | 2.2 | 14.5 | |||
2. Draw appropriate charts of your choice on 7 selected cereal brands for the amount of their Calories, Sugar, and Sodium used in their cereal.
6. Randomly select 30 Cereal Brands as your samples. Describe your sampling method. (EXCEL)
In: Statistics and Probability
Using the following 8 weeks of demand data to determine the best forecasting method. Compare 3 period simple moving average, 3 period weighted moving average and exponential smoothing. Week Sales 1 133 2 137 3 145 4 146 5 150 6 124 7 135 8 130
a) What is the MAD using the 3 period simple moving average (SMA) method
b) What is the forecast for Week 9 using the 3 period simple moving average forecasting method?
c) What is the MSE using the 3 period weighted moving average (WMA) (weights of 0.40, 0.35, and 0.25) method
d)What is the forecast for Week 9 using the 3 period weighted moving average (weights of 0.40, 0.35, and 0.25) forecasting method?
e) What is the MAPE using the exponential smoothing (ES) method (using α = 0.21)? (Assume the forecast for the first week is 133)
f) What is the forecast for Week 9 using the exponential smoothing (using α = 0.21) forecasting method?(Assume the forecast for the first week is 133)
g) Which of these methods is the best forecasting method? Choose one error measurement for comparison. Explain using quantitative values.
In: Statistics and Probability
Students are expected to have higher grades if they spend more time studying. An educational theorist collects data on 22 students and the number of hours they spend studying is:
In R: hours <- c(22.3, 22.8, 21.7, 21.3, 18.5, 20.2, 20.7, 18.2, 22.9, 21.5, 18.1, 19.8, 22.7, 22.9, 19.3, 20.8, 21.1, 18.8, 22.4, 18.2, 20, 23) Their grade average is: grades <- c(8.6, 8.5, 7.8, 9.1, 8, 10.2, 7.4, 8.8, 8.8, 8, 8.3, 8.8, 9.8, 9.1, 9.4, 7.4, 10.2, 7.1, 10.4, 7, 9.2, 10.7)
Is there evidence that students who spend more hours studying score higher grades?
(a) State a sensible null hypothesis
(b) State the precise definition of p-value and explain what “more extreme” means in this context
(c) Is a one-sided or two-sided test needed? justify
(d) Perform a linear regression using R and interpret
In: Statistics and Probability
Two Sample Hypothesis Test
Show all five steps in your analysis. To get full credit you must label the CV (critical value) and TV (Test Value) in your drawing. Use the p-value for this test.
A teacher claims that students retain more when reading a novel than when watching a movie version of the novel. Each student read a novel and watched a film version of a different novel. Then they were given a test on both the novel and the movie. A researcher randomly selected a sample of 8 students. Using a one sample statistical test on their differences, test the results at an alpha level of .05. The results are shown in the table below:
|
Student |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
|
Book |
92 |
80 |
88 |
75 |
82 |
90 |
84 |
76 |
|
Movie |
86 |
72 |
80 |
80 |
75 |
75 |
80 |
72 |
What type of test are you going to perform? ______________________________
In: Statistics and Probability