Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- test = matchit(treat ~ age + educ + married, method = "nearest",
- exact = c(married), data = lalonde)
- ## Now for exact matching within nearest neighbor
- ## exact should not equal T for this type of matching--that would get sent to matchit2exact
- if (!is.null(exact)){
- if(!sum(exact%in%names(data))==length(exact)) {
- warning("Exact variables not contained in data. Exact matching not done.",call.=FALSE)
- exact=NULL
- }
- else {
- ww <- exact%in%dimnames(X)[[2]]
- nw <- length(exact)
- exact <- data[,exact,drop=F]
- if(sum(ww)!=nw){
- X <- cbind(X,exact[!ww])
- }
- }
- }
- test = matchit(treat ~ age + educ + married, method = "nearest",
- exact = "married", data = lalonde)
Add Comment
Please, Sign In to add comment