basic statistics session 2

76
Basic Statistics Introductory Workshop MS- BAPM John R Wilson [email protected] (Note that much of the material and definitions are from A First Course in Statistics, McClave and Sincion, 11 th edition)

Upload: akragnarock

Post on 15-Apr-2016

219 views

Category:

Documents


2 download

DESCRIPTION

Basic Statistics session 2

TRANSCRIPT

Page 1: Basic Statistics Session 2

Basic StatisticsIntroductory Workshop MS-

BAPMJohn R Wilson

[email protected](Note that much of the material and definitions are from A First Course in Statistics, McClave and Sincion, 11 th edition)

Page 2: Basic Statistics Session 2

Conclusion of Session 1• Q&A• Session 2 Agenda• Continuous probability distribution• Sampling Distributions• Interval Estimates• Confidence Intervals• Z values, t test and p values• Introduction to hypothesis testing

Page 3: Basic Statistics Session 2

Continuous Probability Distribution (CPD)• What if the variables aren’t “countable”?• Variables that can assume ANY value in any of the points in an interval

are called continuous• Ex. The length in time, in minutes, that someone waits in a hospital ER• Ex. The depth in feet for striking oil

• We don’t discretely measure these (Although we can later change these to discrete measures)

Page 4: Basic Statistics Session 2

CPD• The graph of the cpd is a smooth curve, typically bell shaped if

normally distributed• This curve, a function of x, is denoted by symbol f(x) and is

interchangeably called a probability density function, frequency function or probability distribtution• The areas under the probability distribution (Area under the curve or

AUC) correspond to the p of x (See next slide)

Page 5: Basic Statistics Session 2

AUCThe are shaded is the probability that x is between 1 and 2.

Page 6: Basic Statistics Session 2

Computing AUC• Computing AUC is somewhat complex for the everyday user

Page 7: Basic Statistics Session 2

However, a table was devised that calculates what is called a z score• It is based on a normal distribution with a mean of 0 and standard

deviation of 1. (See next slide)• Note the probability that a value falls between a score of -1/1, -2/2

and -3/3.• Remember the 68/95/99 rule?

Page 8: Basic Statistics Session 2
Page 9: Basic Statistics Session 2

Exercise One (TIP – Draw out the area that you are looking for)• Using the previous table, find the probability that a standard normal

variable falls between -1.33 and 1.33

Page 10: Basic Statistics Session 2

Ex: One solution step one

Page 11: Basic Statistics Session 2

Ex: One solution step 2• Note that the value for 1.33 is .4082• HOWEVER…that is the auc from 0 to 1.33. We also have the same auc

from 0 to -1.33 • Therefore, we add .4082 to .4082 so the total probability that our

variable falls between -1.33 and 1.33 is .8164• Note that the 1.33 is in terms of standard deviations

Page 12: Basic Statistics Session 2

Z scores • There is another type of z table that calculates the probability that a variable is

to the right or left of a value. • They are also based on the same AUC calcs, but represented a bit differently

(See Z score table in appendix)• Note that the values for 1/-1 are complements of each other• Quick exercise..calculate the probability that a value is either to the left of

negative one or to the right of positive one.• To the left of negative one is -.1587 and to the right of positive one is (1 - .8413) or

+.1587. Add these up and they total .3174. The complement of that is .6826 (That 68% again).

• So we can say that the there is a 68% probability that our value is between 1 and -1, or a 32% probability that it is in the “tails”

Page 13: Basic Statistics Session 2

Exercise two• What is the probability that a standard normal variable is greater than

1.64 (Do this using both tables)

Page 14: Basic Statistics Session 2

Exercise two solutions• Using our AUC table, when looking up the value for 1.64, we

get .4495. HOWEVER, we have to add the .5 to the left of the mean to get a total area of .9495. The area we are interested in is in the tail, so 1-.9495 is .0505. • Using our Z table in the appendix, our value for 1.64 is shown as .9495

and, applying the same calculation, we also get .0505.

Page 15: Basic Statistics Session 2

Exercise Three• Find the probability that a standard normal variable exceeds 1.96 IN

ABSOLUTE VALUE (Draw the problem out first)

Page 16: Basic Statistics Session 2

So how do we calculate the z score to look up?• The formula is relatively simple

Page 17: Basic Statistics Session 2

Exercise Four • Assume that length of time x between charges of a cell phone are

normally distributed with a mean of 10 hours and standard deviation of 1.5. Find the probability that the cell phone will last between 8 and 12 hours between charges.

Page 18: Basic Statistics Session 2

Ex Four solution• First, we need to calculate the z score for 8 and for 12

• Z(8) = 8-10/1.5 = -1.33• Z(12) = 12-10/1.5 = 1.33• Looking up our values, we get a total p of .8164 (.4082 + .4082)• Therefore, the probability that it lasts from 8-12 hours is about

81.64% (Refer to slide 11)

Page 19: Basic Statistics Session 2

Exercise Five• Suppose a car manufacturer claims that on average, a car gets 27

miles per gallon. Although no variability is mentioned, you find out that the standard deviation is 3 miles per gallon.

1. If you were to buy this car, what is the p that you would purchase one that gets less than 20 miles per gallon

2. Suppose you bought one and it did in fact get less than 20mpg. Should you conclude that your model is incorrect?

Page 20: Basic Statistics Session 2

Exercise Five solution• First, draw out your distribution plot.• Convert your variable to a z score• 20-27/3 = -2.33

• Calculate your probability • P(x<20) = P(z<-2.33) which is .0099 or approximately 1%

• You are either unfortunate to get the 1 out of a 100 cars that gets poor mileage or the model is not correct (Mean mileage or std deviation)

Page 21: Basic Statistics Session 2

Reversing the z tables• Suppose you are looking at college aps and will consider only the top

ten percent of test scores. What would be the minimum test scores based on the distribution?• First, draw it out• We would be interested in the p that someone is in the “tail” to the

right of the mean. Further, they would only be in the last 10% of the auc. Therefore, if we look up the area close to .4 (.5 + .4 is .9…that leaves .1 as the tail) we would see that it roughly corresponds to a value of 1.28 to 1.29. Therefore, scores that are at least 1.28 standard deviations higher than the mean would qualify.

Page 22: Basic Statistics Session 2

Sampling DistributionsRemember yesterday that we discussed samples as a method of inferring the statistics (or parameters) of a population.

Population Parameter Sample Statistic

Mean µ

Variance σ^2 s^2

Standard Deviation σ s

A sample statistic is a numerical descriptive measure of a sample. We will often use this information to infer the parameters of a population

Page 23: Basic Statistics Session 2

Sampling Distributions• However, two samples can yield VERY different results, thus making

VERY different inferences about the population.• This illustrates an important point• Sample statistics are themselves random variables• Therefore, they must be judged and compared based on their respective

probability distributions• This assumes that the sampling experiments are repeated a VERY large number of times

Page 24: Basic Statistics Session 2

Sampling Distributions• An example:

• Suppose that in Canada, the daily high temp recorded for ALL past months of January has a mean of 10 degrees F and a standard deviation of 5. (Note that all recorded measures would constitute the population in this case, but that is not often the case)• Now suppose we randomly sample 25 observations, but we do this random sample

several times (with replacement). Sample one shows a mean of 9.8, sample two a mean of 11.4, sample three a mean of 10.5, etc. If we plotted these sample means, and if the means are a good estimator of µ, we would expect the probability distribution of the sample means to cluster around 10.• This probability distribution is called a sampling distribution• In actual practice, we typically would use computer simulations to generate the

sampling distribution.

Page 25: Basic Statistics Session 2

Properties of a sampling distribution• The mean of the sampling distribution of will be approximately µ. • The standard deviation of the sampling distribution of equals the”• Standard deviation of sampled population/square root of sample size• Or σ of = σ/√n

• Note that this is the deviation of the sampling distribution values and is not the same as the standard deviation of the sample itself

• This standard deviation is often referred to as the standard error of the mean

Page 26: Basic Statistics Session 2

Central Limit Theorem• These properties of sampling distributions lead us to one of the most

important theoretical results in statistics…the Central Limit Theorem.• The CLM states that:• If a random sample of n observations is selected from a population with a

normal distribution, the sampling distribution of will be normally distributed• When n is sufficiently large, the sampling distribution of will be

approximately µ

• How large is large enough? For most sampled populations, n≥30 is usually sufficient. For skewed distributions, this number needs to be larger

Page 27: Basic Statistics Session 2

Putting it all together (An example)• A battery mfg claims a mean battery life of 54 months with a std dev of 6 months. A

consumer group buys 50 batteries to test this claim.1. Assuming the claim is true, describe the sampling distribution of the mean lifetime of the 50

batteries.2. Assuming the claim is true, what is the probability that the group’s sample has a mean life of

52 or fewer months?• Even though we have no probability distribution for the sample, we can apply the

CLM to deduce the sample mean as being normally distributed. Further, the sample mean should be 54 months. Finally the standard error of the mean is 6/√50 (claimed population std / square root of the sample size) as .85• Now we need a z score which is 52-54/.85 = -2.35• This suggests that the p of being to the left of -2.35(Tail) is approx. .0094• We can follow up after many months of use and if the batteries tested do have a VERY

UNLIKELY mean life of less than 52 months, we would question the manufacturers claims

Page 28: Basic Statistics Session 2

Couple of other notes• Note that as n gets larger, the standard error of the mean will get

smaller. This makes intuitive sense, as larger samples are better at estimating the population parameters. This becomes important when considering how large a sample should be collected or observed in order to obtain a specified accuracy of estimation• Second, the CLM is useful because may natural observations are

normally distributed.

Page 29: Basic Statistics Session 2

Exercise Six• A random sample of n=100 observations is selected from a population

with a mean of 30 and standard deviation of 161. Find the mean and standard deviation of 2. Describe the shape of the sampling distribution of 3. Find P( ≥ 28)4. Find P( ≤ 28.2)5. Find P( ) is between 28.5 and 31

Page 30: Basic Statistics Session 2

Exercise six solution• A random sample of n=100 observations is selected from a population

with a mean of 30 and standard deviation of 161. Find the mean and standard deviation of

• Mean is 30 (CLM) and Standard deviation is 1.6 (16/√100)

2. Describe the shape of the sampling distribution of - approx. normal3. Find P( ≥ 28) z = 28-30/1.6 = -1.25 Therefore, P= .8944 or 89.44%4. Find P( ≤ 28.2) z = 28.2-30/1.6 = -1.125 Therefore, P = approx. 13%5. Find P( ) is between 28.5 and 31

• Z(28.5) 28.5-30/1.6 = -.9375 Z(31) = 31-30/1.6 = .0625

• Therefore P = approx. 56% (Draw this out!!)

Page 31: Basic Statistics Session 2

Break

Page 32: Basic Statistics Session 2

Interval Estimation and Confidence Intervals• As stated before, we seldom know the population parameter. If we

did, we wouldn’t need inferential statistics.• Therefore, our goal is to use samples to estimate the mean (or

proportions) of a population• The parameter we are interesting in estimating is called the target

parameter• It can be the mean, average, proportion, variance, etc.• With quantitative data, we are usually interested in the mean or variance of

the data. With qualitative data, it is usually a measure of proportion that we are interested in.

Page 33: Basic Statistics Session 2

Estimators• A single number that is calculated from a sample and that estimates

the target population parameter is called a point estimate.• For example, we can use the sample mean to estimate the population mean

• In addition, we can measure the reliability of our estimate by including an interval estimator. This is a range of numbers that is likely to contain the target parameter with a high degree of confidence. This is typically referred to as a confidence interval

Page 34: Basic Statistics Session 2

Confidence Interval example• Suppose we want to estimate the average stay of an in-patient. The

target parameter then is µ. We would like to do this with a CI of 95%1. To do this, we randomly sample 100 records and determine the sample mean , which will

represent a point estimator for µ2. According to the CLM, the sampling distribution of the sample mean is approximately normal.3. According to our z table, a z score of either +/- 1.96 would give us an AUC of .95, or a 95%

probability that our value would be within this interval4. Using our formula then, ± 1.96σ/ √n would give us our interval estimates (Or range) whereby

there is a 95% probability that the true population mean lies within this range5. The true population mean could lie outside of this range, but that is considered a rare-event6. Let’s see how this works with real numbers (next slide)

Page 35: Basic Statistics Session 2

CI calculation• Let’s assume our sample of 100 patients has a mean stay (x bar) of 4.5 days.

Lets also assume that it is known that the standard deviation of the length of stay is 4 days. Calculate the CI for µ• ± 1.96σ/ √n = 4.5 ± (1.96)(4/√100) = 4.5 ± .78 = (3.72, 5.28)• Therefore, we are 95% confident that the average length of stay is between 3.72 and

5.28.

• NOTE: In this example, the population standard deviation was known…however, that is NOT usually the case. However, recall that our sample standard deviation is often a good estimate for our population standard deviation. Let’s see an example based on this exercise, but with a small tweak

Page 36: Basic Statistics Session 2

CI without population std deviation• From our last exercise, we still are trying to get the average stay.

However, the population std dev is NOT known. • Our sample size is large, so we use the sample standard deviation (s) to

approximate our population standard deviation (σ)• Based on our sample, we get a mean ( )of 4.53 days with an s of 3.68

days. Calculate the CI at 95%• 4.53 ± (1.96)(3.68 / √100) = 4.53 ± .72 = (3.81, 5.25)

• What if we wanted to calculate this with 99% confidence?• Note that we can construct ANY interval we wish, but 95% is a standard

for a variety of reasons.

Page 37: Basic Statistics Session 2

A note about µ• In the last example, can we be certain that the population mean is

actually within the CI? We can’t be CERTAIN, but we can be reasonably confident. What the CI really means is that if we repeatedly sampled and formed the the CI’s each time, 95% of the time, the intervals would contain µ.• Also, CI actually refers to the interval numbers, whereas the

confidence level, ie 95% is the the confidence coefficient, or probabilitiy, expressed as a percentage. However, in practice the term CI is typically used in reference to the percentage, or AUC of the interval estimates.

Page 38: Basic Statistics Session 2

T-statistic• Remember that our previous CI’s, which used the z scores, had an a

priori condition that the sample size usually be large (The larger the better, but usually at least 30). This was fundamental to the CLT.• What if the sample was small. This could result in a sample standard

deviation that is a poor approximation of the population standard deviation.• Whereas the z score utilizes the population standard deviation (or its

estimate), the t-statistic uses the sample standard deviation (without regard to sample size)

• You may have heard the term Student’s T-statistic…this term has nothing to do with students. It was a pen name for William Gossett, who discovered the T-distribution.

Page 39: Basic Statistics Session 2

T-statistic• This is noted as such:

Page 40: Basic Statistics Session 2

T-statistic• If the sampling is done from a normal distribution, the t statistic has a

sampling distribution very similar to the z statistic• However, the t statistic introduces more variability courtesy of the sample

standard deviation (Which may not accurately approximate the population standard deviation)• The actual amount of variability depends on the sample size n

• This is expressed in degrees of freedom which is (n-1)• Recall from the divisor of s^2 that we used n-1 as opposed to n• It is helpful to think of degrees of freedom as the amount of information available for

estimating the target parameter.• In general, the smaller the number of df, the more variable will be the sampling

distribution

Page 41: Basic Statistics Session 2

T-statistic tables• As with Z scores, the T statistic is available in a lookup table (See

appendix)• If we wanted to look up a T score for t.025 with 4 degrees of

Freedom, we would get 2.776• Note that .025 would be the right tail where our z score would normally be

1.96

• Note what happens if we increase the degrees of freedom…as the df gets higher, our number starts to approach the z distribution

Page 42: Basic Statistics Session 2

T-statistic example• A pharma company wants to estimate the mean increase in bp of

patients that are taking a new drug. However, they only have a sample of 6 patients, whose increases respectively, were (1.7, 3.0, .8, 3.4, 2.7, 2.1). Use this information to construct a 95% CI for µ, the average increase in bp.• 1st, note that our sample is too small to assume CLM that x bar is normally

distributed. Instead, we must assume that our OBSERVED variables are normally distributed in order for the distribution of x bar to be normal• 2nd, assume we don’t know σ and can’t approximate it because of small

sample size. Therefore, we must use the t-distribution with (n-1)df

Page 43: Basic Statistics Session 2

T-statistic example• In this case, n-1 is 5 (6-1) and the t-value for 95%CI is .025 (.025 in each

tail). Looking up the table, we get a t value of 2.571. To get the interval, we can use our previous CI formula, but substitute our t for z

• Remember our z based formula, at 95% ± 1.96σ/ √n • X bar for sample is 2.283 with s = .95• Thus we get ± 2.571σ/ √n = 2.283 ± (2.571)(.95/√6) = 2.283 ± .997 = (1.286,

3.280)• This is our interval and we can be 95% confident that the mean bp increase

is between these two numbers (THIS STILL ASSUMES NORMALITY)

Page 44: Basic Statistics Session 2

Exercise seven • We are interested in the average number of characters that can be

printed before a printer head fails. Because the failures are rare, or take a long time, we have little data…only a sample of 15. The # of characters (in millions) before failure were (1.13, 1.55, 1.43, .92, 1.25, 1.36, 1.32, .85, 1.07, 1.48, 1.20, 1.33, 1.18, 1.22, 1.29)• Form a 99% CI for the mean # of characters printed before failure.• What assumptions are required for this interval to be valid

Page 45: Basic Statistics Session 2

Exercise seven solution• First, calculate the mean and std deviation of the sample• Mean is 1.23867, Std deviation .19316 (Round to 1.24, .19)• For 99%, we are looking at the tails of .005 (1- .99)/2. • Our df is (15-1) = 14• We lookup .005 with 14df = 2.977• Thus we get ± 2.977σ/ √n = 1.24 ± (2.977)(.19/√15) = (1.09, 1.39)• This means that we are 99% confident that the printhead has a mean life of

between 1.09 and 1.39 million characters• Since n is small, we must assume that the # of characters before failure is

random and normally distributed

Page 46: Basic Statistics Session 2

CI for population proportions• So far, we have looked at the Cis for continuous distributions, but we can apply

similar techniques for proportions as well. • For example, suppose that we randomly poll 1000 fte’s and ask if they like their jobs. 637

answer yes…how can we take that information and infer the true fraction of ALL fte’s that like their jobs?

• We can estimate p (The probability that a fte is happy with their job) by calculating “p-hat”, usually denoted as:

• Thus p-hat = 637/1000 or 63.7%• However, how can we determine the reliability of that number? If we view each “yes” as

a success, the answer lies in the distribution of the average number of yes in n number of samples. (NOTE that the n of success and the n of failure both should > 15)• In other words, what does the distribution of the number of yeses look like in n number of samples of

1000 ftes? The CLM tells us that the relative frequency distribution of the sample mean for any population is approximately normal for sufficiently large samples

Page 47: Basic Statistics Session 2

Sampling distribution of • The mean of the sampling distribution of p hat is p; stated another

way, p-hat is an unbiased estimator of p• The standard deviation of the sampling distribution of p-hat is √(pq/n)

where q = 1-p.• For large samples, the sampling distribution of p-hat is approximately

normal

Page 48: Basic Statistics Session 2

CI for p• P-hat ± z √(p-hat * q-hat)/n• So to calculate the 95% CI for worker happiness, based on our sample

of 637 happy workers out of 1000

• .637 ± (1.96)(√(.637)(.363)/1000) = .637 ± .030 = (.607, .667)• Thus we can say we are 95% confident that the interval between

60.7% to 66.7% contains the true percentage off ALL ftes that are happy with their job.

Page 49: Basic Statistics Session 2

Exercise Eight• A random poll shows that 157 out of 484 consumers are optimistic

about the state of the economy. Using this information, and a 90%CI, what is the estimated proportion of happy consumers in Florida.

Page 50: Basic Statistics Session 2

Exercise Eight• A random poll shows that 157 out of 484 consumers are optimistic

about the state of the economy. Using this information, and a 90%CI, what is the estimated proportion of happy consumers in Florida.• P-hat = 157/484 = .324• Z score for .9 is 1.645 (We need to find the value of (1-.9)/2 which is .05

Our formula is:.324 ± (1.645)(√(.324)(.676)/484) = .324 ± .035 = (.289, .359)

This means we are 90% confident that the proportion of people happy with the economy is between 28.9% and 35.9%

Page 51: Basic Statistics Session 2

Hypothesis Testing• As seen with our various z/t tests, we are often determining if the

value of a parameter is greater than, less than or equal to some specified number. (See exercise six)• This type of inference is called a test of a hypothesis• We utilize the rare-event concept to reach a decision• To do this, we form two hypothesis called the null hypothesis and the

alternative (or research) hypothesis

Page 52: Basic Statistics Session 2

Hypothesis Testing• Null Hypothesis, denoted Ho, represents the hypothesis that will be

accepted unless the data provides convincing evidence that it is false. This usually represents the status quo or some claim about the population parameter that the researcher wants to test• Alternative Hypothesis, denoted Ha or H1, represents the hypothesis

that will be accepted only if the data provide convincing evidence of its truth. This usually represents the values of a population parameter for which the researcher wants to gather evidence to support.• A statistical hypothesis is a statement about the numerical value of a

population parameter

Page 53: Basic Statistics Session 2

Hypothesis example• Suppose a city wants to buy some sewer pipes, but wants to make sure they

meet specifications of having an average breaking strength of 2,400 pounds per foot.• In this example, we are less interested in the approximate mean of the population µ,

then we are in testing a hypothesis about its value. Specifically, we want to decide whether the mean breaking strength of the pipe exceeds 2,400 pounds per foot.

• Our Ho is that the manufacturers pipe does NOT meet specs, or that:• µ ≤ 2400

• Our Ha is ALWAYS the complement to Ho• µ > 2400

• Consider what this might look like within a normal distribution chart

Page 54: Basic Statistics Session 2

Hypothesis example• This is where it gets tricky• We know from our z table that a standard deviation of 1.65 approximates the

area where 95% of the auc is to the left and the remaining 5% is in the tail. This 5% is our rejection region• If, in fact, the true mean of µ is 2400, there is only a 5% chance that the sample mean

would be more than 1.65 standard deviations above 2400.• If our null hypothes Ho were true, this is a rare-event. However, we typically reject the rare

event and, thus, we would reject the null hypothesis. • By doing so, we conclude that the alternative hypothesis is likely true.

• The 5% probability region is denoted by α (alpha)• If we rejected the null hypothesis, but in fact it was true, this would be termed a Type I

error. The probability of the Type I error is α (alpha)

Page 55: Basic Statistics Session 2

Hypothesis example with number• So lets assume we sample 50 sections of pipe and find that xbar is

2460 with std deviation of 200 (We can use s to approximate σ because sample is large enough)• For our z score, we use our test statistic formula of • Substituting z for t• So for this example we have:• Z=2460-2400 / (200/√50) = 60/28.28 = 2.12• Because 2.12 exceeds 1.65, it falls within the rejection region, so we

reject the null hypothesis

Page 56: Basic Statistics Session 2

Hypothesis example with numbers• Let’s assume our sample mean was actually 2430 instead of 2400.

• Z= (2430 – 2400) / (200/√50) = 30 / 28.28 = 1.06• This value is less than 1.65 standard deviations away and does NOT lie in the

rejection region. Therefore, we cannot reject the null hypothesis.• Even though the sample mean exceeds the 2400, it does not exceed it by enough to

provide convincing evidence that the population mean exceeds 2400.• If we accept the null hypothesis, but it is in fact false, we have made a Type II error.

The probability of committing a Type II error is denoted by β (beta). This probability is usually unknowable• Semantics often become involved here….”accept Ho”, or “fail to reject Ho” or “insufficient

evidence to reject Ho”

Page 57: Basic Statistics Session 2

Tails• The previous example was a one-tail (or one-sided) test. This is

because we used an inequality.• If we are looking at equality, we would use a two tailed test.• Which tail to use• Ho ≤ some value, use upper tail (One to the right) as rejection region• Ho ≥ some value, use lower tail (one to the left) as rejection region • Ho = some value, use both tails as rejection region

Page 58: Basic Statistics Session 2

Rejection regions for common values of α• First, .05 is typically the rejection region of choice, so α = .05• Note on the two tail test, this is the region where p = .025. Add up

both tails, and you get .05.

Lower Tail Upper Tail Two tailed

Z < -1.645 Z > 1.645 z < -1.96 or z > 1.96

Page 59: Basic Statistics Session 2

Example of two tailed test setup• A researcher is testing whether a drug changes response times. She

has injected 100 rats with a dose. She knows that the response times without the injections (Control group) is 1.2 seconds. She wants to see if the drug changes the response time. Further, because it is a drug, we are using a α of .01 (Rather than a traditional .05)• First, note that we are only looking to see if the time changes..it can be in

either direction.• Therefore:

• Ho = 1.2 (Mean response time is 1.2 – this is the status quo)• Ha ≠ 1.2 (Mean response time is not 1.2 ..could be more or less)

Page 60: Basic Statistics Session 2

Example of two tailed test setup• Ho = 1.2 (Mean response time is 1.2 – this is the status quo)• Ha ≠ 1.2 (Mean response time is not 1.2 ..could be more or less)• α = .01• This is two tailed, so our rejection regions are where are z scores translate

to .005 (.01 / 2)• The z score for .005 is -2.575 (For the lower tail) and +2.575 for the upper tail.• Note that the test is set up before the sampling is done. Because we have set

our p so low (.01), we can confidently conclude that should we reject the null hypothesis that the response time does truly differ, thus the drug has an effect.

Page 61: Basic Statistics Session 2

Exercise nine• Use the setup from the previous rats case• Sample of 100 rats gave us x bar of 1.05 and s of .5. Determine if we

reject or fail to reject Ho

Page 62: Basic Statistics Session 2

Exercise nine solution• Ho = 1.2 (Mean response time is 1.2 – this is the status quo)• Ha ≠ 1.2 (Mean response time is not 1.2 ..could be more or less)• α = .01• This is two tailed, so our rejection regions are where are z scores translate

to .005 (.01 / 2)• The z score for .005 is -2.575 (For the lower tail) and +2.575 for the upper

tail.• Z = (1.05 – 1.2) / (.5/√100) = -.15/.05 = -3, which DOES fall into the rejection

region. Therefore, we reject Ho. In fact, it would appear that the drug causes a response time that is less that 1.2 seconds (quicker response)

Page 63: Basic Statistics Session 2

Exercise nine• Assume that we sample 100,000 rats and get a mean of 1.1995 with s

of .05. Calculate our z score

• z-= (1.1995 – 1.2) / (.05/√100000) = -3.16

• Therefore, we would reject our Ho. However, in this case, the researcher may decide that even though it is statistically significant, it may not be practically significant as 1.1995 and 1.2 are virtually identical.

Page 64: Basic Statistics Session 2

P-values (Observed significance value)• In our tail tests (regions of rejection) we simply rejected the null

hypothesis if our z score fell in the rejection region. • Recall from slide 55 that our z score was 2.12, which exceeded our

reject region which began at z = 1.65• While this enables us to reject the null hypothesis, it doesn’t indicate

the extent to which a test statistic disagrees with the null hypothesis. • However, we can calculate this by using our test statistic, in this case

2.12.

Page 65: Basic Statistics Session 2

P-values• Recall that our z value was 2.12, which was in the rejection region. If

we look up the auc for 2.12 it is .9830. Therefore, our p value would be .017. • What this means is that if the value of µ were actually 2400, as stated

in our null hypothesis, there is only a probability of 1.7% that the observed value of z would be 2.12 or greater.• Most experiments require a P value of at least .05 or lower…the

lower, the better.

Page 66: Basic Statistics Session 2

Comparing population means• Earlier, we were dealing with single sample tests. But what if we want

to determine if the means for two populations are the same? • For example, we may want to compare the life expectancy between inner-city

and suburban residents.

• We can modify our single sample hypothesis testing to make inferences about two or more population means (or proportions).• Assuming n>30 in all compared samples, we would utilize our

traditional z scores, but we can use t-testing for small samples. Most software will do this automatically. For our purposes, we will just focus on the larger samples for conceptualization.

Page 67: Basic Statistics Session 2

Determining the target parameterParameter(s) Key words/phrases Data type # of samples

µ1 - µ2 Difference between means Quant 2 independent samples

µd Mean of paired differences Quant 1 paired sample

µ1, µ2, µ3…. µk Compare multiple means Quant K independent samples

Page 68: Basic Statistics Session 2

Comparing two population means: Independent sampling• Lets assume two groups on two different diet plans. 100 are placed

into a low fat diet and a second group of 100 eat approximately the same caloric amount of food, but not low in fat. We want to measure the difference in weight loss for the two diets.• Let µ1 be the mean of weight loss for low-fat group• Let µ2 be the mean of weight loss for the other group.

• We don’t simply take the difference in means…Why?• So we use a modified confidence interval to determine the difference

in means

Page 69: Basic Statistics Session 2

Formula for comparing two populations sample means

*Alternatively, “t” could be “z” in large sample

Page 70: Basic Statistics Session 2

Diet example

We have recorded the weight loss from both groupsX1 = 9.31, X2 = 7.40, 95%CI means z (t) = 1.96, s1=4.67, s2=4.04

Therefore:

(9.31 – 7.40 ) ± 1.96 (√(4.67)^2 / 100 + (4.04)^2/100) =

1.91 ± (1.96)(.62) = 1.91 ± 1.22 = (.69. 3.13)

Therefore, we are highly confident (at 95%) that the mean weight loss for the low-fat diet (x1) is between .69 and 3.13 pounds more than the mean weight loss for the second group

Page 71: Basic Statistics Session 2

Comparing Population Proportions• The formula for comparing proportions is similar as for comparing

means, but a couple of small differences

Instead of xbar, we are using p hat. Also, instead of our s measure of standard deviation, we are using p hat times (1 – p hat) or pq

See slide 48 for a refresher on p hat confidence intervals

Page 72: Basic Statistics Session 2

Comparing Proportions - example• 1000 registered voters (randomly selected) from both the NE and the SE

were asked whether they favor a particular candidate. In the NE, 546 responded yes and in the SE 475 responded yes. To judge the reliability of this .071 difference, we want to know the 95%CI interval for the difference in proportions.

• (546 – 475) ± (1.96)(√(.546)(.454)/1000 + (.475)(.525)/1000 =• .071 ± .044.• Thus, we are 95% confident that the interval of .027 to .115 contains the difference

between p1 and p2 (NE and SE). Stated another way, we believe there are between 2.7 and 11.5% more registered voters in the NE that favor the candidate.

Page 73: Basic Statistics Session 2

Appendix

Page 74: Basic Statistics Session 2

Greek Symbols• Website with statistical symbols

http://www.rapidtables.com/math/symbols/Statistical_Symbols.htm• Greek letters

Page 75: Basic Statistics Session 2

Z score table

Page 76: Basic Statistics Session 2

T-table