Course Outline

• segmentGetting Started (Don't Skip This Part)
• segmentIntroduction to Statistics: A Modeling Approach
• segmentPART I: EXPLORING VARIATION
• segmentChapter 1 - Welcome to Statistics: A Modeling Approach
• segmentChapter 2 - Understanding Data
• segmentChapter 3 - Examining Distributions
• segmentChapter 4 - Explaining Variation
• segmentPART II: MODELING VARIATION
• segmentChapter 5 - A Simple Model
• segmentChapter 6 - Quantifying Error
• segmentChapter 7 - Adding an Explanatory Variable to the Model
• segmentChapter 8 - Models with a Quantitative Explanatory Variable
• segmentPART III: EVALUATING MODELS
• segmentChapter 9 - Distributions of Estimates
• segmentChapter 10 - Confidence Intervals and Their Uses
• segmentChapter 11 - Model Comparison with the F Ratio
• segmentChapter 12 - What You Have Learned
• segmentResources

From Numbers to Data

Although we can apply statistical techniques to any bunch of numbers, and sometimes we do just make up numbers to analyze (more about that later), we generally want to analyze numbers that represent something about the world. These numbers we refer to as data.

Measurement and Sampling

Data are the result of two fundamental processes in statistics: measurement and sampling. Measurement is the process by which we represent some attribute of an object with a number or place it into a category. For example, although no two people (a kind of object) are alike, we can take one attribute of people, such as their height, and measure it (in inches, for example).

Two people of the exact same height may be different from each other in almost every other way. But still, we can attach a number to each of them that represents their height and say that, at least in terms of this attribute, they are the same. We all find this offensive at times—no one likes to be summarized by a number that represents a single attribute. But, we can all agree that it is sometimes useful to measure things, including people!

If the objects we study (sometimes called cases or research units) are people, then sampling is the process by which we choose which people to study, since we obviously can’t study all people. People would be one example of cases we could study, but our cases could be countries or families or mice – anything we can take a sample of and then measure order to produce our data. Remember, we are analyzing data, and doing statistics, in order to understand variation. So, we will want to apply our measurements to more than one case—a sample of cases.

Where Data Come From

How we choose a sample of cases, and what measures we apply to that sample of cases, are decisions usually made with a specific research question in mind, though not always. We might measure the heights of a sample of people because we want to plan the height of a doorway, making sure that almost no one would bump their head walking through.

But sometimes, especially in this age of the internet, we find data that were collected for no particular purpose, or for someone else’s purpose. In that case we may think of a question after the fact that we could answer with the data. So sometimes people start with a question and try to find or collect data to help answer it, whereas other times they start with some data and go in search of a question or purpose that the data could address.

Two different researchers might collect the same measures but for different purposes. For example, a hospital and a dating website might both collect data on heights and weights (of patients and users, respectively). What might their purposes be?

L_Ch2_FromNumbers_9

Hospitals are interested in improving health and treating sick people. So, a hospital might track weight because it is related to other health measures, or because changes in weight might indicate an improving or worsening condition. A dating website might be interested in how people use these features to decide whether they want to interact with another person.

A hospital might actually measure height/weight objectively, using a scale, measuring tape, or ruler. But a dating website would most likely just ask users to self report their height and weight. Note that the hospital measurements might be a lot closer to the truth than the measurements found on a dating website!

The folks in these two samples might be very different! The hospital’s data typically come from people who are sick—after all, those are the people who are most likely to go to the hospital. They might also be older because older people are also more likely to be sick. The dating website sample might be younger and healthier.

L_Ch2_FromNumbers_10

Organizing Data in a Data Frame

In statistics, we generally organize data into rows and columns. Here is a small example of a set of data organized this way.

The rows represent the cases sampled. In this example, the rows represent housekeepers from different hotels. There are six rows, so six housekeepers are in this data set. Depending on the study, rows could be people, states, couples, mice—any cases you take a sample of in order to study.

The columns represent variables, or the attributes of each case that were measured. In this study, the housekeepers were either informed or not that their daily work of cleaning hotel rooms was equivalent to getting adequate exercise for good health! So one of the variables is Condition, whether they were informed of this helpful fact or not.

There are other variables such as the housekeeper’s age (Age), weight before they started the study (Wt), and their weight at the end of the study (Wt2, measured 4 weeks later). Thus, the values across each row represent that particular case’s values on each of the variables measured.

L_Ch2_FromNumbers_1

Age is a single variable, which contains different values for different individuals. Here we see six values of Age for the six housekeepers in the sample. The variable Age is like a bucket, it can hold a vector with the different ages of the housekeepers.

L_Ch2_FromNumbers_2

There are four variables (Condition, Age, Weight at beginning of study called Wt, and Weight at end of study called Wt2) shown here in four columns.

L_Ch2_FromNumbers_3

The first column of numbers (notice it has no variable label) just numbers the rows.

Data in rows and columns are stored in R objects called data frames. Data frames include the rows and columns that contain the data. But they also include some other information, which could be thought of as meta-data. The meta-data includes, for example, the names of the variables (kind of like a header at the top of each column), and a row number. This means that the headers do not “count” as a row in the data frame, just as the row numbers do not “count” as a variable.