Thursday, December 16, 2010

Standard errors and normdist


Chapter 7. Question# 15, A population a has a mean of 200 and a standard deviation of 50. suppose a simple random sample of size 100 is selected and xbar is used to estimate µ.
a. what is the probability that the sample mean will be within + 5, or -5 of the population mean?
b. What is the probability that the sample mean will be within +10 or -10 pf the population mean?

Answer: we know µ=200. So we want the area between 195 and 205. Best use Excel for this. We have a sample (n=100) from a population. Because n>30, we can make use of the Central Limit Theorem. That means using =normdist in Excel. The standard error is 50/10 = 5. In Excel, first find the larger ‘x’ which is 205, then subtract the smaller one. So, the whole thing can be written in one line
=normdist(205,200,5,true)-normdist(195,200,5,true). I get 0.6827 for this. You can do the same for the second part of the question.

Binomials


Question 32,
Military radar and missile detection systems are designed to warn a country of an enemy attack.  A reliability question is whether a detection system will be able to identify an attack and issue a warning.  Assume that a particular detection system has .90 proabability of detecting a missile attack.  Use the binomial probability distribution to answer the following questions.
B) If two detection systems are installed in the same area and opertate independantly, what is the probability that at least one of the systems will detect the attack?
C) if three systems are installed, what is the probability
I’ve drawn a beautiful tree diagram to illustrate. 

B: two systems operating independently, so it is like tossing a coin. What happens to the first system doesn’t affect the second system. Look at the branches in the trees that show whether there has been a successful detection. There are THREE (at least one). So the probability is 0.81 + 0.09 + 0.09 = 0.99. In binomials, we want a cumulative probability. There are different ways of solving this. First off, think of what is the probability of none of the systems working? That is 1-0.99= 0.01. In binomials, =1-binomdist(0,4,0.9,false).
For three systems,  extend the tree diagram with extra branches. Calculate by hand using the tree diagram and also using binomdist (It will help, I promise!).

Question 36
According to a survey conducted by TD Ameritrade, one out of four investors have exchange-traded funds in their portfolios.  For a sample of 20 investors, answer the following questions.
A) compute the probability that atleast 4 investors have exchange-traded funds in their portfolis?
B) compute the probability of atleast 2?
D) compute the expected number of investors who have exchang-traded funds in their portfolis?
A: =1 – binomdist(4,20,0.25,true) get the 0.25 from one in four investors
B: =1-binomdist(2,20,0.25,true)
D: don’t worry about this type of question, but be sure you can use =sumproduct

Saturday, December 11, 2010

how to tell if it's a paired.chi-squared, or regression?

Sometimes it is hard to work out whether a question is asking you to do a paired t-test (meaning matched), chi-squared or regression test of a hypothesis.

Here are some identifying tips. Note that I am emphasising how to write the hypotheses. Forcing yourself to write the hypotheses properly is a good way of sorting out what type of test you should do.

matched: look for a column of elements and two columns of data. Each element has a pair of observations, for example ‘before’ and ‘after’. We are trying to work out what difference it makes to the same element. Another example: the one we did in class about Airfares. The element is the destination, and the paired observations are flight to the same place from each of the two airports. Note that there is no information in the elements. It is just a list. Remember how to write the hypotheses?

chi-squared. Now there is some information in the rows of the cross-tabulation. For example, we could have interval-level data here (responses 1 -5 from a survey). Recall that for chi-squared, we are testing for independence between rows and columns. Recall how to write the hypotheses for chi-squared.

regression. The two variables are both quantitative and we are testing for some sort of correlation. If one variable goes up, does the other variable go up (or down)? Recall (very important) the hypotheses for regression. Check the slides for this.

Friday, December 10, 2010

negative t-stat?

We calculate the t stat by subtracting the hypothesised mean from the sample mean, and then dividing by the standard error. Now it can happen that the hypothesised mean is larger than the sample mean. The result is that the t stat is negative. That is OK. But when you put it into Excel, just type the t stat as an absolute value (that means drop the negative sign).

Q31 Monster Review

31. The time needed for college students to complete a certain paper-and-pencil maze follows a normal distribution with a mean of 30 seconds and a standard deviation of 3 seconds. You wish to see if the mean time m is changed by vigorous exercise, so you have a group of nine college students exercise vigorously for 30 minutes and then complete the maze. Assume that s remains unchanged at 3 seconds. The hypotheses you decide to test are H0: m = 30 versus Ha: m ¹ 30. Suppose it takes nine students an average of xbar = 32.05 seconds to complete the maze. At the 1% significance level what can you conclude?


Suppose it takes the nine students an average of = 32.05 seconds to complete the maze. At the 1% significance level, what can you conclude?
A)
H0 should be rejected because the P-value is less than 0.01.
B)
H0 should not be rejected because the P-value is greater than 0.01.
C)
Ha should be rejected because the P-value is less than 0.01.
D)
Ha should not be rejected because the P-value is greater than 0.01.

First, note that we are testing a sample mean against a hypothesized mean. And it is a two-tailed test because the null hypothesis contains a strict equality =.

Get the t stat:

Note that we put in first the t stat, then the degrees of freedom (n-1) and then the number of tails (here two).

Excel gives the p value of 0.075 (rounded). We are asked to test at 1%, which means alpha is 0.01. p is clearly > 0.01 so we fail to reject the null hypothesis. B is the correct answer.

Thursday, December 2, 2010

Keenies 5 Q1 Solution

A At last! The job of your dreams! You are appointed supervisor of garbage collection for the fine city of Richmond. Some of your garbage trucks come back full, some empty. Is there are any connection between whether trucks returned full or empty trucks and whether on the day of collection it was raining? Perhaps people don’t like putting out their garbage in the rain? You have 112 trucks, and when it’s raining, 9 come back full. You count the empty trucks, and when it isn’t raining there are 23 of these. When it is raining, 3 return empty.

a. Write the hypotheses

Ho: there is no association between whether or not it’s raining and garbage truck full or not

Ha: there is....

b. Test at 95%. What are your results? Write up a conclusion in the framework of this question.

Draw a contingency table first...


Use Excel to get the expected values (row total*column total/n)

9

77

86

3

23

26

12

100

112




9.214286

76.78571


2.785714

23.21429





0.876776



Get the p value of 0.876776 using =chitest(...).

The p value is 0.87, which is higher than 0.05 (alpha).

Therefore we fail to reject the null hypothesis. There is no relationship between whether it is raining or not and whether your trucks come back full or empty

c. It’s raining. What is the probability a garbage truck will come back full? Use the proper notation.

Pay attention to the sample space here!

P(Full|Raining) = 9/12

d. You see an empty garbage truck. What is the probability it’s raining? Use the proper notation.

P(Raining|Empty) = 3/26

Thursday, November 18, 2010

A p value question from Chapter 9

Consider the following hypothesis test:

Ho:µ=15
Ha:µ not equal to 15

A sample of 50 provided a sample mean of 14.15. The population standard deviation is 3.
a. compute the value of the test statistic.
b.What is the p-value.
c. At a=.05 what is your conclusion?
d. what is the rejection rule using the critical value? what is your conclusion?

Worked solution:

We’re asked to calculate a test statistic. Note carefully that I am going to use the t distribution below----theoretically the normal distribution would work because n > 30, but I am super-careful and always use the t distribution for this.

Recall that we get the test statistic from



So now use Excel: =tdist(2.005,49,2)= 0.0505
degrees of freedom is n-1 = 50 -1 =49
tails is 2 ----look at the hypothesis

The p value is 0.0505. We are asked to test at 95% (meaning alpha = 0.05), so here p NOT smaller than or equal to alpha because 0.0505 > 0.05. Conclusion is fail to reject null hypothesis.

Note: this is very borderline case. A bit of rounding off the other way.....might have been a different conclusion.

The last part of the question asks about using the critical value. In my class I teach you ONLY the p value, so don’t worry about this part of the question.