简体   繁体   English

无法为签名“ Zelig-ls”找到函数“ sim”的继承方法

[英]Unable to find an inherited method for function ‘sim’ for signature ‘“Zelig-ls”’

Using R, when I run the code below, I am getting an error message. 使用R,当我运行下面的代码时,我收到一条错误消息。

Code: 码:

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"’        

All the other lines work except for the line: s.out <- sim(z.out0, x = x.out0, x1= x1.out0) 除该行外,其他所有行均有效: s.out <- sim(z.out0, x = x.out0, x1= x1.out0)

Can someone explain the error message to me? 有人可以向我解释错误消息吗? Thanks! 谢谢!

It's probably linked to the fact that 'sim' function exists in another package you have loaded. 这可能与“ sim”函数存在于您已加载的另一个软件包中这一事实有关。 If this is the case, the function is "masked". 在这种情况下,该功能被“屏蔽”。

Use the name of the package you want to use then twice ":" then the name of the particular function you want to use. 使用您要使用的程序包的名称,然后输入两次“:”,然后输入您要使用的特定功能的名称。 In your case, it becomes: s.out0 <- Zelig::sim(z.out0, x = x.out0, x1= x1.out0) . 在您的情况下,它变为: s.out0 <- Zelig::sim(z.out0, x = x.out0, x1= x1.out0)

Best 最好

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到签名“data.frame”的 function 'dbClearResult' 的继承方法 - Unable to find an inherited method for function 'dbClearResult' for signature '"data.frame"' 无法为签名“ character”,“ missing”找到函数“ dbReadTable”的继承方法 - unable to find an inherited method for function ‘dbReadTable’ for signature ‘“character”, “missing”’ 无法为签名“ NULL”找到函数“ lhs &lt;-”的继承方法 - unable to find an inherited method for function ‘lhs<-’ for signature ‘“NULL”’ 无法找到用于签名“字符”的函数“dbConnect”的继承方法 - unable to find an inherited method for function ‘dbConnect’ for signature ‘"character"’ 无法为签名'“整数”找到函数'vif'的继承方法' - unable to find an inherited method for function ‘vif’ for signature ‘“integer”’ 无法找到签名“ lm”,“ SpatialPointsDataFrame”的函数“ krige”的继承方法 - Unable to find an inherited method for function ‘krige’ for signature ‘“lm”, “SpatialPointsDataFrame”’ 无法为签名&#39;“character”&#39;找到函数&#39;saveXML&#39;的继承方法 - unable to find an inherited method for function ‘saveXML’ for signature ‘“character”’ “无法为签名“ y”找到函数“ X”的继承方法 - 'unable to find an inherited method for function ‘X’ for signature ‘“y”’ animate 错误:无法为签名“gganim”找到函数“animate”的继承方法 - Error with animate: unable to find an inherited method for function ‘animate’ for signature ‘"gganim"’ 无法找到 function“选择”签名“data.frame”的继承方法 - Unable to find an inherited method for function ‘select’ for signature ‘"data.frame"’
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM