1 / 95

Learning outcomes

Introduction to Hypothesis Testing Dr Jenny Freeman Mathematics & Statistics Help University of Sheffield. Learning outcomes. By the end of the session you should: Understand what is meant by a probability distribution Understand the terminology needed for basic hypothesis testing

mdurham
Download Presentation

Learning outcomes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Hypothesis TestingDr Jenny FreemanMathematics & Statistics HelpUniversity of Sheffield

  2. Learning outcomes By the end of the session you should: • Understand what is meant by a probability distribution • Understand the terminology needed for basic hypothesis testing • Understand the difference between a statistically significant difference and a meaningful difference

  3. Download the slides from the MASH website MASH > Resources > Statistics Resources > Workshop materials

  4. Frequency distribution: birthweight • A histogram is a frequency distribution • Histograms are commonly used to look at the spread and shape of the data • Most babies are in the middle with fewer babies at the extremes • The % of babies in the sample between 3 and 4 kgs= 60% • 15% of babies were above 4kg • Would you expect the same results with a different sample? These data look like they are normally distributed…

  5. Probability distributions example: Normal distribution Probability curve: • a very smooth histogram used to estimate probabilities/ percentages in the population • It describes the theoretical distribution of values, for a population with the same mean and standard deviation as the sample data • Sample data can be used to estimate population probabilities/ percentages • For the normal distribution, if we have the sample mean and standard deviation, the population probability curve and associated probabilities can be estimated

  6. Probability distributions example: Normal distribution • The Normal distribution is: • Bell shaped and symmetrical about the mean • Completely described by the mean and standard deviation (i.e. if you know these two quantities, you can draw the entire curve) • Sometimes called the Gaussian distribution after the German mathematician Carl Friedrich Gauss (1777 to 1855) • The mean and the median are the SAME for normally distributed data

  7. Estimating probabilities • We can think of this theoretical curve as representing the Normal probability distribution • The total area under the curve = 1. Can you think why? • It can be used to estimate the probability of individuals having a particular range of values

  8. Estimating probabilities The shaded area represents the probability (p) of obtaining a value greater than a; i.e. P(X > a) = p For example, we could look at P(having a birthweight greater than 4kg)

  9. Using tables for probabilities X = birth weight For ‘greater than’ probabilities, the probabilities get smaller as x increases What if we want to calculate probability of a baby weighing more than 4.2kg?

  10. Using tables for probabilities • Probabilities tabulated for distribution with mean = 3.4, SD = 0.57 What is the probability that a baby weighs more than 4.2 kgs?

  11. Estimating probabilities • The shaded area is the probability of getting a value in the values of a and b: P(a<X < b) • Given that probability tables usually show P(X> a), how might we work out P(a < X < b)?

  12. Estimating probabilities • Note that for continuous probability density functions, we estimate the probability for an interval (based on area), NOT the probability for a single value • This is because as the interval gets smaller, the area gets smaller such that for a single value, the area is zero and thus the exact probability for a single value is 0 See: http://davidmlane.com/hyperstat/z_table.html

  13. Exercise 1: Normal probabilities X = Birthweight; Mean = 3.4kg, SD = 0.57kg What’s the probability of a baby weighing: • More than 4.5kg • More than 2.3kg

  14. Exercise 1: Normal probabilities X = Birthweight; Mean = 3.4kg, SD = 0.57kg What’s the probability of a baby weighing: • Less than or equal to 2.3kg • Between 2.3kg & 4.5kg

  15. Key properties of normal distribution • Values are often discussed as being a number of standard deviation from the mean : • 68% of data lie within approximately 1 standard deviation above and below the mean

  16. Key properties of normal distribution • The middle 95% is often used to describe ‘most people’ • For normally distributed data 95% of data lie within 1.96 standard deviations above and below the mean (Sometimes rounded so approximately 95% of data lie within 2 standard deviations of the mean) • Limits are calculated as:

  17. Example What is the birthweight of most babies? (mean = 3.4kg and SD = 0.57kg) Limits are calculated as: • First calculate 1.96 SD’s: 1.96 x 0.57 = 1.12 • Lower limit: 3.4 – 1.12 = 2.28 • Upper limit: 3.4 + 1.12 = 4.62 95% of babies weigh between 2.28 and 4.62kg

  18. Travel time to work (sample of 30 journeys) X = travel time in minutes We can use this sample to estimate probabilities in the general population

  19. Exercise 2 By how much can I expect my journey time to vary for direction A? (mean = 32.8 minutes and SD = 4.6 minutes) Limits are calculated as: • First calculate 1.96 SD’s: x = • Lower limit: – = • Upper limit: + = 95% of journey times are between and minutes

  20. Commonly used ranges (for info) • Interquartile range contains the middle 50% of values for sample data • Measurements for people are often divided into percentiles e.g. ‘child’s height is in the bottom 20% for their age’.Normal ranges are based on sample data but are used to represent individuals in the population. They are also known as reference ranges • Confidence interval is used to give a range of values for a population parameter e.g. mean (discussed in the next section)

  21. Standard Normal Distribution • A different probability distribution is needed for every combination of mean and SD • Before computers, one special distribution (z) with a mean of 0 and SD of 1 existed

  22. How do we get from a distribution with a mean ≠0 or SD ≠1, to the standard normal distribution, which has a mean of 0 and SD of 1?We standardised!As standardisation is used in other parts of statistics, we will cover it here

  23. Distributions with mean ≠ 0 Standardise data in order to get mean = 0, SD = 1. Standardise using the following formula (where x is the original score for an individual and z represents the transformed score): Standardise all values Mean = 32.8; SD = 4.6 Mean = 0, SD = 1 Note: Z is sometimes called a Z score or a standard deviation (SD) score

  24. Example: 11 journeys to work

  25. Example: 11 journeys to work

  26. Example: 11 journeys to work

  27. Example: 11 journeys to work

  28. Exercise 3: calculating Z scores A baby is born weighing 4.5 kg. Given the mean weight is 3.4 and SD is 0.57, calculate the Z score for this baby x = Individual score of interest • Is this within the 95% normal range? • Use the normal distribution one-sided probability table to calculate the probability of getting a Z score above 1.93

  29. Table: Normal curve tail probabilities (one tailed). Standard normal probability in right-hand tail

  30. Other probability distributions • Other distributions can be used to calculate probabilities • Depends upon data type, distribution, question to be answered • Each has a particular statistic that you calculate. Here are a few examples (there are many others): F distribution: f statistic t distribution: t statistic χ2 distribution χ2statistic • The Z statistic is used for the standard normal distribution

  31. Hypothesis testing

  32. Populations and samples Taking a sample from a population Sample data are used to ‘represents the whole population

  33. Types of statistics • Descriptive statistics summarise and describe sample data we have collected • Inferential statistics are obtained when we use sample data to infer something about the wider population

  34. Hypothesis testing • Hypothesis testing is a method of making decisions about populations using sample data • Sample data are used to decide which of two possible statements about a population is most likely to be true • We do this by comparing what we have observed to what we expected

  35. Hypothesis testing: main steps

  36. Define study question • Think carefully about the main research question. What do you want to know? • What variables will be used to test the question? There are specific tests for different types of data • Think about the analysis before carrying out the study

  37. Null and alternative hypothesis (H0 & H1) State your nullhypothesis (H0) (statement you are looking for evidence to disprove) State your study (alternative)hypothesis (H1 or HA) which is usually the opposite of the null hypothesis

  38. The court case • Members of a jury have to decide whether a person is guilty or innocent based on evidence Null: The person is innocent Alternative: The person is not innocent • The null (innocent) can only be rejected if there is enough evidence to disprove it

  39. The court case • A man may be guilty or innocent of a crime • He is presumed innocent unless there is evidence to suggest otherwise • Members of a jury have to decide whether a person is guilty or innocent based on evidence Decision: Convict/Release

  40. Null and alternative hypothesis (H0 & H1) • For comparing means the null is: There is no difference in the population means Where: μA is the population mean for group A μBis the population mean for group B • When investigating relationships the null is: There is no association between x and y

  41. Exercise 4: Hypotheses What would the null and alternative hypotheses be for these research questions? • Did class affect survival on board the Titanic? • Do students who attend MASH workshops do better in their statistics module than those who do not?

  42. Example: Module marks 10 students who attended a MASH workshop and 10 students who did not attend a MASH workshop Results: Can we conclude that there is a difference between the populations?

  43. Variation in single samples Every sample taken from a population will contain different numbers so the difference between means varies between samples

  44. Test Statistic Test Statistic is a number calculated from sample data to decide whether to reject the null hypothesis about the population or not. It varies between different test and looks at what we observed and compares it to what we would expect under the null hypothesis. For our test (final module mark): Test statistic =

  45. P values If you repeated a study numerous times you would get a variety of test statistics which form a distribution P-value = Probability of getting a test statistic as extreme as the one calculated, if the null is true

  46. Example: Module marks Null: The mean module mark is the same for students who attended a MASH workshop and those who did not If this is true, we would expect some test statistics to be negative and some positive just by chance

  47. Statistical significance We say that our result is statistically significant if the p-value is less than some predefined level, referred to as the significance level (), usually set at 5% Small p-value = null unlikely to be true We cannot say that the null hypothesis is true, only that there is not enough evidence to reject it

  48. Statistical significance Null: The mean module mark for students who attend MASH workshops is the same as for students who do not attend MASH workshops Alternative: The mean module mark for students who attend MASH workshops is the higher than for students who do not attend MASH workshop

  49. Exercise 5: Statistical significance • The significance level is usually set at 5%, this is conventional rather than fixed – for stronger proof could use a level of 1% (0.01) • The smaller the p-value, the more confident we are with our decision to reject • The p-value for the test of a difference in module marks between students who do and do not attend a MASH workshop was 0.02. What would you conclude and how confident are you with your decision?

  50. Example: Module marks • As p < 0.05, there is evidence to suggest that students who attend a MASH workshop do better in their statistics module than students who do not attend a workshop. As p = 0.02, there is a 2% chance of rejecting the null when it is true (i.e. 1 in 50) • What is the difference? • For the sample tested, those who attended a MASH workshop scored 4 percentage points higher than those who did not attend a workshop in their final module exam

More Related