# Class 33: Time to Work on Projects

This outline is also available in PDF.

Held: Monday, 21 April 2008

Summary: We spend time exploring the kinds of analyses you should do for the project.

Notes:

• Exam 2 returned. We will discuss it on Wednesday, if you wish.
• Makeup exam Thursday a.m. One-hour block of your choice. You will get the better of (a) makeup grade, capped at 86; (b) average of makeup grade and exam grade; (c) exam 2 grade. E.g., 50 on exam 2, 82 on makeup yields 82; 80 on exam 2, 100 on makeup yields 90.
• Exam 3a given in class.
• Exam 3b is a take-home question, due Wednesday.
• Due: Mini-Project Memos.

Overview:

• Q&A.
• An example analysis.
• Time to work.

## Time for Questions on the Poster

• Are there questions on the poster?

## A Sample Analysis

• For many problems, you will do a chi-square style analysis.
• We'll use as an example variables 1 (sex) and 3 (what choice was Grinnell?)
```> SC = fys[,c(1,3)]
> table(SC)
CHOICE
SEX   1   2   3   4
1   4  11  34 108
2  15   7  35 127
> SCframe = data.frame(row.names=c("Below Third","Third","Second","First"),
+   Male=SCtable[1,],
+   Female=SCtable[2,])
> SCframe
Male Female
Below Third    4     15
Third         11      7
Second        34     35
First        108    127
```

We can simple apply the `chisq.test` procedure to this table to get the important values.

```> chisq.test(SCframe)
Pearson's Chi-squared test
data:  SCframe
X-squared = 6.7122, df = 3, p-value = 0.08166
```

However, we will often want to look more carefuly at the differences between observed and expected values. The computation of the expected values is a strange formula that I don't expect you to understand. (I do expect that you could do an individual computation by hand, but this does all of them at once.)

```> SCexpected = rowSums(SCframe) %o% colSums(SCframe)/sum(SCframe)
> SCexpected
Male    Female
Below Third   8.74780  10.25220
Third         8.28739   9.71261
Second       31.76833  37.23167
First       108.19648 126.80352
```

We can now compare directly.

```> SCframe - SCexpected
Male     Female
Below Third -4.7478006  4.7478006
Third        2.7126100 -2.7126100
Second       2.2316716 -2.2316716
First       -0.1964809  0.1964809
```

As importantly, we can compute the deviations.

```> (SCframe-SCexpected)^2/SCexpected
Male       Female
Below Third 2.5768317632 2.1987097110
Third       0.8878854292 0.7575978934
Second      0.1567711671 0.1337667023
First       0.0003568024 0.0003044455
```

What does this tell us?

## Time To Work

• Cassie and I will wander around and try to answer questions.

This document may be found at `http://www.cs.grinnell.edu/~rebelsky/Courses/MAT115/2008S/Outlines/outline.33.html`.
Copyright © 2008 Samuel A. Rebelsky. This work is licensed under a Creative Commons Attribution-NonCommercial 2.5 License. To view a copy of this license, visit `http://creativecommons.org/licenses/by-nc/2.5/` or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.