Hello all,
Apologies for any redundancy, but I am little lost as to which is the list I
should post my question.... I am using subclassification in Matchit, and
combining it with nearest neighbor with exact matching on two covariates. So
I run something like
msubclass1.out <- matchit(treat ~ x1 + x2, data = data1, method = "nearest",
subclass=8, exact = c("firm_id","financial_year"))
Question 1:
Then I calculate the ATE for this matched sample, but unfortunately when I
get try finding the ATE I get the following error. I run the same
counterfactual analysis as specified in matchit document and the code I run
is below. I was wondering if I am using the post matching outcome analysis
correctly? Any advice would be deeply appreciated.
Error in -s.out2$qi$att.ev : invalid argument to unary operator
Code:
z.out1 <- zelig(y ~ x1 + x2, data = match.data(msubclass1.out, "control"),
model = "ls", by = "subclass")
x.out1 <- setx(z.out1, data = match.data(msubclass1.out, "treat"), fn=NULL,
cond = TRUE)
s.out1 <- sim(z.out1, x = x.out1)
z.out2 <- zelig(y ~ x1 + x2, data = match.data(msubclass1.out, "treat"),
model = "ls", by = "subclass")
x.out2 <- setx(z.out2, data = match.data(msubclass1.out, "control"),
fn=NULL, cond = TRUE)
s.out2 <- sim(z.out2, x = x.out2)
ate.all <- c(s.out1$qi$att.ev, -s.out2$qi$att.ev)
Error in -s.out2$qi$att.ev : invalid argument to unary operator
Question 2:
When running the matching step msubclass1.out <- matchit(treat ~ x1 + x2,
data = data1, method = "nearest", subclass=8, exact =
c("firm_id","financial_year")), I was wondering if the subclassfication is
causing the error above. So would it be the same if I just ran..
msubclass1.out <- matchit(treat ~ x1 + x2 + factor(firm_id) +
firm(financial_year), data = data1, method = "nearest", subclass=8)
Eventhough I need to match exactly by the two covariates as above.
Thanks a lot and deeply appreciate your time.
Rajesh Vijayaraghavan
Doctoral student,
Harvard Business School
Hello all,
I am using subclassification in Matchit, and combining it with nearest
neighbor with exact matching on two covariates. So I run something like
msubclass1.out <- matchit(treat ~ x1 + x2, data = data1, method =
"nearest", subclass=8, exact = c("firm_id","financial_year"))
*Question 1:*
Then I calculate the ATE for this matched sample, but unfortunately when I
get try finding the ATE I get the following error. I run the same
counterfactual analysis as specified in matchit document and the code I run
is below. I was wondering if I am using the post matching outcome analysis
correctly? Any advice would be deeply appreciated.
Error in -s.out2$qi$att.ev : invalid argument to unary operator
Code:
z.out1 <- zelig(y ~ x1 + x2, data = match.data(msubclass1.out, "control"),
model = "ls", by = "subclass")
x.out1 <- setx(z.out1, data = match.data(msubclass1.out, "treat"), fn=NULL,
cond = TRUE)
s.out1 <- sim(z.out1, x = x.out1)
z.out2 <- zelig(y ~ x1 + x2, data = match.data(msubclass1.out, "treat"),
model = "ls", by = "subclass")
x.out2 <- setx(z.out2, data = match.data(msubclass1.out, "control"),
fn=NULL, cond = TRUE)
s.out2 <- sim(z.out2, x = x.out2)
ate.all <- c(s.out1$qi$att.ev, -s.out2$qi$att.ev)
Error in -s.out2$qi$att.ev : invalid argument to unary operator
*Question 2:*
When running the matching step msubclass1.out <- matchit(treat ~ x1 + x2,
data = data1, method = "nearest", subclass=8, exact =
c("firm_id","financial_year")), I was wondering if the subclassfication is
causing the error above. So would it be the same if I just ran..
msubclass1.out <- matchit(treat ~ x1 + x2 + factor(firm_id) +
firm(financial_year), data = data1, method = "nearest", subclass=8)
Eventhough I need to match exactly by the two covariates as above.
Thanks a lot and deeply appreciate your time.
Rajesh Vijayaraghavan
Doctoral student,
Harvard Business School