# Stat 512 Homework 5 Proving

*Please check this section from time to time for updates to the schedule or other information.*

**03/12:** Welcome back from spring break! Homework #3 is posted below.

**02/27:** The way we have framed the formulation of the general linear model, and how we will continue to frame it, is not the most efficient. This can all be formulated very conveniently using vectors, matrices, and the tools from linear algebra. Since few/none of you will have this background, and there isn't time to teach it to you in ST512, I will not discuss this in class. There is a summary in Chapter 12.9 of Ott & Longnecker and, if you're interested, I can tell you more about it in office hours. It's also pretty easy, at least in R, to do these vector/matrix calculations, and here is some sample code.

**02/26:** The exams have been graded and the scores are recorded on moodle, so I'll return them to you in class tomorrow. As I'll explain, I adjusted the scale to be out of 90 points, instead of 100, and the score you see on moodle is your score out of 90. When I calculate your final grades, I will adjust this scores by multiplying by 1.1 = 100 / 90. A summary of the adjusted scores (scaled to 100) is here. Of the 72 students who took the exam, the average adjusted score is 81 and the standard deviation is 9.8.

**02/23:** My solutions to Exam 1 are here. I will do my best to have the exams graded and ready to return to you by next Tuesday but, if that doesn't happen, then by next Thursday for sure. Have a nice weekend!

**02/18:** Just a reminder, for the exam you are allowed a one-page (regular-sized, front and back) sheet of notes with anything you want to write on it. The only condition is that the notes must be *handwritten*. Also, you should bring a calculator to the exam for some basic arithmetic; nothing fancy is required, being able to do square roots is enough.

**02/18:** Solutions to the review problems and old exam are here and here, respectively.

**02/13:** As promised, here are some review problems for Exam 1 and here is the exam I gave last spring. Next week, both in lecture and in lab, you will have an opportunity to ask questions about these materials. Solutions will be posted over the weekend.

**02/06:** I apologize for the confusion, but there was a minor issue with the grades entered in the moodle gradebook. I asked the grader to score the homework out of 20 total points but the gradebook item was set with a max of 30 points. I have changed the gradebook item to have a max of 20 points, so it should be fine now. The point max points on a homework don't really matter anyway, only the percentage.

**02/03:** Sorry I'm late, but Homework 02 is posted below.

**01/26:** I apologize for being a little bit behind schedule; the snow-day messed me up a bit more than I had anticipated, but I hope that we can get caught up on Tuesday. For now, let me give you some quick SAS help with the plots we discussed in class on Thursday—my time ran out before I could show you the plots in SAS.

Go to the SAS code I provided below for Example 11-4 in the text. From the output of the first PROC REG statement there, you get a 3x3 grid of plots labeled "Fit Diagnostics". Of the nine plots displayed there, the only ones relevant to us now are those three in the first column. In particular, from top to bottom, the first plot isresiduals versus fitted(for assessing the linearity assumption and, in this one-explanatory-variable case, the constant variance assumption), theQ-Q plot of residuals(for assessing the normality assumption), and ahistogram of residuals(also for assessing normality). I'll go through this quickly at the beginning of lecture on Tuesday, but you may need some of these plots for the homework.

**01/24:** I had meant to ask the lab TA to go over, on the first day, how to get the SAS output in a format that you can easily copy-paste into a Word file for homework submissions, but I must have forgot. Anyway, here is an example of how you can do it. This certainly isn't the only way to do it, and I make no claims that it's the best, but it seems to work reasonably well. The only thing you have to be careful about is keeping track of were the file gets saved so you can find it later; this is machine-specific, so I can't give any general recommendations. Also, I recommend that you write your codes and view the output in the regular output screen in SAS; then, after your satisfied that your code is correct and everything looks good, insert those lines at the beginning and end so that the output gets saved how and where you want it. I found this explanation here and, if you're interested in digging into this a bit more, the navigation bar on the side points you to some additional help pages related to generating document-ready output.

**01/22:** Hope you enjoyed the snow-day last week. We're back on our regular schedule this week, and the lab assignment is posted below. (The first problem is the same as one from the first lab, which is intentional; when you saw that problem in the first week, you didn't know about the tests and confidence intervals, but now you do so it's a good time to go through that one again quickly.)

**01/16:** The first homework assignment has been posted below.

**01/15:** No lab this week (Jan 16th and 17th). I wanted you to get some experience with SAS during the first week but we've not covered enough material yet to do anything interesting in lab. Next week we'll be ready for lab as usual.

**01/11:** On Tuesday (01/09) I said a few words about philosophy and, in particular, that statistical analysis a powerful tool for gaining scientific insight, but that there is a lot more to it than plugging data into a statistical software package and hitting "run". Here is a paper I finished recently with a friend of mine that gives some more details related to these important points.

**01/09:** My expectation is that you will be able to pick up virtually all of the SAS that you need for the homework assignments, etc, from your experiences in the lab and from the examples that I go over in lecture. However, this probably is not be enough for you to really *learn* SAS. I personally don't know SAS all that well—I especially have trouble to remember the abbreviations for the various options—but, fortunately, there is a wealth of information on the web to help. As we proceed, I will post some stuff from the web that seems helpful. For now, here is some general information that I've found that I think is pretty useful:

*The Little SAS Book*, by Delwiche and Slaughter, is pretty good; not all the stuff there is relevant to ST512, but a good resource to have if learning SAS is important for your future goals.

**01/09:** I can confirm that the 7th edition of the textbook IS on reserve at the library. So if you don't have your own copy of the book, you can check the book out for an hour or so to take pictures of the details of the exercises assigned for homework.

**01/09:***If you are registered for ST512*, then you can access SAS on your personal computer by following the instructions here to get to the "virtual teaching lab." I set this up on my (Mac) computer in my office and it seems to work fine. If you're off-campus, then you also need to set up a VPN; there's some instructions on the linked page above for setting this up.

**01/09:** I'm going to keep a "log" of the material covered each day, along with the relevant sections in Ott & Longnecker's book, in the "Course Outline" section below. This is partly to help me keep a record and partly to help students in case you have to miss a lecture day.

**01/09:** Homework and exam scores for this course will be posted on *moodle*, which can be accessed from the WolfWare website here. Please check your grades occasionally to be sure that your scores have been recorded correctly.

**01/09:** Here are a few important dates—I will remind you of these things in class when the time is near. First, Spring Break is March 5th–9th so there will be no class that week. Second, our midterm exams are *tentatively* scheduled for **Thursday, February 22nd** and **Thursday, April 5th**. Third, the final exam will be held on **Thursday, May 3rd**, 8–11am, which is based on the schedule set by the university.

**01/09:** Welcome to ST512!

Hypothesis Testing > Support or Reject Null Hypothesis

**Contents:**

- What does it mean to reject the null hypothesis?
- Support or Reject the null hypothesis: Steps

## What does it mean to reject the null hypothesis?

Watch the video or read the article below:

In many statistical tests, you’ll want to either reject or support the null hypothesis. For elementary statistics students, the term can be a tricky term to grasp, partly because the name “null hypothesis” doesn’t make it clear about *what *the null hypothesis actually is!

## Overview

The null hypothesis can be thought of as a *nullifiable *hypothesis. That means you can nullify it, or reject it. What happens if you reject the null hypothesis? It gets replaced with the alternate hypothesis, which is what you think might actually be true about a situation. For example, let’s say you think that a certain drug might be responsible for a spate of recent heart attacks. The drug company thinks the drug is safe. The null hypothesis is always the accepted hypothesis; in this example, the drug is on the market, people are using it, and it’s generally accepted to be safe. Therefore, the null hypothesis is that the drug is safe. The alternate hypothesis — the one you want to replace the null hypothesis, is that the drug *isn’t* safe. Rejecting the null hypothesis in this case means that you will have to prove that the drug is not safe.

*Vioxx was pulled from the market* after it was linked to heart problems.

## To reject the null hypothesis, perform the following steps:

Step 1: **State the null hypothesis.** When you state the null hypothesis, you also have to state the alternate hypothesis. Sometimes it is easier to state the alternate hypothesis first, because that’s the researcher’s thoughts about the experiment. How to state the null hypothesis (opens in a new window).

Step 2:**Support or reject the null hypothesis**. Several methods exist, depending on what kind of sample data you have. For example, you can use the P-value method. For a rundown on all methods, see: Support or reject the null hypothesis.

If you are able to reject the null hypothesis in Step 2, you can replace it with the alternate hypothesis.

That’s it!

## When to Reject the Null hypothesis

Basically, you reject the null hypothesis when your test value falls into the rejection region. There are four main ways you’ll compute test values and either support or reject your null hypothesis. Which method you choose depends mainly on if you have a proportion or a p-value.

## Support or Reject the Null Hypothesis: Steps

**Click the link the skip to the situation you need to support or reject null hypothesis for:**

General Situations: P Value

P Value Guidelines

A Proportion

A Proportion (second example)

## Support or Reject Null Hypothesis with a P Value

If you have a P-value, or are asked to find a p-value, follow these instructions to support or reject the null hypothesis. This method works if you are given an alpha level*and *if you are *not* given an alpha level. If you are given a confidence level, just subtract from 1 to get the alpha level. See: How to calculate an alpha level.

**Step 1:***State the null hypothesis and the alternate hypothesis (“the claim”).*

If you aren’t sure how to do this, follow this link for How To State the Null and Alternate Hypothesis.

**Step 2:***Find the critical value. *We’re dealing with a normally distributed population, so the critical value is a z-score.

Use the following formula to find the z-score.

Click here if you want easy, step-by-step instructions for solving this formula.

**Step 4:** Find the P-Value by looking up your answer from step 3 in the z-table. To get the p-value, subtract the area from 1. For example, if your area is .990 then your p-value is 1-.9950 = 0.005. Note: for a two-tailed test, you’ll need to halve this amount to get the p-value in one tail.

**Step 5:** Compare your answer from step 4 with the α value given in the question. Should you support or reject the null hypothesis?

If step 7 is less than or equal to α, reject the null hypothesis, otherwise do not reject it.

## P-Value Guidelines

Use these general guidelines to decide if you should reject or keep the null:

If p value > .10 → “not significant”

If p value ≤ .10 → “marginally significant”

If p value ≤ .05 → “significant”

If p value ≤ .01 → “highly significant.”

That’s it!

Back to Top

## Support or Reject Null Hypothesis for a Proportion

Sometimes, you’ll be given a proportion of the population or a percentage and asked to support or reject null hypothesis. In this case you can’t compute a test value by calculating a **z-score** (you need actual numbers for that), so we use a slightly different technique.

**Sample question:** A researcher claims that Democrats will win the next election. 4300 voters were polled; 2200 said they would vote Democrat. Decide if you should support or reject null hypothesis. Is there enough evidence at α=0.05 to support this claim?

**Step 1:***State the null hypothesis and the alternate hypothesis (“the claim”)*.

H_{o}:p ≤ 0.5

H_{1}:p > .5

**Step 2:***Compute * by dividing the number of positive respondents from the number in the random sample:

2200/4300 = 0.512.

**Step 3:***Use the following formula to calculate your test value.*

Where:

Phat is calculated in Step 2

P the null hypothesisp value (.05)

Q is 1 – p

The z-score is:

.512 – .5 / √(.5(.5) / 4300)) = 1.57

Step 4: Look up Step 3 in the z-table to get .9418.

Step 5: Calculate your p-value by subtracting Step 4 from 1.

1-.9418 = .0582

**Step 6:***Compare your answer from step 5 with the α value given in the question*. Support or reject the null hypothesis? If step 5 is less than α, reject the null hypothesis, otherwise do not reject it. In this case, .582 (5.82%) is not less than our α, so we do not reject the null hypothesis.

Back to Top

## Support or Reject Null Hypothesis for a Proportion: Second example

**Sample question:** A researcher claims that more than 23% of community members go to church regularly. In a recent survey, 126 out of 420 people stated they went to church regularly. Is there enough evidence at α = 0.05 to support this claim? Use the P-Value method to support or reject null hypothesis.

**Step 1:***State the null hypothesis and the alternate hypothesis (“the claim”)*. H_{o}:p ≤ 0.23; H_{1}:p > 0.23 (claim)

**Step 2:***Compute * by dividing the number of positive respondents from the number in the random sample:

63 / 210 = 0.3.

**Step 3: ***Find ‘p’ by converting the stated claim to a decimal:*

23% = 0.23.

Also, find ‘q’ by subtracting ‘p’ from 1: 1 – 0.23 = 0.77.

**Step 4: ***Use the following formula to calculate your test value.*

Click here if you want easy, step-by-step instructions for solving this formula.

If formulas confuse you, this is asking you to:

- Subtract p from(0.3 – 0.23 = 0.07). Set this number aside.
- Multiply p and q together, then divide by the number in the random sample. (0.23 x 0.77) / 420 = 0.00042
- Take the square root of your answer to 2
*. √(*0.1771) =*0.*0205 - Divide your answer to 1. by your answer in 3. 0.07 /
*0.*0205 = 3.41

**Step 5:** Find the P-Value by looking up your answer from step 5 in the z-table.The z-score for 3.41 is .4997. Subtract from 0.500: 0.500-.4997 = 0.003.

**Step 6:***Compare your P-value to α*. Support or reject null hypothesis? If the P-value is less, reject the null hypothesis. If the P-value is more, keep the null hypothesis.

0.003 < 0.05, so we have enough evidence to reject the null hypothesis and accept the claim.

**Note:** In Step 5, I’m using the z-table on this site to solve this problem. Most textbooks have the right of z-table. If you’re seeing .9997 as an answer in your textbook table, then your textbook has a “whole z” table, in which case don’t subtract from .5, subtract from 1. 1-.9997 = 0.003.

Back to Top

Check out our Youtube channel for video tips!

------------------------------------------------------------------------------If you prefer an online interactive environment to learn R and statistics, this *free R Tutorial by Datacamp* is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try *this Statistics with R track*.

*Facebook page*and I'll do my best to help!