The Procedure
The following are common start-up instructions. You will want to always follow them when starting analyses.
- Start
R
and open a new script. - Now, since we will be using some special
R
functions that do not exist in the baseR
package, we will need to import them. Making sure you have an Internet connection, run this line:source("http://rfs.kvasaheim.com/stat200.R")
When you run this line,R
goes to the URL you specified and runs that code. Here, the code only imports several helpful functions. From now forward, I will assume you run this line for every script in this course. - Load the “crime data set” using the following two lines.
dt = read.csv("http://rfs.kvasaheim.com/data/crime.csv") attach(dt)
The first line loads the data into the variabledt
. The second line “attaches the data,” which makes it easier for us to access the variables in the data file.
Questions and Answers
- Which region of the United States (as divided into nine regions) has the most state-level entities?
South Atlantic - What is the mean property crime rate in 1990?
4734.816 property crimes per 100,000 population - What is the median property crime rate in 1990?
4705.1 property crimes per 100,000 population
- What is the z-score for Illinois according to the enrollment rate in 2000?
-0.8270758 - What is the third quartile for Illinois according to the enrollment rate in 2000?
93.85 percent enrollment - What is the tenth percentile for Illinois according to the enrollment rate in 2000?
87.3 percent enrollment
- What is the Hildebrand ratio for the enrollment rate in 2000?
H = 0.1648958 - What is the appropriate measure of center for the enrollment rate in 2000?
μ = 91.74706 percent enrollment - Calculate the appropriate measure of spread for the enrollment rate in 2000.
σ = 4.53049 percent enrollment
While the answers are provided above, you need to be comfortable with your answers here. That is the final check. If you are unsure, you should return to the previous parts of this activity and redo them until you understand. Remember to experiment!