This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Page 1 of 8 ST512 Assignment 1 Due Date: Wednesday, September 9. Note the unusual due date. Labs will typically be due on Mondays. Assignment Goals: 1. Introduce R. 2. Fit a linear regression model in R. 3. Draw statistical inferences about regression parameters. 4. Explore how changing the units of measure change regression. R: R is stateoftheart data analysis software. It can be freely downloaded at www.rproject.org . In this lab, we will learn to use R as a tool for data analysis, and as a programming tool for conducting simulations. The R Environment: When you first open R, you will see a command window called the R Console. The R prompt “>” is the location where you enter R commands. We refer to this location as the “command line.” Reading in data R works by holding objects in memory. There are many types of R objects, including vectors, arrays, and functions. The basic R object for storing data is a data frame. A data frame is very similar to a matrix, with one row for each subject and one (named) column for each observation. It is possible to construct small data frames directly from the command line. However, it is usually more efficient to build the data set in another program (e.g., Excel), save it as a text file, and then read the text file in directly to R. In this analysis we will consider a study in which researcher took measurements on 247 men and 260 women. These were primarily individuals in their twenties and early thirties, with a scattering of older men and women, all physically active (several hours of exercise a week). The measurements were taken at San Jose State University and at the U.S. Naval Postgraduate School in Monterey, California and in dozens of California health and fitness clubs. The data set “body” contains the following variables: Age (years) Weight body weight (kg) Height (cm) Gender This data set (like all data sets used in labs) is stored in a public directory that can be accessed by pointing your web browser to http://courses.ncsu.edu/st512/lec/001/data/ . Page 2 of 8 If you are working from an oncampus computer with AFS access, you can find these data on the J: drive. Read the data into R with the command > body<read.table("J:/.eos/courses/st/st512/www/lec/001/data/body.txt",head=T) If you are working from home, you need to download the data from the website above, save the data file to your local computer, and then substitute the appropriate pathname into the read.table command above....
View
Full Document
 Spring '07
 DICKEY
 Statistics, Linear Regression, Regression Analysis, Prediction interval

Click to edit the document details