NCVS Learning Guide: Calculating the Rates

This part provides step-by-step instructions on how to replicate the victimization rates using SPSS, Stata, or R software packages.*

SPSS users have two options to complete exercise:

  1. The SPSS Drop-Down Menus option allows you to navigate the point-and-click interface.**
  2. The SPSS Syntax option involves writing and executing commands.

Stata users have access to Stata Syntax documenting each analytic step.
Make sure you have downloaded and saved the Stata .dta data files from the NACJD (ICPSR) website.

R users have access to R Syntax documenting each analytic step.
Make sure you have downloaded and saved the R .rda data files from the NACJD (ICPSR) website.

*Note that the NCVS data are also available for download in SAS format, which this user guide does not cover.

**Note that the SPSS drop-down menu option covers only the calculation of the violent crime rate, whereas the syntax options cover the calculation of both violent crime and property crime.

Overview

This example will show how to calculate victimization rates for violent crime. You can follow similar steps to find the rate of property crime.

The difficulties in calculating rates are knowing which numbers to use, which files to take them from, and what adjustments need to be made. The basic tasks are:

  1. Use the incidents data to find the number of violent victimizations, which will be the numerator.
  2. Use the persons data to find the number of persons age 12 and older at risk, which will be the denominator.
  3. Calculate the rate of violent crime, dividing the count of violent victimizations by the number of persons at risk and multiplying by 1,000.

Optional: Creating Syntax While Using Menus

The drop-down menus in SPSS offer convenient data-analytic options. Menus are useful for learning about unfamiliar commands. While this section does not require typed syntax, it is helpful to know you can create and save syntax while using the menu option. Once you have finalized the details of commands, you will see a Paste button next to the OK button. If you click Paste instead of OK, SPSS will open up a syntax window containing the relevant command in a syntax format. You may execute this command from the window, and you may save the contents as a syntax file for future analysis. If you highlight the created syntax statement, and then pull down the Run menu, selecting the Selection option will execute the commands. The result is the same as if you had clicked the OK button before. Note: you do not need to learn how to create syntax files to complete the exercise below.

Steps

Step 1: Access the incident-level data file.

You will first use incidents2015.sav to calculate the number of violent victimizations.

Pull down the File menu and select the Open option, then the Data option. Navigate to the folder ICPSR_36448\DS0004, select incidents2015.sav, and click the Open button.

opens in a new window

(Click to enlarge – opens in a new window)

Step 2: Exclude crimes occurring outside the United States.

The victimization rates published by the Bureau of Justice Statistics only include incidents taking place inside the United States. Because some respondents report incidents that occurred in other countries, you will need to take this into account.

You will use V4022 (“IN WHAT CITY, TOWN, VILLAGE”) to restrict the data to crimes that did not occur outside the U.S.

Pull down the Data menu and select the Select Cases… option. Under the Select section, select the If condition is satisfied option and click the If… button that becomes available.

In the argument box that becomes available, type “V4022 ~= 1“.

opens in a new window

(Click to enlarge – opens in a new window)

Click the Continue button, and back at the Select Cases window click the OK button to execute the select command.

opens in new window

(Click to enlarge – opens in a new window)

Step 3: Create a variable that captures the total number of violent victimizations.

C
odes to identify the specific types of crime are contained in V4529: “TOC CODE (NEW, NCVS).” NCVS codes for violent crimes range from 1 to 20.

Using value ranges of V4529, you will create a new variable VIOLENT: “Violent crime (created in this exercise)” indicating violent crimes.

Pull down the Transform menu and select Recode into Different Variables…

To view variable lists using names rather than descriptives labels, right-click anywhere on the variable list and select Display Variable NamesYou will need to do this every time you choose a variable by name from a variable list.

opens in a new window

(Click to enlarge – opens in a new window)

Locate V4529 “TOC CODE (NEW, NCVS)” in the variable list and click the arrow to move it into the Input Variable -> Output Variable box on the right.

Under the Output Variable section Type “VIOLENT” “Violent crime (created in this exercise)” in the first box. Click the Change button to add “VIOLENT” to the Input Variable -> Output Variable box.

opens in a new window

(Click to enlarge – opens in a new window)

Click the Old and New Values… button.

First, under the Old Value section, select Range. Type “1” in the first box that becomes available and “20” in the second. In the New Value section type “1.” Then click the Add button to create this rule in the Old –> New section.

Second, under the Old Value section, select All other values. In the New Value section type “0.” Click the Add button to create this rule in the Old –> New section.

Finally, click the Continue button, and back at the Recode into Different Variables window click the OK button to execute the recode command.

In this step, you have created a variable named VIOLENT with all violent crimes coded as 1 and all other crimes coded as 0.

opens in a new window

(Click to enlarge – opens in a new window)

Step 4: Find the weighted number of victimizations.

You will apply the victimization weight SERIES_WEIGHT to the data. Then you will run a frequency report on your violent crime variable VIOLENT “Violent crime (created in this exercise)” to receive estimates for the U.S. population.

Pull down the Data menu and select the Weight Cases… option.

Select the Weight cases by option. Locate SERIES_WEIGHT at the bottom of the variable list and click the arrow to move it into the Frequency Variable: box on the right.

Click the OK button to execute the weight command.

opens in new window

(Click to enlarge – opens in a new window)

Pull down the Analyze menu and select the Descriptive Statistics option, then the Frequencies… option.

Locate VIOLENT near the bottom of the variable list and click the arrow to move it into the Variable(s): box on the right.

Click the OK button to execute the frequencies command.

opens in new window

(Click to enlarge – opens in a new window)

In the Output window, you should see in the result of the frequencies command that 5,006,615 cases in the weighted data have VIOLENT = 1.00. Record this number outside SPSS, as it will be your numerator for the final rate calculation.*

opens in new window

(Click to enlarge – opens in a new window)

Step 5: Access the person-level data file.

Finding the denominator for the rate of violent victimization will be easier. You will use use persons2015.sav to calculate the number of persons aged 12 and older.

Pull down the File menu and select the Open option, then the Data option. Navigate to the folder ICPSR_36448\DS0003, select persons2015.sav, and click the Open button.

Whenever you open new data file with a modified data file open, SPSS will pop up a window asking “Save changes to the following dataset?” If you have followed these instructions and wish to save the variables you have created, you can safely click the Yes button because you did not overwrite or delete any existing variables or cases.

opens in new window

(Click to enlarge – opens in a new window)

Step 6: Find the weighted number of persons.

Unlike the incidents data, the persons data require no additional corrections from you. You will simply weight the data using the included variable WGTPERCY, “ADJUSTED PERSON WEIGHT – COLLECTION YEAR”, then run a frequency report to find the total number of persons age 12 or older at risk of violent victimization in the population.

Pull down the Data menu and select the Weight Cases… option.

Select the Weight cases by option. Locate WGTPERCY in the variable list and click the arrow to move it into the Frequency Variable: box on the right. Remember that you will need to right-click on the variable list and select Display Variable Names every time you choose a variable by name from a variable list.

Click the OK button to execute the weight command.

opens in new window

(Click to enlarge – opens in a new window)

Pull down the Analyze menu and select the Descriptive Statistics option, then the Frequencies… option.

Locate V3001 “PERSON RECORD TYPE” at the top of the variable list and click the arrow to move it into the Variable(s): box on the right.

Click the OK button to execute the frequencies command.

opens in new window

(Click to enlarge – opens in a new window)

In the Output window, you should see in the result of the frequencies command that the weighted persons data produces a total of 269,526,471 cases. Record this number outside SPSS, as it will be your denominator for the final rate calculation.*

You will see SPSS add a message about Warning #3211 after the output from the frequencies command. This is expected, due to the weight calculations used in this particular data, and it does not affect your results.

Step 7: Calculate the violent and property victimization rates.

You’ll have to do this part by hand. Use a calculator to compute the rates. The rate of violent victimization per 1,000 persons is:

5,359,570 over 266,665,162 times 1,000 = 20.1 violent victimizations per 1,000

Congratulations! You have replicated the official statistics published in Criminal Victimization, 2015 (pdf).

*Note: Because BJS rounds to the nearest 10, the numbers you will find in this exercise are slightly different from the numbers in the Criminal Victimization, 2015 report.

Overview

This example will show how to calculate victimization rates for property and violent crime. SPSS syntax statements are presented in the shaded text boxes. Complete, uninterrupted syntax is provided following the step-by-step instructions.

The difficulties in calculating rates are knowing which numbers to use, which files to take them from, and what adjustments need to be made. The four overall steps are:

  1. Use the incidents data to find both the number of property and the number of violent victimizations, the numerators.
  2. Use the households data to find the number of households at risk, which will be the denominator for property crimes.
  3. Use the persons data to find the number of persons age 12 and older at risk, which will be the denominator for violent crimes.
  4. Calculate each rate, dividing the numerators by the denominators and multiplying by 1,000.

Before beginning the exercise below, see Data Files and Variables for instructions on downloading and renaming the data files. This exercise is written using the following folder and filenames:
ICPSR_36448\DS0002\households2015.sav
ICPSR_36448\DS0003\persons2015.sav
ICPSR_36448\DS0004\incidents2015.sav

If you use different filenames or a different folder structure, you will need to modify the get file commands accordingly.

Steps

Step 1: Find the number of property victimizations and violent victimizations, the numerators.

1a: Access the incident-level data file.

First, change the working directory in SPSS, to avoid having to specify the base directory name in every new get file command. Edit this command to point to the folder where your files are located. (SPSS will remember the folder specified by cd until you exit the program).

Then load the incidents data file. You will use this to calculate the number of violent and property victimizations.

Note: For help finding the path of your data file, right click on the file, select Properties, and see Location.
cd "C:\Path\To\Downloads\ICPSR_36448".
get file = "DS0004\incidents2015.sav".

1b: Exclude crimes occurring outside the United States.

The victimization rates published by the Bureau of Justice Statistics only include incidents taking place inside the United States. Because some respondents report incidents that occurred in other countries, you will need to take this into account.

Use V4022 (“IN WHAT CITY, TOWN, VILLAGE”) to restrict the data to crimes that did not occur outside the U.S.
select if (V4022 ne 1).

1c: Create variables that capture the total number of property and violent victimizations.

Codes to identify the specific types of crime are contained in V4529 (“TOC CODE (NEW, NCVS)”). NCVS codes for violent crimes range from 1 to 20, and codes for property crimes range from 31 to 59.

Use value ranges of V4529 (“TOC CODE (NEW, NCVS)”) to create new variables indicating violent and property crimes.

recode V4529 (1 thru 20 = 1)(else = 0) into VIOLENT.
recode V4529 (31 thru 59 = 1)(else = 0) into PROPERTY.

1d: Find the weighted numbers of victimizations.

Apply the victimization weight to the data, then run a frequency report on your violent crime and property crime variables to receive estimates for the U.S. population.

Make a note of these numbers, as they will be your numerators for the final rate calculations. You should find 5,006,615 violent victimizations and 14,611,043 property victimizations.*

weight by SERIES_WEIGHT.
freq VIOLENT PROPERTY
(“Property crime (created in this exercise)”).

Step 2: Find the number of persons at risk.

You now have the numerators for calculating the rates, and the denominators will be easier. You will find the correct number of persons aged 12 and older (for violent victimizations) and households (for property victimizations), starting with persons.

2a: Access the person-level data file.

Load the persons data file. (Remember to edit this command if you are using a different folder or file name.)
get file = "DS0003\persons2015.sav".

2b: Find the weighted number of persons.

Weight the data using the included variable WGTPERCY, “ADJUSTED PERSON WEIGHT – COLLECTION YEAR”, then run a frequency report to find the total number of persons in the population: 269,526,471.

weight by WGTPERCY.
freq V3001.

Step 3: Find the number of households at risk.

Finding the denominator for households is the same straightforward process as Step 2 for persons.

3a: Access the household-level data file.

Load the households data file. (Remember to edit this command if you are using a different folder or file name.)
get file = "DS0002\households2015.sav".

3b: Find the weighted number of households.

Weight the data using the included variable WGTHHCY, “ADJUSTED HOUSEHOLD WEIGHT – COLLECTION YEAR”, then run a frequency report to find the total number of households in the population: 131,962,257.

weight by WGTHHCY.
freq V2001.

Step 4: Calculate the violent and property victimization rates.

You’ll have to do this part by hand. Use a calculator to compute the rates. The rate of violent victimization per 1,000 persons is:

5,006,615 � 269,526,471 � 1,000 = 18.6 violent victimizations per 1,000

The rate of property victimization per 1,000 households is:

14,611,043 � 131,962,257 � 1,000 = 110.7 property victimizations per 1,000

Congratulations! You have replicated the official statistics published in Criminal Victimization, 2015 (pdf).

Complete Syntax

Here is the SPSS syntax without all the detailed comments. You can copy, paste, and run these commands. You will need to edit the “cd” or the “get file” commands to specify the exact location of your data files.
* !! Edit this change directory command to include the path to your saved data.
setwd("C:/Path/To/Downloads/ICPSR_36142".)

* Step 1a: Access the incident-level data file.
get file = “DS0004\incidents2014.sav”.

* Step 1b: Exclude crimes occurring outside the United States.
select if (V4022 ne 1).

* Step 1c: Create variables that capture the total number of property and violent victimizations.
recode V4529 (1 thru 20 = 1)(else = 0) into VIOLENT.
recode V4529 (31 thru 59 = 1)(else = 0) into PROPERTY.

* Step 1d: Find the weighted numbers of victimizations.
weight by WGTVICCY_REC.
freq VIOLENT PROPERTY.

* Step 2a: Access the person-level data file.
get file = “DS0003\persons2014.sav”.

* Step 2b: Find the weighted number of persons.
weight by WGTPERCY.
freq V3001.

* Step 3a: Access the household-level data file.
get file = “DS0002\households2014.sav”.

* Step 3b: Find the weighted number of households.
weight by WGTHHCY.
freq V2001.

*Note: Because BJS rounds to the nearest 10, the numbers you will find in this exercise are slightly different from the numbers in the Criminal Victimization, 2015 report.

Overview

This example will show how to calculate victimization rates for property and violent crime. Stata syntax statements are presented in code font. Complete, uninterrupted syntax is provided following the step-by-step instructions.

The difficulties in calculating rates are knowing which numbers to use, which files to take them from, and what adjustments need to be made. The four overall steps are:

  1. Use the incidents data to find both the number of property and the number of violent victimizations, the numerators.
  2. Use the households data to find the number of households at risk, which will be the denominator for property crimes.
  3. Use the persons data to find the number of persons age 12 and older at risk, which will be the denominator for violent crimes.
  4. Calculate each rate, dividing the numerators by the denominators and multiplying by 1,000.

Before beginning the exercise below, see Data Files and Variables for instructions on downloading the data files. This exercise is written using the following folder and filenames, without renaming the files:
ICPSR_36448\DS0002\households2015.sav
ICPSR_36448\DS0003\persons2015.sav
ICPSR_36448\DS0004\incidents2015.sav

If you use different filenames or a different folder structure, you will need to modify the use commands accordingly.

Steps

Step 1: Find the number of property victimizations and violent victimizations, the numerators.

1a: Access the incident-level data file.

First, change the directory in Stata, to avoid having to specify the base directory name in every new use command. Edit this command to point to the folder where your files are located. (Stata will remember the folder specified by cd until you exit the program.)

Then load the incidents data file. You will use this to calculate the number of violent and property victimizations.
cd "C:\Path\To\Downloads\ICPSR_36448"
use "DS0004\36448-0004-Data.dta", clear

1b: Exclude crimes occurring outside the United States.

The victimization rates published by the Bureau of Justice Statistics only include incidents taking place inside the United States. Because some respondents report incidents that occurred in other countries, you will need to take this into account.

Use V4022 “IN WHAT CITY, TOWN, VILLAGE” to restrict the data to crimes that did not occur outside the U.S.

drop if (V4022 == 1)

1c: Create variables that capture the total number of property and violent victimizations.

Codes to identify the specific types of crime are contained in V4529 “TOC CODE (NEW, NCVS)”. NCVS codes for violent crimes range from 1 to 20, and codes for property crimes range from 31 to 59.

Use value ranges of V4529 to create new variables indicating violent and property crimes.

recode V4529 (1/20 = 1)(else = 0), gen(VIOLENT)
recode V4529 (31/59 = 1)(else = 0), gen(PROPERTY)

1d: Find the weighted numbers of victimizations.

Applying the victimization weight to the data, run a tabulation on your violent crime and property crime variables to receive estimates for the U.S. population.

Make a note of these numbers, as they will be your numerators for the final rate calculations. You should find 5,006,615 violent victimizations and 14,611,043 property victimizations.*
tab VIOLENT [iweight= SERIES_WEIGHT]
tab PROPERTY [iweight= SERIES_WEIGHT]

Step 2: Find the number of persons at risk.

You now have the numerators for calculating the rates, and the denominators will be easier. You will find the correct number of persons aged 12 and older (for violent victimizations) and households (for property victimizations), starting with persons.

2a: Access the person-level data file.

Load the persons data file. (Remember to edit this command if you are using a different folder or file name.)
use "DS0003\36448-0003-Data.dta", clear

2b: Find the weighted number of persons.

There are no special corrections required for the persons weight. Simply tabulate the data, weighted using the included variable WGTPERCY,”ADJUSTED PERSON WEIGHT – COLLECTION YEAR”, to find the total number of persons in the population: 269,526,471.

tab V3001 [iweight=WGTPERCY]

Step 3: Find the number of households at risk.

Finding the denominator for households is the same straightforward process as Step 2 for persons.

3a: Access the household-level data file.

Load the households data file. (Remember to edit this command if you are using a different folder or file name.)
use "DS0002\36448-0002-Data.dta", clear

3b: Find the weighted number of households.

Tabulate the data, weighted using the included variable WGTHHCY, “ADJUSTED HOUSEHOLD WEIGHT – COLLECTION YEAR”, to find the total number of households in the population: 131,962,257.

tab V2001 [iweight= WGTHHCY]

Step 4: Calculate the violent and property victimization rates.

Use Stata’s built-in calculator to compute the rates.
display (5006615 / 269526471) * 1000
display (14611043 / 131962257) * 1000

You should find that the rate of violent victimization per 1,000 persons is:

5,359,570 over 266,665,162 times 1,000 = 20.1 violent victimizations per 1,000

The rate of property victimization per 1,000 households is:

15,288,467 over 129,492,744 times 1,000 = 118.1 property victimizations per 1,000

Congratulations! You have replicated the official statistics published in Criminal Victimization, 2015 (pdf).

Complete Syntax

Here is the Stata syntax without all the detailed comments. You can copy, paste, and run these commands. You will need to edit the cd or the use commands to specify the exact location of your data files.
* !! Edit this change directory command to include the path to your saved data.
cd "C:\Path\To\Downloads\ICPSR_36448"

* Access the incident-level data file.
use "DS0004\36448-0004-Data.dta", clear

* Exclude crimes occurring outside the United States.
drop if (V4022 == 1)

* Create variables that capture the total number of property and violent victimizations.
recode V4529 (1/20 = 1)(else = 0), gen(VIOLENT)
recode V4529 (31/59 = 1)(else = 0), gen(PROPERTY)

* Find the weighted numbers of victimizations.
tab VIOLENT [iweight= SERIES_WEIGHT]
tab PROPERTY [iweight= SERIES_WEIGHT]

* Access the person-level data file.
use "DS0003\36448-0003-Data.dta", clear

* Find the weighted number of persons.
tab V3001 [iweight=WGTPERCY]

* Access the household-level data file.
use "DS0002\36448-0002-Data.dta", clear

* Find the weighted number of households.
tab V2001 [iweight= WGTHHCY]

* Calculate the rates.
display (5006615 / 269526471) * 1000
display (14611043 / 131962257) * 1000

*Note: Because BJS rounds to the nearest 10, the numbers you will find in this exercise are slightly different from the numbers in the Criminal Victimization, 2015 report.

Overview

This example will show how to calculate victimization rates for property and violent crime. R syntax statements are presented in code font. Complete, uninterrupted syntax is provided following the step-by-step instructions.

The difficulties in calculating rates are knowing which numbers to use, which files to take them from, and what adjustments need to be made. The four overall steps are:

  1. Use the incidents data to find both the number of property and the number of violent victimizations, the numerators.
  2. Use the households data to find the number of households at risk, which will be the denominator for property crimes.
  3. Use the persons data to find the number of persons age 12 and older at risk, which will be the denominator for violent crimes.
  4. Calculate each rate, dividing the numerators by the denominators and multiplying by 1,000.

Before beginning the exercise below, see Data Files and Variables for instructions on downloading the data files. This exercise is written using the following folder and filenames, without renaming the files:

ICPSR_36448\DS0002\36448-0002-Data.rda
ICPSR_36448\DS0003\36448-0003-Data.rda
ICPSR_36448\DS0004\36448-0004-Data.rda

If you use different filenames or a different folder structure, you will need to modify the use commands accordingly.

Steps

Step 1: Find the number of property victimizations and violent victimizations, the numerators.

1a. Access the incident-level data file.

First, set the working directory in R, to avoid having to specify the base directory name in every new load command. Edit this command to point to the folder where your files are located. (R will remember the folder specified by load until you exit the program.)

Then load the incidents data file. You will use this to calculate the number of violent and property victimizations.

setwd("C:/Path/To/Downloads/ICPSR_36448")
load("DS0004/36448-0004-Data.rda")

1b: Exclude crimes occurring outside the United States.

The victimization rates published by the Bureau of Justice Statistics only include incidents taking place inside the United States. Because some respondents report incidents that occurred in other countries, you will need to take this into account.

Create a subset of these data called incidents, using V4022, “IN WHAT CITY, TOWN, VILLAGE”, to restrict the data to crimes that did not occur outside the U.S.

incidents <- subset(da36448.0004, da36448.0004$V4022 != "(1) Outside U.S.")

1c: Create variables that capture the total number of property and violent victimizations.

Codes to identify the specific types of crime are contained in V4529, “TOC CODE (NEW, NCVS)”. NCVS codes for violent crimes range from 1 to 20, and codes for property crimes range from 31 to 59. The way that this R dataset has been built, these codes are collapsed, so the actual value ranges are 1 to 20 and 24 on up.

Use value ranges of V4529 to create new variables violent and property within incidents, indicating violent and property crimes.

incidents$violent <- ifelse(as.numeric(incidents$V4529) <= 20, 1, 0)
incidents$property <- ifelse(as.numeric(incidents$V4529) >= 24, 1, 0)

1d: Find the weighted numbers of victimizations.

Applying the victimization weight to the data, run crosstabulations on your violent crime and property crime variables to receive estimates for the U.S. population and save the results in vict_viol and vict_prop.

These numbers will be your numerators for the final rate calculations. You should find 5,006,615 violent victimizations and 14,611,043 property victimizations.*

xtabs(SERIES_WEIGHT~violent+property, data=incidents)
vict_viol <- xtabs(SERIES_WEIGHT~violent+property, data=incidents)[2,1]
vict_prop <- xtabs(SERIES_WEIGHT~violent+property, data=incidents)[1,2]
cat("Violent victimizations: ", format(vict_viol, nsmall=1), "\n")
cat("Property victimizations:", format(vict_prop, nsmall=1), "\n")

Step 2: Find the number of persons at risk.

You now have the numerators for calculating the rates, and the denominators will be easier. You will find the correct number of persons aged 12 and older (for violent victimizations) and households (for property victimizations), starting with persons.

2a: Access the person-level data file.

Load the persons data file. (Remember to edit this command if you are using a different folder or file name.)

load("DS0003/36448-0003-Data.rda")

2b: Find the weighted number of persons.

Tabulate the data, weighted using the included variable WGTPERCY, “ADJUSTED PERSON WEIGHT – COLLECTION YEAR”, to find the total number of persons in the population: 269,526,471. This command saves the result in persons.

persons <- as.numeric(xtabs(WGTPERCY~V3001, data=da36448.0003)[1])
cat("Persons: ", format(persons, nsmall=1), "\n")

Step 3: Find the number of households at risk.

Finding the denominator for households is the same straightforward process as Step 2 for persons.

3a: Access the household-level data file.

Load the households data file. (Remember to edit this command if you are using a different folder or file name.)
load("DS0002/36448-0002-Data.rda")

3b: Find the weighted number of households.

There are no special corrections required for the households weight. Simply tabulate the data, weighted using the included variable WGTHHCY, “ADJUSTED HOUSEHOLD WEIGHT – COLLECTION YEAR”, to find the total number of households in the population: 131,962,257. This command saves the result in households.

households <- as.numeric(xtabs(WGTHHCY~V2001, data=da36448.0002)[1])
cat("Households: ", format(households, nsmall=1), "\n")

Step 4: Calculate the violent and property victimization rates.

Using the new variables vict_viol, persons, vict_prop, and households, use R to calculate and format your rates:

cat("The rate of violent victimization per 1,000 persons is:", format(((vict_viol / persons) * 1000), digits=4), "\n")
cat("The rate of property victimization per 1,000 households is:", format(((vict_prop / households) * 1000), digits=4), "\n")

You should find that the rate of violent victimization per 1,000 persons is:

5,359,570 � 266,665,162 � 1,000 = 20.1 violent victimizations per 1,000

The rate of property victimization per 1,000 households is:

15,288,467 over 129,492,744 times 1,000 = 118.1 property victimizations per 1,000

Congratulations! You have replicated the official statistics published in Criminal Victimization, 2015 (pdf).

Complete Syntax

Here is the R syntax without all the detailed comments. You can copy, paste, and run these commands. You will need to edit the setwd or the use commands to specify the exact location of your data files.

* !! Edit this change directory command to include the path to your saved data.
setwd("C:/Path/To/Downloads/ICPSR_36448")

# Access the incident-level data file.
load("DS0004/36448-0004-Data.rda")

# Exclude crimes occurring outside the United States.
incidents <- subset(da36448.0004, da36448.0004$V4022 != "(1) Outside U.S.")

# Create variables that capture the total number of property and violent victimizations.
incidents$violent <- ifelse(as.numeric(incidents$V4529) <= 20, 1, 0)
incidents$property <- ifelse(as.numeric(incidents$V4529) >= 24, 1, 0)

# Find the weighted numbers of victimizations.
xtabs(SERIES_WEIGHT~violent+property, data=incidents)
vict_viol <- xtabs(SERIES_WEIGHT~violent+property, data=incidents)[2,1]
vict_prop <- xtabs(SERIES_WEIGHT~violent+property, data=incidents)[1,2]
cat("Violent victimizations: ", format(vict_viol, nsmall=1), "\n")
cat("Property victimizations:", format(vict_prop, nsmall=1), "\n")

# Access the person-level data file.
load("DS0003/36448-0003-Data.rda")

# Find the weighted number of persons.
persons <- as.numeric(xtabs(WGTPERCY~V3001, data=da36448.0003)[1])
cat("Persons: ", format(persons, nsmall=1), "\n")

# Access the household-level data file.
load("DS0002/36448-0002-Data.rda")

# Find the weighted number of households.
households <- as.numeric(xtabs(WGTHHCY~V2001, data=da36448.0002)[1])
cat("Households: ", format(households, nsmall=1), "\n")

# Calculate the rates.
cat("The rate of violent victimization per 1,000 persons is:", format(((vict_viol / persons) * 1000), digits=4), "\n")
cat("The rate of property victimization per 1,000 households is:", format(((vict_prop / households) * 1000), digits=4), "\n")

*Note: Because BJS rounds to the nearest 10, the numbers you will find in this exercise are slightly different from the numbers in the Criminal Victimization, 2015 report.