R を使用して、以下のコードを実行すると、エラー メッセージが表示されます。
コード:
library(MatchIt)
library(Zelig)
lw.y2loswt<-newcombined
matchIt.y2loswt <- matchit(y2_LOSWT ~ y0_HLTHTH + y0_THINIMP + y0_DRELAT
+ y0_DPARENT + y0_DFRIEND + y0_AGE910 + y0_RACE + y0_CATINC + y0_CATEDUC
+ y0_SOCCP + y0_PARENTS + y0_SELWT + y0_ATHCP, data = lw.y2loswt, method="full")
matchIt.y2loswt
summary(matchIt.y2loswt)
data.y2loswt.matchIt<-match.data(matchIt.y2loswt)
z.out0 <- zelig(y10_SUMSKIN ~ y2_LOSWT +y0_HLTHTH + y0_THINIMP +
y0_DRELAT + y0_DPARENT + y0_DFRIEND + y0_AGE910 + y0_RACE + y0_CATINC +
y0_CATEDUC + y0_SOCCP + y0_PARENTS + y0_SELWT + y0_ATHCP, data =
data.y2loswt.matchIt, model = "ls")
x.out0 <- setx(z.out0, y2_LOSWT = 0)
x1.out0 <- setx(z.out0, y2_LOSWT = 1)
s.out0 <- sim(z.out0, x = x.out0, x1= x1.out0)
#Error message:
#s.out0 <- sim(z.out0, x = x.out0, x1= x1.out0)
#Error in (function (classes, fdef, mtable) :
# unable to find an inherited method for function ‘sim’ for signature ‘"Zelig-#ls"’
次の行を除いて、他のすべての行が機能します。
s.out <- sim(z.out0, x = x.out0, x1= x1.out0)
誰かが私にエラーメッセージを説明できますか? ありがとう!