【问题标题】:Error in ipw: How to deal with Non-numeric argument to mathematical functionipw 中的错误:如何处理数学函数的非数字参数
【发布时间】:2018-12-14 13:47:25
【问题描述】:

我试图通过以下脚本运行逆概率加权:

temp1<-ipwpoint(exposure=bmi_ly,

 family="gaussian", numerator=~1, 
denominator=~ age+sex+pack_years+edu_cat+drinkstatus,data=devdata)

where 
bmi_ly=continuous (range 13-78), 
age=continuous (range 18-79), 
sex=dichotomous (1,2), 
pack_years= categorical (1,2,3) and 
drinkstatus=categorical (1,2,3).   

but it returns with an error msg
Er

ror in dnorm(tempdat$exposure, predict(mod1), sd(mod1$residuals)) 

数学函数的非数字参数

我试图找出问题所在,但无法解决。你们能帮帮我吗。谢谢。

【问题讨论】:

    标签: r


    【解决方案1】:

    将非数字分类变量转换为一种热编码或标签编码,这将解决您的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多