Description Usage Arguments Details Value Author(s) References Examples

Uses matching methods to select cases for qualitative analysis

1 2 3 4 5 6 7 | ```
case.match(data, id.var, case.N = 2, distance = "mahalanobis",
design.type = "most similar", match.case = NULL,
greedy.match="pareto", number.of.matches.to.return = 1,
treatment.var = NULL, outcome.var= NULL, leaveout.vars = NULL,
max.variance = FALSE, max.variance.outcome=FALSE,
variance.tolerance = 0.1, max.spread = FALSE,
max.spread.outcome=FALSE, varweights = NULL)
``` |

`data` |
The original data. |

`id.var` |
A string variable that uniquely identifies cases within the data |

`case.N` |
The number of cases to choose. Must be 1 or more. |

`distance` |
The distance metric, specified as a string. Options are "mahalanobis", "euclidean", or "standardized", where "standardized" means that variables are standardized by their standard deviations. |

`design.type` |
Should the algorithm pick cases that are most similar or most different? Specify either "most similar" or "most different" as a string. |

`match.case` |
If specified, this is the value of |

`number.of.matches.to.return` |
How many matches to return. |

`greedy.match` |
Specifies which matches to return. Options are "pareto", "greedy", and "all". "all" keeps all matches. "pareto" matches eliminate 'redundant' matches where both units have better available matches. "greedy" matches keeps only the top matches in the data, but does eliminates best matches for some units since it uses a without replacement algorithm. |

`treatment.var` |
The name of the treatment variable, specified as a string. |

`outcome.var` |
The name of the outcome variable, specified as a string. |

`leaveout.vars` |
A vector of variables to not include in the matching. |

`max.variance` |
Should the cases be selected to maximize variance on |

`max.variance.outcome` |
Should the cases be selected to maximize variance on |

`variance.tolerance` |
The proportion of cases to consider if |

`max.spread` |
Should the cases be selected to maximize "spread" on the treatment variable, meaning that cases are selected to be have evenly values from the min of |

`max.spread.outcome` |
Should the cases be selected to maximize "spread" on the outcome variable, meaning that cases are selected to be have evenly values from the min of |

`varweights` |
An optional vector of variable weights. It must line up with the columns of the data after |

`case.match`

uses statistical matching to select cases in a quantitative data set for subsequent qualitative analysis in "most similar" and "most different" research designs.

`case.match`

returns a named list with the following elements:

`cases` |
A table of the matched cases. |

`case.distances` |
A list of the distances between matched cases. |

Rich Nielsen

Nielsen, Richard A. Forthcoming. "Case Selection Via Matching," Sociological Methods and Research. http://www.mit.edu/~rnielsen/Case

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ```
data(EU)
mvars <- c("socialist","rgdpc","FHc","FHp","trade")
dropvars <- c("countryname","population")
## In this example, I subset to the first 40 obs. to cut run-time
out <- case.match(data=EU[1:40,], id.var="countryname", leaveout.vars=dropvars,
distance="mahalanobis", case.N=2,
number.of.matches.to.return=10,
treatment.var="eu", max.variance=TRUE)
out$cases
## Not run:
## All cases:
## Find the best matches of EU to non-EU countries
out <- case.match(data=EU, id.var="countryname", leaveout.vars=dropvars,
distance="mahalanobis", case.N=2,
number.of.matches.to.return=10,
treatment.var="eu", max.variance=TRUE)
out$cases
## Find the best matches while downweighting political variables
myvarweights <- c(1,1,.1,.1,.1)
names(myvarweights) <- c("rgdpc","trade","FHp","FHc","socialist")
myvarweights
(case.match(data=EU, id.var="countryname", leaveout.vars=dropvars,
distance="mahalanobis", case.N=2,
number.of.matches.to.return=10, treatment.var="eu",
max.variance=TRUE,varweights=myvarweights))$cases
## Find the best non-EU matches for Germany
tabGer <- case.match(data=EU, match.case="German Federal Republic",
id.var="countryname",leaveout.vars=dropvars,
distance="mahalanobis", case.N=2,
number.of.matches.to.return=10,max.variance=TRUE,
treatment.var="eu")
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.