R: Propensity Score Matching. Does matchit function work with categorical matching variables? -
i working matchit packages , propensity score matching in r. saw examples. not find example working matching variables being factor ou character. examples, age groups.
head(mydata) people region sex age_group treatment 1 1 1 3 0 2 1 2 5 0 3 2 2 2 1 4 2 2 3 0 5 3 1 3 1 6 3 1 6 1 where first 4 variables factor or character types. also, levels sex men = 1 , famale = 2.
the following line works numeric matching variables( tot, mim , dis)- stw treatment variable-
m.out = matchit(stw ~ tot + min + dis, data = mydata, method = "nearest", ratio = 1) source: http://pareonline.net/getvn.asp?v=19&n=18
i know if matchit function works categorical matching variables. if not, there appropriate package?
yes, work nearest neighbor method works best continuous variables. sure have declared variables factors first (i.e., convert them dummy binary variables).
see stuart ea (2010). 2010. statistical science 25(1):1-25 https://projecteuclid.org/euclid.ss/1280841730
Comments
Post a Comment