When you match item-wise, you’re finding items in each condition which are directly comparable across control variables. I mostly use the R package LexOPS to do this because it makes the code more readable, but code could be written to do the same thing in any other language. You could also get similar results using a different algorithm.



Here you can find some example code for matching item-wise. All the code here uses the same dataset: stim_pool.csv. Most of the examples use the package LexOPS for simplicity, but the last example shows example code without any packages to better explain what’s going on.

To use LexOPS in R, you will need to install it. You can do this with:

devtools::install_github("jackedtaylor/lexops@*release")


Title/Link No. Conditions No. Control Variables Numeric Controls Categorical Controls Inclusive Matching Euclidean Distance
01 - Item-Wise Matching 2 1 \(\checkmark\) \(\mathbf{\times}\) \(\mathbf{\times}\) \(\mathbf{\times}\)
02 - Multiple Control Variables 2 4 \(\checkmark\) \(\checkmark\) \(\mathbf{\times}\) \(\mathbf{\times}\)
03 - Matching >2 Conditions 3 4 \(\checkmark\) \(\checkmark\) \(\mathbf{\times}\) \(\mathbf{\times}\)
04 - Setting the Match Null 3 4 \(\checkmark\) \(\checkmark\) \(\checkmark\) \(\mathbf{\times}\)
05 - Matching Factorial Designs 6 3 \(\checkmark\) \(\mathbf{\times}\) \(\checkmark\) \(\mathbf{\times}\)
06 - Matching in Euclidean Distance 3 4 \(\checkmark\) \(\checkmark\) \(\checkmark\) \(\checkmark\)
07 - Weighting Euclidean Distance 3 4 \(\checkmark\) \(\checkmark\) \(\checkmark\) \(\checkmark\)
08 - Item-Wise Matching from Scratch 2 1 \(\checkmark\) \(\mathbf{\times}\) \(\mathbf{\times}\) \(\mathbf{\times}\)

Download code for all examples

These examples show how you can use LexOPS to apply the methods covered in the workshop. To find out more about the things you can do with LexOPS, you might also be interested in the LexOPS Walkthrough.