我试图通过以下脚本运行逆概率加权:
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))
数学函数的非数字参数
我试图找出问题所在,但没有。你们能帮我吗?谢谢。
答案 0 :(得分:0)
将非数字类别变量转换为一种热编码或标签编码,可以解决您的问题。