- 已编辑
请教一下各位大佬
如何将如下的函数在R语言中写出来,我用stata写了一个例子:
----------------------- copy starting from the next line -----------------------
gen double `f1'=normalden($ML_y1,`xb1',exp(`lns1'))
gen double `f2'=normalden($ML_y1,`xb2',exp(`lns2'))
tempvar p
gen double `p'=exp(`lp')/(1+exp(`lp'))
replace `f'=`p'*`f1'+(1-`p')*`f2'
------------------ copy up to and including the previous line ------------------
函数如下,是一个由两个ols组成的混合模型,表达式如下: