# 14. Pengantar Biostatistika: KOMPILASI UJI STATISTIK  Views:

## Presentation Description

No description available.

## Presentation Transcript

### slide 1:

Kurva normal dan Kaidah Empiris Distribusi variabel acak kontinu akan mengikuti bentuk kurva normal.. Gambar 1. Pada kurva normal mean median dan modus semua berada di pusat tengah. Gambar 2. Grafik berubah arah pada titik-titik infleksi. Titik-titik pertama ini menandai jarak satu standar deviasi dari mean.

### slide 2:

Gambar 3. Kaidah Empiris Kaidah Empiris Menyatakan bahwa: 68 dari semua nilai berada dalam 1 SD dari mean. 95 dari semua nilai berada dalam 2 SD dari mean. 99.7 dari semua nilai berada dalam 3 SD.

### slide 3:

Nilai – Z Bagian 1 Nilai – z Nilai - z nilai-nilai yang di standarisasi yang dapat digunakan untuk membandingkan skor dalam distribusi yang berbeda. Ambil contoh ini: Selama dua tahun yang lalu Joni liga bowling .. Statistik tahun pertama: Rata-rata liga 181 Standar Deviasi 12 Skor Joni di Final 187 Statistik tahun kedua: Rata-rata liga 182 Standar Deviasi 5 Skor Joni di Final 185 Bandingkan kedua liga pada tahun liga yang mana skor Joni lebih baik Gambar 1. Kita dapat menhitung Nilai-z masing-masing tahun: Gambar 2.

### slide 4:

Kemudian Kita dapat mem-plot nilai-z- dan membandingkan penempatan nilai tersebut pada distribusi. Dari grafik di bawah ini Anda dapat melihat bahwa dari kedua skor Joni Joni memiliki skor yang lebih baik pada tahun kedua. Gambar 3.

### slide 5:

Nilai – Z Bagian 2 Katakanlah kita memiliki variabel acak x berdisdistribusi seperti: Gambar 1. Kita dapat melihat dari distribusi yang mana x memeiliki nilai mean 4 dan Standar deviasi 1. Kita ingin mengetahui: Berapa persen dari skor berada diatas 425 Figure 2. Atau pada dasarnya Berapa skor yang berada di daerah biru ini. Ingat dari kaidah empiris yang mana kita tahu berapa probabilitas yang berhubungan dengan daerah yang berbeda dari distribusi normal. Kita dapat menggunakan informasi ini untuk menemukan persentase skor di atas 425. Terlebih dahulu Kita perlu menghitung nilai - z:

### slide 6:

Gambar 3. With our z-score of 0.25 we now head to the z-table to find the area associated with it. The first thing youll notice about the z table is that its asking for the "area in body". Gambar 4. When you split a distribution into two parts the smaller portion is the tail while the larger portion is the body. Were trying to look up a tail but this table only gives us body. To find the correct answer we must first find the area in the body then subtract it from 1. That will give us the area in the tail. Looking up the area in the body for z 0.25 we find a proportion of 0.5987. To find our final answer we just have to make one quick change: Area in Body 0.5987 Area in Tail 1.00-0.5987 0.4013 So about 40 of scores fall above 4.25.

### slide 7:

One Sample z-Test Lets perform a one sample z-test: In the population the average IQ is 100 with a standard deviation of 15. A team of scientists wants to test a new medication to see if it has either a positive or negative effect on intelligence or no effect at all. A sample of 30 participants who have taken the medication has a mean of 140. Did the medication affect intelligence using alpha 0.05 Steps for One-Sample z-Test 1. Define Null and Alternative Hypotheses 2. State Alpha 3. State Decision Rule 4. Calculate Test Statistic 5. State Results 6. State Conclusion Lets begin. 1. Define Null and Alternative Hypotheses Figure 1. 2. State Alpha "" p"" style"color: rgb51 51 51 font-family: Arial Helvetica sans-serif font-size: 13px font-style: normal font-variant: normal font-weight: normal letter-spacing: normal line-height: 18px orphans: auto text-align: start text-indent: 0px text-transform: none white-space: normal widows: 1 word-spacing: 0px -webkit-text-stroke-width: 0px background-color: rgb255 255 255""" p"" Using an alpha of 0.05 with a two-tailed test we would expect our distribution to look something like this:

### slide 8:

Figure 2. Here we have 0.025 in each tail. Looking up 1 - 0.025 in our z-table we find a critical value of 1.96. Thus our decision rule for this two-tailed test is: If Z is less than -1.96 or greater than 1.96 reject the null hypothesis. 4. Calculate Test Statistic Figure 3. 5. State Results Z 14.60 Result: Reject the null hypothesis. 6. State Conclusion Medication significantly affected intelligence z 14.60 p 0.05.

### slide 9:

Student’s t-Distribution When performing any type of test or analysis using a Z-score it is required that the population standard deviation already be known. In real life this is hardly ever the case. It is almost impossible for us to know the standard deviation of the population from which our sample is drawn. Student’s t-Distribution We use Student’s t-distribution to perform an analysis when we don’t know the population standard deviation or when or sample size is unreasonably small. Figure 1. Student’s t-Distribution has n - 1 degrees of freedom. Remember that we are no longer given population standard deviation. Instead we must estimate it with sample standard deviation. Sample standard deviation itself is a random variable. The proof for degrees of freedom is far beyond the scope of this lecture. Just try to understand that by calculating sample standard deviation it is given a fixed value and thus one less value is free to vary. These degrees of freedom change how the probability distribution looks. The probability distribution of t has more dispersion than the normal probability distribution associated with z. When performing tests using t we expect the probability distribution to look slightly different so we must use a different t table click to open to calculate areas associated with different areas of the graph when taking degrees of freedom into account.

### slide 10:

Extra Z-Score Problems Here are some extra problems involving z-scores: In the United States the average IQ is 100 with a standard deviation of 15. What percentage of the population would you expect to have an IQ lower than 85 Figure 1. Basically were trying to find what area corresponds to the blue tail shown above. First we calculate the z-score. Figure 2. We then look up this z-score in our z-table. After doing so we find the area in the body is .8413. We subtract that value from 1 to find the area in the tail.

### slide 11:

Figure 3. Our answer is .1587. About 16 of the population has an IQ score lower than 85. What if the question was like this: In the United States the average IQ is 100 with a standard deviation of 15. What percentage of the population would you expect to have an IQ between 90 and 120 Figure 4. Were trying to find what area corresponds to the blue area shown above. First we calculate both z-scores.

### slide 12:

Figure 5. In order to find the area between those two z-scores we must first look up each z-score in the Z table click to open. We find that the area in the body for 0.66 is 0.7454 and the area in the body for 1.33 is 0.9082. Figure 6. Using this information and what we know about the normal curve we find that 65.36 of the population has an IQ score between 90 and 120.

### slide 13:

One Sample z-Test for Proportions Lets perform a one sample z-test for proportions: A survey claims that 9 out of 10 doctors recommend aspirin for their patients with headaches. To test this claim a random sample of 100 doctors is obtained. Of these 100 doctors 82 indicate that they recommend aspirin. Is this claim accurate Use alpha 0.05 Steps for One-Sample z-Test for Proportions 1. Define Null and Alternative Hypotheses 2. State Alpha 3. State Decision Rule 4. Calculate Test Statistic 5. State Results 6. State Conclusion Lets begin. 1. Define Null and Alternative Hypotheses Figure 1. 2. State Alpha Alpha 0.05 3. State Decision Rule Using an alpha of 0.05 with a two-tailed test we would expect our distribution to look something like this:

### slide 14:

Figure 2. Here we have 0.025 in each tail. Looking up 1 - 0.025 in our z-table we find a critical value of 1.96. Thus our decision rule for this two-tailed test is: If Z is less than -1.96 or greater than 1.96 reject the null hypothesis. 4. Calculate Test Statistic Figure 3. 5. State Results z -2.667 Result: Reject the null hypothesis. 6. State Conclusion The claim that 9 out of 10 doctors recommend aspirin for their patients is not accurate z -2.667 p 0.05.

### slide 15:

z-Test for Proportions Two Samples Lets perform a z-test for proportions two samples: Researchers want to test the effectiveness of a new anti-anxiety medication. In clinical testing 64 out of 200 people taking the medication report symptoms of anxiety. Of the people receiving a placebo 92 out of 200 report symptoms of anxiety. Is the medication working any differently than the placebo Test this claim using alpha 0.05. Steps for z-Test for Proportions Two Samples 1. Define Null and Alternative Hypotheses 2. State Alpha 3. State Decision Rule 4. Calculate Test Statistic 5. State Results 6. State Conclusion Lets begin. 1. Define Null and Alternative Hypotheses Figure 1. 2. State Alpha Alpha 0.05 3. State Decision Rule Using an alpha of 0.05 with a two-tailed test we would expect our distribution to look something like this:

### slide 16:

Figure 2. Here we have 0.025 in each tail. Looking up 1 - 0.025 in our z-table we find a critical value of 1.96. Thus our decision rule for this two-tailed test is: If Z is less than -1.96 or greater than 1.96 reject the null hypothesis. 4. Calculate Test Statistic Figure 3. 5. State Results z 2.869 Result: Reject the null hypothesis. 6. State Conclusion

### slide 17:

There was a significant difference in effectiveness between the medication group and the placebo group z -2.869 p 0.05. Confidence Intervals for the Difference of Two Proportions Jump to: Lecture | Video We use the z-Test for Proportions to test if two proportions are different from one another. After the z-test confidence intervals can be constructed to estimate how large that difference is. Imagine we already have this data from a previous z-test: Figure 1. Construct a 95 confidence interval for the proportion difference. Figure 2. Above are the equations for the lower and upper bounds of the confidence interval. Figure 3.

### slide 18:

We already know most of the variables in the equation but what should we put for z We want to create a 95 confidence interval. That means we have an alpha of 0.055 which is split into two equal tails. This 2.5 refers to the value we look up in the z-table in order to find the z-score we need to plug into the equation. When we look up 1 - 0.025 we find a z score of 1.96. Figure 4. We are 95 confident that the mean difference between the two proportions is between 0.045 and 0.235.

### slide 19:

One Sample t-Test Lets perform a one sample t-test: In the population the average IQ is 100. A team of scientists wants to test a new medication to see if it has either a positive or negative effect on intelligence or no effect at all. A sample of 30 participants who have taken the medication has a mean of 140 with a standard deviation of 20. Did the medication affect intelligence Use alpha 0.05. Steps for One-Sample t-Test 1. Define Null and Alternative Hypotheses 2. State Alpha 3. Calculate Degrees of Freedom 4. State Decision Rule 5. Calculate Test Statistic 6. State Results 7. State Conclusion Lets begin. 1. Define Null and Alternative Hypotheses Figure 1. 2. State Alpha Alpha 0.05 3. Calculate Degrees of Freedom df n - 1 30 - 1 29 4. State Decision Rule Using an alpha of 0.05 with a two-tailed test with 29 degrees of freedom we would expect our distribution to look something like this:

### slide 20:

Figure 2. Use the t-table to look up a two-tailed test with 29 degrees of freedom and an alpha of 0.05. We find a critical value of 2.0452. Thus our decision rule for this two-tailed test is: If t is less than -2.0452 or greater than 2.0452 reject the null hypothesis. 5. Calculate Test Statistic Figure 3. 6. State Results t 10.96 Result: Reject the null hypothesis. 7. State Conclusion Medication significantly affected intelligence t 10.96 p 0.05.

### slide 21:

t-test Two Dependent Samples Lets perform a dependent samples t-test: Researchers want to test a new anti-hunger weight loss pill. They have 10 people rate their hunger both before and after taking the pill. Does the pill do anything Use alpha 0.05 Figure 1. Steps for Dependent Samples t-Test 1. Define Null and Alternative Hypotheses 2. State Alpha 3. Calculate Degrees of Freedom 4. State Decision Rule 5. Calculate Test Statistic 6. State Results 7. State Conclusion Lets begin.

### slide 22:

1. Define Null and Alternative Hypotheses Figure 2. 2. State Alpha Alpha 0.05 3. Calculate Degrees of Freedom Figure 3. 4. State Decision Rule Using an alpha of 0.05 with a two-tailed test with 9 degrees of freedom we would expect our distribution to look something like this: Figure 4.

### slide 23:

Use the t-table to look up a two-tailed test with 9 degrees of freedom and an alpha of 0.05. We find a critical value of 2.2622. Thus our decision rule for this two-tailed test is: If t is less than -2.2622 or greater than 2.2622 reject the null hypothesis. 5. Calculate Test Statistic The first step is for us to calculate the difference score for each pairing: Figure 5. Now we can calculate our t value:

### slide 24:

Figure 6. 6. State Results t 3.61 Result: Reject the null hypothesis. 7. State Conclusion The anti-hunger weight loss pill significantly affected hunger t 3.61 p 0.05.

### slide 25:

`Independent Samples t-Test Lets perform an independent samples t-test: A statistics teacher wants to compare his two classes to see if they performed any differently on the tests he gave that semester. Class A had 25 students with an average score of 70 standard deviation 15. Class B had 20 students with an average score of 74 standard deviation 25. Using alpha 0.05 did these two classes perform differently on the tests Steps for Independent Samples t-Test 1. Define Null and Alternative Hypotheses 2. State Alpha 3. Calculate Degrees of Freedom 4. State Decision Rule 5. Calculate Test Statistic 6. State Results 7. State Conclusion Lets begin. 1. Define Null and Alternative Hypotheses Figure 1. 2. State Alpha Alpha 0.05 3. Calculate Degrees of Freedom

### slide 26:

Figure 2. 4. State Decision Rule Using an alpha of 0.05 with a two-tailed test with 43 degrees of freedom we would expect our distribution to look something like this: Figure 3. Use the t-table to look up a two-tailed test with 43 degrees of freedom and an alpha of 0.05. We find a critical value of 2.0167. Thus our decision rule for this two-tailed test is: If t is less than -2.0167 or greater than 2.0167 reject the null hypothesis. 5. Calculate Test Statistic The first step is to calculate the df and SS for each sample: Figure 4. We then use that information to calculate the pooled variance: Figure 5.

### slide 27:

Finally we can calculate our t value: Figure 6. 6. State Results t -0.67 Result: Do not reject the null hypothesis. 7. State Conclusion There was no significant difference between the test performances of Class A and Class B t -0.67 p 0.05.

### slide 28:

t-test Two Dependent Samples Lets perform a dependent samples t-test: Researchers want to test a new anti-hunger weight loss pill. They have 10 people rate their hunger both before and after taking the pill. Does the pill do anything Use alpha 0.05 Figure 1. Steps for Dependent Samples t-Test 1. Define Null and Alternative Hypotheses 2. State Alpha 3. Calculate Degrees of Freedom 4. State Decision Rule 5. Calculate Test Statistic 6. State Results 7. State Conclusion

### slide 29:

Lets begin. 1. Define Null and Alternative Hypotheses Figure 2. 2. State Alpha Alpha 0.05 3. Calculate Degrees of Freedom Figure 3. 4. State Decision Rule Using an alpha of 0.05 with a two-tailed test with 9 degrees of freedom we would expect our distribution to look something like this: Figure 4.

### slide 30:

Use the t-table to look up a two-tailed test with 9 degrees of freedom and an alpha of 0.05. We find a critical value of 2.2622. Thus our decision rule for this two-tailed test is: If t is less than -2.2622 or greater than 2.2622 reject the null hypothesis. 5. Calculate Test Statistic The first step is for us to calculate the difference score for each pairing: Figure 5. Now we can calculate our t value: Figure 6.

### slide 31:

6. State Results t 3.61 Result: Reject the null hypothesis. 7. State Conclusion The anti-hunger weight loss pill significantly affected hunger t 3.61 p 0.05.

### slide 32:

Confidence Intervals for Dependent Samples t-Test We use the dependent samples t-test to test if two sample means are different from one another. After the t-test confidence intervals can be constructed to estimate how large that mean difference is. Imagine we already have this data from a previous t-test: Figure 1. Construct a 95 confidence interval for the mean difference. Figure 2. Above are the equations for the lower and upper bounds of the confidence interval. Figure 3. We already know most of the variables in the equation but what should we put for t First we need to calculate the degrees of freedom: df n - 1 df 10 - 1 9

### slide 33:

Now well use the degrees of freedom value to look up the t value. Go to the t-table and look up the critical value for a two-tailed test alpha 0.05 and 9 degrees of freedom. You should find a value of 2.2622. Now we can finish calculating the lower and upper bounds: Figure 4. We are 95 confident that the mean difference between "before" and "after" is between 0.634 and 2.76.

### slide 34:

Effect Size for Dependent Samples t-Test Remember that effect size allows us to measure the magnitude of mean differences. This is usually calculated after rejecting the null hypothesis in a statistical test. If the null hypothesis is not rejected effect size has little meaning. Lets say we already have this data from a previous t-test: Figure 1. One method of calculating effect size is cohens d: Figure 2. With cohens d remember that: d 0.2 small effect d 0.5 medium effect d 0.8 large effect So our d of 1.14 would be a large effect size. Another method of calculating effect size is with r squared: Figure 3. With r squared: Figure 4. 0.59 indicates a very large effect. Our means are likely very different

### slide 35:

Mann-Whitney U Mann-Whitney U-Test The Mann-Whitney U-Test is a version of the independent samples t-Test that can be performed on ordinalranked data. Ordinal data is displayed in the table below. Is there a difference between Treatment A and Treatment B using alpha 0.05 Figure 1. Lets test to see if there is a difference with a hypothesis test. Steps for Mann-Whitney U-Test 1. Define Null and Alternative Hypotheses 2. State Alpha 3. State Decision Rule 4. Calculate Test Statistic 5. State Results 6. State Conclusion 1. Define Null and Alternative Hypotheses Figure 2. 2. State Alpha alpha 0.05 3. State Decision Rule When you have a sample size that is greater than approximately 30 the Mann-Whitney U statistic follows the z distribution. Here our sample is not greater than 30. However I will

### slide 36:

still be using the z distribution for the sake of brevity. Keep this requirement in mind We look up our critical value in the z-Table and find a critical value of plus/minus 1.96. If z is less than -1.96 or greater than 1.96 reject the null hypothesis. 4. Calculate Test Statistic First we must rank all of our scores and indicate which group the scores came from: Figure 3. If there is a tie as shown below we average the ranks:

### slide 37:

Figure 4. Next we give every "B" group one point for every "A" group that is above it. We also give every "A" group one point for every "B" group that is above it. We then add together the points for "A" and "B" and take the smaller of those two values which we call "U". Figure 5.

### slide 38:

The "U" score is then used to calculate the z statistic: Figure 6. 5. State Results If z is less than -1.96 or greater than 1.96 reject the null hypothesis. z -2.88 Reject the null hypothesis. 6. State Conclusion There is a difference between the ranks of the two treatments z -2.88 p .05.

### slide 39:

Wilcoxon Signed-Ranks Test Wilcoxon Signed-Ranks Test The Wilcoxon Signed-Ranks Test is a version of the dependent samples t-Test that can be performed on ordinalranked data. Ordinal data is displayed in the table below. Is there a difference between Before and After using alpha 0.05 Figure 1. Lets test to see if there is a difference with a hypothesis test. Steps for Wilcoxon Signed-Ranks Test 1. Define Null and Alternative Hypotheses 2. State Alpha 3. State Decision Rule 4. Calculate Test Statistic 5. State Results 6. State Conclusion 1. Define Null and Alternative Hypotheses Figure 2. 2. State Alpha alpha 0.05 3. State Decision Rule

### slide 40:

When you have a sample size that is greater than approximately 30 the Wilcoxon Signed- Ranks statistic follows the z distribution. Here our sample is not greater than 30. However I will still be using the z distribution for the sake of brevity. Keep this requirement in mind We look up our critical value in the z-Table and find a critical value of plus/minus 1.96. If z is less than -1.96 or greater than 1.96 reject the null hypothesis. 4. Calculate Test Statistic First we must find the difference scores for our two groups: Figure 3. Next we rank the difference scores. Then we add up the rankings of both the positive scores and the negative scores. We then take the smaller of those two values which we call "T"

### slide 41:

Figure 4. The "T" score is then used to calculate the z statistic: Figure 5. 5. State Results If z is less than -1.96 or greater than 1.96 reject the null hypothesis. z -1.99

### slide 42:

Reject the null hypothesis. 6. State Conclusion There is a difference between the before and after groups z -1.99 p .05.

### slide 43:

Pearson’s r Correlation In the previous lecture on scatter plots we made a scatter plot for some sample bivariate data and concluded that the two variables were probably related. Figure 1. We can use this data to calculate Pearsons r Pearson’s r Pearson’s r measures the strength of the linear relationship between two variables. Pearson’s r is always between -1 and 1. Here is a perfect positive relationship. r is equal to 1.0: Figure 2.

### slide 44:

Here is a perfect negative relationship. r is equal to -1.0: Figure 3. Here is an example of data that has no relationship. r is somewhere close to 0.0: Figure 4. Pearsons r is calculated with the following equation: Figure 5.

### slide 45:

Plugging in the values from our original example with ages and yearly incomes we can calculate the following r: Figure 6. This r is almost 1.0 so we can conclude that xAge and yYearly Income have a strong positive relationship. As one increases the other tends to increase as well.

### slide 46:

Hypothesis Testing with Pearsons r Just like with other tests such as the z-test or ANOVA we can conduct hypothesis testing using Pearson’s r. To test if age and income are related researchers collected the ages and yearly incomes of 10 individuals shown below. Using alpha 0.05 are they related Figure 1. Steps for Hypothesis Testing with Pearsons r 1. Define Null and Alternative Hypotheses 2. State Alpha 3. Calculate Degrees of Freedom 4. State Decision Rule 5. Calculate Test Statistic 6. State Results 7. State Conclusion

### slide 47:

1. Define Null and Alternative Hypotheses Figure 2. 2. State Alpha alpha 0.05 3. Calculate Degrees of Freedom Where n is the number of subjects you have: df n - 2 10 – 2 8 4. State Decision Rule Using our alpha level and degrees of freedom we look up a critical value in the r-Table. We find a critical r of 0.632. If r is greater than 0.632 reject the null hypothesis. 5. Calculate Test Statistic We calculate r using the same method as we did in the previous lecture: Figure 3.

### slide 48:

6. State Results r 0.99 Reject the null hypothesis. 7. State Conclusion There is a relationship between age and yearly income r8 0.99 p 0.05

### slide 49:

The Spearman Correlation In the last lectures I talked about Pearson’s r which measures the relationship between two continuous interval or ratio scale variables. Spearman Correlation The Spearman correlation is used when: 1. Measuring the relationship between two ordinal variables. 2. Measuring the relationship between two variables that are related but not linearly. Below is an example of some data that is related in a non-linear fashion. For this we would use the Spearman correlation: Figure 1.

### slide 50:

Lets calculate the Spearman correlation for the following data set: Figure 2. To calculate the Spearman correlation we must first rank the scores: Figure 3.

### slide 51:

We then calculate the correlation using these new ranks: Figure 4. We find an r of -1.00 meaning that our data has a negative relationship. As x increases y decreases. As x decreases y increases.

### slide 52:

Linear Regression In a previous lecture on Pearsons r we found two sets of data to be highly correlated: Figure 1. If we know that two variables are strongly correlated we can use one variable to predict the other using the following equations: Figure 2. Here we first calculate beta1 and beta 0 and place them in the top equation. Then if we plug an x into the equation we can predict what our y value will be. The stronger your correlation that is the closer r is to -1 or 1 the more accurate your prediction will be.

### slide 53:

First we solve for beta1: Figure 3. We then use beta1s value to solve for beta 0: Figure 4. Now putting those values into the original equation we have our completed regression equation: Figure 5.

### slide 54:

Predict the yearly income of someone who is 33 years old. Figure 6. We would expect someone who is 33 years old to make approximately 36963 a year.

### slide 55:

Correlation vs. Causation Causation Causation means that one variable causes a change in another variable. Correlation To say that two variables are correlated is to say that they share some kind of relationship. In order to imply causation a true experiment must be performed where subjects are randomly assigned to different conditions. Heres an example of a true experiment where causation can be implied: Researchers want to test a new anti-anxiety medication. They split participants into three conditions 0mg 50mg and 100mg then ask them to rate their anxiety level on a scale of 1- 10. Are there any differences between the three conditions using alpha 0.05 Figure 1. This is a true experiment because participants are randomly being assigned to different conditions. Any differences between the three groups should only be due to the effects of dosage.

### slide 56:

Heres an example of correlational data: Figure 2. Here we see that students who spend more time studying for tests tend to score better than students who spend less time studying. However because this is not a true experiment we cannot imply that studying causes better test scores. Perhaps the high scoring students in this sample were just better test takers.

### slide 57:

Chi-Square Goodness-of-Fit Test Chi-Square Test for Goodness of Fit The Chi-Square Test for Goodness of Fit tests claims about population proportions. It is a nonparametric test that is performed on categoricalnominal or ordinal data. Lets try an example. In the 2000 U.S. Census the ages of individuals in a small town were found to be the following: Figure 1. In 2010 ages of n 500 individuals from the same small town were sampled. Below are the results: Figure 2. Using alpha 0.05 would you conclude that the population distribution of ages has changed in the last 10 years Using our sample size and expected percentages we can calculate how many people we expected to fall within each range. We can then make a table separating observed values versus expected values: Figure 3.

### slide 58:

Lets perform a hypothesis test on this new table to answer the original question. Steps for Chi-Square Test for Goodness of Fit 1. Define Null and Alternative Hypotheses 2. State Alpha 3. Calculate Degrees of Freedom 4. State Decision Rule 5. Calculate Test Statistic 6. State Results 7. State Conclusion 1. Define Null and Alternative Hypotheses Figure 4. 2. State Alpha alpha 0.05 3. Calculate Degrees of Freedom df k – 1 where k your number of groups. df 3 – 1 2 4. State Decision Rule Using our alpha and our degrees of freedom who look up a critical value in the Chi-Square Table. We find our critical value to be 5.99. Figure 5.

### slide 59:

5. Calculate Test Statistic The Chi-Square statistic is found using the following equation where observed values are compared to expected values: Figure 6. 6. State Results Figure 7. Reject the null hypothesis. 7. State Conclusion The ages of the 2010 population are different than those expected based on the 2000 population.

### slide 60:

Chi-Square Test for Independence Chi-Square Test for Independence The Chi-Square Test for Independence evaluates the relationship between two variables. It is a nonparametric test that is performed on categoricalnominal or ordinal data. Lets try an example. 500 elementary school boys and girls are asked which is their favorite color: blue green or pink Results are shown below: Figure 1. Using alpha 0.05 would you conclude that there is a relationship between gender and favorite color Lets perform a hypothesis test to answer this question. Steps for Chi-Square Test for Independence 1. Define Null and Alternative Hypotheses 2. State Alpha 3. Calculate Degrees of Freedom 4. State Decision Rule 5. Calculate Test Statistic 6. State Results 7. State Conclusion 1. Define Null and Alternative Hypotheses Figure 2.

### slide 61:

2. State Alpha alpha 0.05 3. Calculate Degrees of Freedom df rows – 1columns – 1 df 2 – 13 – 1 df 12 2 4. State Decision Rule Using our alpha and our degrees of freedom who look up a critical value in the Chi-Square Table. We find our critical value to be 5.99. Figure 3. 5. Calculate Test Statistic First we need to calculate our expected values using the equation below. We find the expected values by multiplying each row total by each column total and then diving by the total number of subjects. The calculations for boys who like blue are shown. Figure 4. Next we calculate our Chi-Square value by comparing observed values to expected values shown in parentheses:

### slide 62:

Figure 5. 6. State Results Figure 6. Reject the null hypothesis. 7. State Conclusion In the population there is a relationship between gender and favorite color. 