Skip to content

Stats 243 Homework

STA371G Homework Assignment 3 (40 Points. Due in class on Wednesday, 02/18/2015. Group homework.) Please write down the NAME and EID of each group member. Each group consists of up to three members. Problem 1 Read the report of Anzalone Liszt Grove Research on the NSA Surveillance Programs (http://www.algpolling.com/#!memos/cjna): “The public strongly supports... This memo is based on the results of a national poll conducted by Anzalone Liszt Grove Research. The poll of N=803 adults was conducted November 11-17, 2013. At least 30% of all interviews were conducted via cell phone and interviews were conducted in English and Spanish. The margin of error for the poll is plus or minus 3.5 percentage points at the 95% level of confidence.” (a) Can you explain why the margin of error for the poll is ±3.5% at the 95% level of confidence? (hint: the value of p(1 − p) is largest when p = 0.5) The standard error associated with the sample proportion pˆ as an estimate of the true proportion p is r pˆ(1 − pˆ) spˆ = , n where n is the sample size. We estimate the population proportion p with the sample proportion pˆ, and the (approximate) 95% confidence interval is r pˆ(1 − pˆ) pˆ ± 2 . n The margin of error is the largest when pˆ = 0.5, which is r 0.5(1 − 0.5) ±2 = ±3.5% n = 803 at the 95% level of confidence. (b) If Anzalone Liszt Grove Research conducts another poll of N = 8, 000 adults, what would be the margin of error at the 95% level of confidence? The margin of error is the largest when pˆ = 0.5, which is about r 0.5(1 − 0.5) ±2 = ±1.1% n = 8000 at the 95% level of confidence. 1 Problem 2 According to the official Federal Election Commission report for the presidential election in 2012, out of a total of 7,993,851 votes in Texas, President Barack Obama received 3,308,124 votes. (a) If you randomly survey 1000 Texas residents who had voted in the 2012 presidential election, can you predict the distribution of the number of votes for President Obama among these 1000 Texas voters? Will you be surprised to find out that more than 500 of them voted for President Obama? (Hint: using the normal approximation to the binomial distribution.) The proportion of votes for President Obama in Texas in the 2012 election is p= 3, 308, 124 = 0.414 (or 41.4%). 7, 993, 851 As the number of voters 7, 993, 851 is much larger than the sample size n = 1000, we can consider the number of votes for President Obama in a random sample of n = 1000 to be binomial distributed as X ∼ Binomial(n = 1000, p = 0.414). Since n is large and p is close to neither 0 nor 1, we may safely approximate the binomial distribution with a normal distribution with mean np and variance np(1−p), which can be expressed as X ∼ N (np, np(1 − p)) = N (413.8, 15.62 ). Thus we are 95% confident that the number of votes for President Obama from a random sample of n = 1000 Texas voters is between [382, 445] Note that X ≥ 500 is outside [382, 445] and 500−413.8 = 5.5. As 500 is over 5 standard 15.6 deviation away from the mean, P (X ≥ 500) would be very close to zero. Thus we would be very surprised to find out X ≥ 500. (b) According to http://www.politico.com/2012-election/results/president/texas/, In Dallas County, TX, President Obama received 57.1% of the votes in the 2012 presidential election. If you randomly survey 100 residents of Dallas County who had voted in the 2012 presidential election, can you predict the distribution of the number of votes for President Obama among them? Will you be surprised to find out no more than 50 votes for President Obama? Similar to the analysis for Problem 6.(b), the number of votes X can be considered distributed as X ∼ Binomial(n = 100, p = 0.571) Approximately, we have X ∼ N (100 ∗ 0.571, 100 ∗ 0.571 ∗ (1 − 0.571)) = N (57.1, 4.952 ). 2 Thus we are 95% confident that the number of votes for President Obama from a random sample of n = 100 Dallas County voters is between [47, 67] Note that X = 50 is between [47, 67]. Further calculating P (X ≤ 50) using pnorm(50, 57.1, 4.95) in R, or 1 − N ORM DIST (50, 57.1, 4.95, T RU E) in Excel, we find that P (X ≤ 50) = 7.6%. As P (X ≤ 50) happen with a probability that is not small, we are usually not surprised to find out that X is no more than 50. Problem 3 A manufacturer of automobile batteries claims that the distribution of the lifetimes of its best battery has a mean of 54 months and a standard deviation of 6 months. Suppose a consumer group decides to check the claim by purchasing a sample of 50 of these batteries and subjecting them to tests that determine their lifetimes. Assuming the manufacturer’s claim is true, what is the probability that the consumer group’s sample has a mean lifetime of 52 months or less? The battery lifetime is normal distributed as X ∼ N (54, (6)2 ). The sample size is n = 50. The distribution of the sample mean can be expressed as  2 ! 6 x1 + · · · + x50 ∼ N 54, √ X= . 50 50 Thus the probability that the sample has a mean lifetime of 52 months or less is ! X − 54 52 − 54 P (X < 52) = P < 6 6 √ 50 √ = P (Z < − 50/3) √ 50 = 0.92% Problem 4 A soft drink machine is regulated so that the amount dispensed is normally distributed with mean µ = 7.00 ounces and standard deviation σ = 0.50 ounces. If samples of nine cups are taken, what is the probability that the mean of a particular sample falls between 6.90 and 7.05 ounces? 3   2 1 2 = ( ) If X ∼ N (7, (0.5)2 ) and n = 9, then X ∼ N 7, (0.5) . 9 6 6.9 − 7 X −7 7.05 − 7 < < ) 1/6 1/6 1/6 = P (−0.6 < Z < 0.3) P (6.9 < X < 7.05) = P ( = P (Z < 0.3) − P (Z ≤ −0.6) = 0.344 Problem 5 Read the “Amore Frozen Foods, UVA-QA-0317” case in the course packet. The primary question to answer in the case is: Should Mr. Jenkins lower the fill target to 8.22 ounces per pie from the current target of 8.44 ounces per pie? The information given below is obtained from the case and will be helpful in answering the above question. Information given in the case: 1. The filling device fills to target with a standard deviation of 0.22 ounces and the amounts are normally distributed. 2. The five sample pies’ weights are independent. 3. The production rate is 1,000 dozen pies every 20 minutes. 4. The monthly production is 60 20-minutes batches so annual production is 60×12 = 720 batches. 5. Rejected batches are first sold at the Thrift Store and then donated to charity once the Thrift Store demand has been filled. 6. The Thrift Store demand is 60 dozen pies per week. 7. The price of pies sold at wholesale is $4.50 per dozen. 8. The price of pies sold at the Thrift Store is $3.60 per dozen. 9. The cost of ingredients at the 8.44 ounce target fill rate is $1.82 per dozen pies. The cost of ingredients at the 8.22 ounce target fill rate is proportional (i.e. (8.22/8.44)$1.82 = $1.77 per dozen pies). 10. The cost of packaging is $0.62 per dozen pies. 11. The cost of labor and overhead is $0.56 per dozen pies. 4 FDA Approved Weight Control System The FDA approved weight control system for Amore Frozen Foods specifies that a 20 minute batch must be rejected if the average of five sample pies taken at the beginning of the batch run is less than eight ounces. If the fill target is 8.22 ounces, answer the following questions: (a) What is the probability that a given batch will be rejected? 2 = (0.22)2 ). A given batch Let X represent the weight of a pie. Then X ∼ N (8.22, σX will be rejected if the sample mean of the first five pies from the batch weighs less than 8 ounces. 2 = For a sample of size n = 5, X ∼ N (8.22, σX 2 σX n = (0.22)2 5 = (0.0984)2 ) Therefore, X − 8.22 8.00 − 8.22 < ) 0.0984 0.0984 = P (Z < −2.236) P (X < 8.00) = P ( = 0.0127 This implies there is a 1.27% chance that a given batch will be rejected. (b) How many batches over the course of a year do you expect to be accepted and how many do you expect to be rejected? Expected number of rejected batches per year = (Probability of rejecting a batch) × (Number of batches) = (0.0127) × (720 batches per year) = 9.14 batches per year. Expected number of accepted batches per year = (Probability of accepting a batch) × (Number of batches) = (1 − 0.0127) × (720 batches per year) = 710.86 batches per year. Please note that these are the expected number of batches that will be rejected and accepted in a year. It represents the average number of batches that will be rejected and accepted if the process is repeated for many years. The actual number of batches that are rejected in a given year will be an integer number. However, if we are 5 interested in how the process behaves over time (i.e. we want to maximize profits over time) it makes sense to analyze the expected (average) number of batches that will be rejected per year in the long run. (c) What is the expected annual revenue that will be obtained from selling the accepted batches at wholesale? Expected wholesale revenue = (Number of batches sold at wholesale per year) × (Number of dozen pies per batch) × (Price per dozen pies) = (710.86 batches) × (1000 dozen pies per batch) × ($ 4.50 per dozen) = $ 3,198,870 per year. (d) What is the expected annual revenue that will be obtained from selling pies at the Thrift Store? Weekly demand at the Thrift Store is 60 dozen pies per week. Thus, Annual demand at the Thrift Store = (Number of pies sold per week) × (52 weeks per year) = (60 dozen pies per week) × (52 weeks per year) = 3,120 dozen pies per year. Therefore, Expected annual revenue at the Thrift Store = (Number of pies sold per week) × (Price per dozen) = (3,120 dozen pies per year) × ($ 3.60 per dozen) = $ 11,232 per year. (e) How many pies do you expect to be donated annually to charity? It is expected that 9.14 batches per year will be rejected. Thus, Expected number of rejected pies per year = (Number of rejected batches per year) × (1000 dozen pies per batch) = (9.14 batches per year) × (1000 dozen pies per batch) = 9,140 dozen pies per year. The annual demand at the Thrift Store is only 3,120 dozen pies per year. Therefore, Expected number of pies to be donated to charity per year = (Expected number of rejected pies per year) − (Annual demand at the Thrift Store) = (9,140 dozen pies per year) − (3,120 dozen pies per year) = 6,020 dozen pies per year. 6 (f ) What are the annual ingredient costs? What are the annual packaging costs? What are the annual labor and overhead costs? Annual ingredient costs = (Number of batches per year) × (Number of dozen pies per batch) × (Ingredient cost per dozen pies) = (720 batches) × (1000 dozen pies per batch) × (( 8.22 8.44 ) × $1.82 per dozen pies) = $ 1,276,243 per year. Annual packaging costs = (Number of batches per year) × (Number of dozen pies per batch) × (Packaging cost per dozen pies) = (720 batches) × (1000 dozen pies per batch) × ($ 0.62 per dozen pies) = $ 446,400 per year. Annual labor and overhead costs = (Number of batches per year) × (Number of dozen pies per batch) × (Labor and overhead cost per dozen pies) = (720 batches) × (1000 dozen pies per batch) × ($ 0.56 per dozen pies) = $ 403,200 per year. (g) What is the expected profit? We first need to compute expected annual revenue and annual costs. Expected annual revenue =(Expected wholesale revenue) + (Expected Thrift Store revenue) = $3, 198, 870 + $11, 232 = $3, 210, 102. Annual costs =(Annual ingredient costs) + (Annual packaging costs) + (Annual labor and overhead costs) = $1, 276, 243 + $446, 400 + $403, 200 = $2, 125, 843. Therefore, Expected annual profit =(Expected annual revenue) − (Annual costs) = $3, 210, 102 − $2, 125, 843 = $1, 084, 259. If the fill target is 8.44 ounces, answer the following questions: 7 (h) For practical purposes, why is the probability essentially zero that an individual batch will be rejected? (You should do a probability calculation to answer this question.) 2 = (0.22)2 ). A given batch Let X represent the weight of a pie. Then X ∼ N (8.44, σX will be rejected if the sample mean of the first five pies from the batch weighs less than 8 ounces. 2 = For a sample of size n = 5, X ∼ N (8.44, σX 2 σX n = (0.22)2 5 = (0.0984)2 ). Therefore, 8.00 − 8.44 X − 8.44 < ) 0.0984 0.0984 = P (Z < −4.47) P (X < 8.00) = P ( This probability is zero for practical purposes since -4.47 is so far out in the left tail of the normal distribution. (i) What is the expected annual revenue that will be obtained from selling the accepted batches at wholesale? Expected wholesale revenue = (Number of batches sold at wholesale per year) × (Number of dozen pies per batch) × (Price per dozen pies) = (720 batches) × (1000 dozen pies per batch) × ($ 4.50 per dozen) = $ 3,240,000 per year. (j) What is the expected annual revenue that will be obtained from selling pies at the Thrift Store? No pies will be sold at the Thrift Store since there are no rejected batches. Therefore, Expected annual revenue at the Thrift Store = $ 0. (k) How many pies do you expect to be donated annually to charity? No pies will be donated to charity since there are no rejected batches. (l) What are the annual ingredient costs? What are the annual packaging costs? What are the annual labor and overhead costs? Annual ingredient costs = (Number of batches per year) × (Number of dozen pies per batch) × (Ingredient cost per dozen pies) = (720 batches) × (1000 dozen pies per batch) × ($ 1.82 per dozen pies) = $ 1,310,400 per year. 8 Annual packaging costs = (Number of batches per year) × (Number of dozen pies per batch) × (Packaging cost per dozen pies) = (720 batches) × (1000 dozen pies per batch) × ($ 0.62 per dozen pies) = $ 446,400 per year. Annual labor and overhead costs = (Number of batches per year) × (Number of dozen pies per batch) × (Labor and overhead cost per dozen pies) = (720 batches) × (1000 dozen pies per batch) × ($ 0.56 per dozen pies) = $ 403,200 per year. (m) What is the expected profit? We first need to compute expected annual revenue and annual costs. Expected annual revenue =(Expected wholesale revenue) + (Expected Thrift Store revenue) = $3, 240, 000 + $0 = $3, 240, 000. Annual costs =(Annual ingredient costs) + (Annual packaging costs) + (Annual labor and overhead costs) = $1, 310, 400 + $446, 400 + $403, 200 = $2, 160, 000. Therefore, Expected annual profit =(Expected annual revenue) − (Annual costs) = $3, 240, 000 − $2, 160, 000 = $1, 080, 000. What is your recommendation to Mr. Jenkins regarding the appropriate fill target? Why? The fill target should be set to 8.22 ounces because the expected profit is higher than when the fill target is set to 8.44 ounces. Do you have any suggestions regarding the setting of the fill target to improve profits even further? To further improve expected profits, other fill targets should be analyzed between 8.00 and 8.44 to determine where expected profit is maximized. This can be done easily using R or an Excel spreadsheet by setting µ to values between 7.70 and 9.00 using increments of 0.01 (say) and then computing the expected profits for each µ. The R code to find the best filling target and the maximum expected profit can be found at the course website. 9 BestFillingTarget = 8.26 MaximumExpectedProfit = 1,105,282 Table To Summarize Annual Revenues, Costs and Profits For 8.22 and 8.44 Ounce Fill Targets 8.22 Ounce Target Wholesale Revenue 710.86 batches 1000 dozen pies per batch $4.50 per dozen = $3,198,870 Thrift Store Revenue 3.12 batches 1000 dozen pies per batch $3.60 per dozen = $11,232 Revenue Ingredient Cost $3,210,102 = $3,240,000 0 batches 1000 dozen pies per batch $3.60 per dozen = $0 $3,240,000 720 batches 1000 dozen pies per batch $1.82 per batch 720 batches 1000 dozen pies per batch $0.62 per batch 720 batches 1000 dozen pies per batch $0.62 per batch = $446,400 Labor and Overhead Costs 720 batches 1000 dozen pies per batch $4.50 per dozen 720 batches 1000 dozen pies per batch [(8.22/8.44) $1.82] per batch = $1,276,243 Packaging Cost 8.44 Ounce Target 720 batches 1000 dozen pies per batch $0.56 per batch = $403,200 = $1,310,400 = $446,400 720 batches 1000 dozen pies per batch $0.56 per batch = $403,200 Total Costs $2,125,843 $2,160,000 Profit $1,084,259 $1,080,000 15 10 500000 0 −2000000 −1000000 Profit 7.8 8.0 8.2 8.4 8.6 FillingTargets 11 8.8 9.0

Help

Statistics 243

Fall 2010


Syllabus and Guidelines for Assignments

Assignments

  1. Assignment 1 (in PDF) due Oct 4, 2010
  2. Assignment 2 (in PDF) due Nov 8, 2010
  3. Assignment 3 (in PDF) due Dec 3, 2010
  4. Assignment 4 (in PDF) due Dec 10, 2010
Programs from class 12/03: mg.c testdl.c fn.c sim.r

Connecting to the SCF System Remotely

An Introduction to R

Using the R Standalone Math Library

Calling C from R and Matlab (pdf)

Examples of calling C from R and Matlab (gzipped tar file)


C programs for domat example from 12/1 class

findnr example from class, 11/12

Debugging and Profiling R programs (slides)

Building R Packages (slides)

Slides for a more detailed introductory course to R

Data and Paper demonstrating Jacobean and residual computation for nonlinear regression

A Note about Subroutine Libraries

The basics of the bash shell htmlpdf

Sample programs

UNIX Supplement

C Supplement

Some WWW Resources (from Stat 296)

Using C programs in matlab

C program to calculate probabilities from Kolmogorov-Smirnoff test

A Tutorial on Make (in postscript)

The Perils of Floating Point, by Bruce M. Bush. Uses FORTRAN examples, but well worth reading.

What Every Computer Scientist Should Know about Floating Point Arithmetic, by David Goldberg. Similar to Bush's paper, but with a bit more detail.

Fixing the Backspace Key in emacs

Information about Free Software for Numerical Computation

Frequently Asked Questions from comp.lang.c

An Excellent Tutorial on Pointers and Arrays in C by Ted Jensen

C Library Reference Guide, by Eric Huss

A Proof of the Rejection Technique (postscript)(PDF)

A Note about using the Cholesky Decomposition for transforming random variables (postscript)(PDF)

Random Number Generators

George Marsaglia's "Mother of all RNGs" (C code with comments)
Example of a Cryptographic Random Number Generator
Using a Lava Lamp to Generate Random Numbers
A USB or PCI device to generate true random numbers
Phil Spector (link to my home page) spector@stat.berkeley.edu