Docsity

Stat 305 Lab 2: Analyzing PDFs and Hypothesis Testing with Histograms, Lab Reports of Statistics

Toggle sidebar
bg1
Stat 305 - Lab 2
Topics covered: Using Histograms to estimate probability density functions
(pdfs), One Sample Hypothesis testing, and Confidence Intervals
Qm* This is the way the problems you must answer are designated: with
'Q*' and bolded, m is a number.
1. Sampling from a normal distribution, N(μ,σμ,σ2)
The histogram can be used as an estimate to the probability density function
(pdf) of a continuous random variable. The estimate gets better as the sample
size increases. To see this, complete the following:
Sample from X ~ N(1,5) :
Generate a sample of size n = 10:
From the pull down menus, go to 'Statistics / Resampling & Simulation / Draw a
sample from a normal distribution
Name the new variable: 'nsamp'.
Enter '10' in observations and check off this option.
Enter 3 for the standard deviation. (Leave the option for specifying the
covariance structure unchecked.)
Enter 1 for the mean and check of the option of specifying the mean.
Plot the histogram of the data.
Find the sample mean and sample variance.
Generate a sample of size n = 1000:
In 'Statistics / Resampling & Simulation / Draw a sample from a normal
distribution'
Check off the option of 'Replace the current dataset'.
Enter '1000' in observations.
Plot the histogram of the data.
Find the sample mean and sample variance.
Generate a sample of size n = 10000:
In 'Statistics / Resampling & Simulation / Draw a sample from a normal
distribution’
Check off the option of 'Replace the current dataset'.
Enter '10000' in observations.
Plot the histogram of the data.
Find the sample mean and sample variance.
Q1* What happens the histogram of the data as we take larger and larger
samples? What happens to the sample mean and sample variance as you
pf3
pf4
pf5

Partial preview of the text

Download Stat 305 Lab 2: Analyzing PDFs and Hypothesis Testing with Histograms and more Lab Reports Statistics in PDF only on Docsity!

Stat 305 - Lab 2 Topics covered: Using Histograms to estimate probability density functions (pdfs), One Sample Hypothesis testing, and Confidence Intervals Qm This is the way the problems you must answer are designated: with 'Q' and bolded, m is a number.**

1. Sampling from a normal distribution, N(μ,σμ,σ^2 ) The histogram can be used as an estimate to the probability density function (pdf) of a continuous random variable. The estimate gets better as the sample size increases. To see this, complete the following: Sample from X ~ N(1,5) : Generate a sample of size n = 10: From the pull down menus, go to 'Statistics / Resampling & Simulation / Draw a sample from a normal distribution  Name the new variable: 'nsamp'.  Enter '10' in observations and check off this option.  Enter 3 for the standard deviation. (Leave the option for specifying the covariance structure unchecked. )  Enter 1 for the mean and check of the option of specifying the mean. Plot the histogram of the data. Find the sample mean and sample variance. Generate a sample of size n = 1000: In 'Statistics / Resampling & Simulation / Draw a sample from a normal distribution'  Check off the option of 'Replace the current dataset'.  Enter '1000' in observations. Plot the histogram of the data. Find the sample mean and sample variance. Generate a sample of size n = 10000: In 'Statistics / Resampling & Simulation / Draw a sample from a normal distribution’  Check off the option of 'Replace the current dataset'.  Enter '10000' in observations. Plot the histogram of the data. Find the sample mean and sample variance. Q1 What happens the histogram of the data as we take larger and larger samples? What happens to the sample mean and sample variance as you*

increase the sample size? What happens to the relationship between the Normal probability density function (μ,σpdf) and the histogram as you increase sample size?

2. Data: Download the three datasets parkingmeter.txt, flushot.xls, and speedoflight.txt from http://www.owlnet.rice.edu/~stat305/projects. Save the text file to computer Import data into STATA: In the pull down menus, click on 'File / Import / ASCII data created by spreadsheet' enter filename choose the tab delimited option, then click 'OK' About parkingmeter.txt: In May, 1978, Brink's Inc. was awarded a contract to collect coins from some 70,000 parking meters in New York City for delivery to the City Department of Finance. Sometime later, the City became suspicious that not all of the money collected was being returned to the city. This data was provided by the City's attorney. Assume that we know there was no theft before and after Brink's tenure. Variable Names: TIME: Months, May 1977 (1) to March 1981 (47) CON: Monthly collections by contractors ($) CITY: Monthly collections from meters near city hall made by city workers ($) BRINK: Months when contracting collector was Brink (1) or other (0) About flushot.txt For a local health clinic, 30% of its clients get a flu shot every year. The health clinic wants increase this number, so it sent fliers to its clients to encourage everyone to get a flu shot in time for protection against an expected flu epidemic. In a pilot follow-up study, 50 clients were randomly selected and asked whether they actually received a flu shot. A client who received a flu shot was coded with 1 and a client who did not receive a flu shot was coded 0. About speedoflight.txt Simon Newcomb measured the time required for light to travel from his laboratory on the Potomac River to a mirror at the base of the Washington Monument and back, a total distance of about 7400 meters. These measurements were used to estimate the speed of light. The dataset contains the estimated speed of light for 66 trials. (The measurements*0.001+24.8 are in millionths of a second.)

In 'Main' tab: enter variable name, the hypothesized mean (mean of money collected when contractor was not Brink), and the appropriate confidence level. In 'by/if/in' tab, restrict the test to observations where brink==1, since the mean we are testing is the mean of money when Brink was the contractor. Q3 Based on the hypothesis tests, do you think that there is evidence that Brink employees stole money from parking meters? Explain. Q4 If you were on the defense team, what arguments could you use to counter the results of the hypothesis test? Using the Flu Shot data: Q5* What is the sample proportion of people who got flu shots? Q6* Construct a hypothesis test for the following question: Did the health clinic's fliers increase the proportion of people who got flu shots? I.e. What are H 0 and Ha? Remember the null hypothesis is usually 'no change' and the alternative is the result we are testing or outcome that we “hope for”. Q7Test the hypothesis from question 8 to answer the question: Did the health clinic's fliers increase the proportion of people who got flu shots? for a) confidence level 95% (μ,σα =.05) b) confidence level 99% (μ,σα =.01) Be sure to state the p-value, whether or not H 0 is rejected. The null hypothesis is rejected when the p-value is less than α. Note that the p-value is independent of the significance level. Do we get the same answer in both cases?* Under 'Statistics/ Summaries, tables, & tests / Classical Tests of Hypothesis / one-sample proportion test' In 'Main' tab: enter variable name, the hypothesized proportion, and the appropriate confidence level.

4. Finding Confidence Intervals USING THE PARKING METER DATA Q8 Find a 95% confidence interval for the overall mean of the con variable, assuming a normal distribution.* Under 'Statistics/ Summaries, tables, & tests / Summary statistics / Confidence Intervals', In 'Main' tab: enter variable name, check the 'Normal variables' option, and enter 95 for confidence level.

Q9 Do you think that there is evidence that Brink employees stole money from parking meters? Explain. USING THE SPEED OF LIGHT DATA: Q10 Plot a histogram of the data using 25 bins, include in write up. Describe. Are there outliers present? Q11* Find the sample mean of the dataset. Find the sample mean excluding -44. Find the sample mean excluding -44 and -2.** To exclude -44: In 'summarize in Summary Statistics' , on the 'by/if/in' tab, under the 'Restrict to observations', enter 'speed>-44' in the 'if' option. Similarly, you can use this to exclude -2 and -44. Q12 Find a 95% confidence interval for the mean of the speed variable in the following cases: (μ,σAssume a normal distribution). i) not excluding any data ii) excluding - iii) excluding -44 and - Q13 Newcomb ultimately dropped the lowest outlier, -44, from his analysis. Would you have done the same? Why or why not?**