- Laura Whiting

# Create a Link Plot in Stata

A link plot is used when you have a binary variable that identifies two groups, and you want to compare a set of values in group 1 to a set of values in group 2. To do this you need paired data, where each observation value in group 1 is linked to an observation value in group 2. For this example we have two types of materials, A and B, and we have a set of samples of these materials that have been tested and given a wear rating. Each sample of A is matched to a similar sample of B using an ID variable. For example,there will be two observations under ID 1, one that is material A and one that is material B. We then use a **linkplot** graph to compare the wear ratings of the two materials.

To create a link plot in Stata you will first need to download the command **linkplot** from the SSC, which you do in Stata using the following command:

To generate this graph in Stata, you will first need to download and import the following dataset:

Place the dataset above in your current working directory, and then run the following commands to generate the graph above: