If someone could please help me, I am trying my hand at propensity score matching and cannot figure out why I keep getting this error:
Error in Match(Y = Y, Tr = Tr, X = X, M = 1) : length(Tr) != nrow(X)
This is panel data looking at how the effects of a law going away effected Y.
##Propensity Score
Tr <- cbind(MasterSheet$repeals_after_2001)
Y <- cbind(MasterSheet$Days_perweek)
X <- cbind(MasterSheet$OFFP_Hours_Sunday, MasterSheet$OFFP_Hours_weekdays, MasterSheet$State_control_liquor,
MasterSheet$Age_group, MasterSheet$Education, MasterSheet$Income,
MasterSheet$Race, MasterSheet$Gender)
##Descriptive Statistics for Treated, Outcome and Matching Variables
summary(Tr)
summary(Y)
summary(X)
##Propensity Score Model
##Binge Drinking
glm1 <- glm(Tr ~ X, data = MasterSheet)
summary(glm1)
X <- glm1$fitted
Y <- MasterSheet$Binge_drinkers
Tr <- MasterSheet$repeals_after_2001
matched1 <- Match(Y=Y, Tr=Tr, X=X, M=1)
Hi, can you provide a reproducible example of your dataset? We have no idea what your dataset looks like and can't really help with your question.
system
Closed
3
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.