Can someone tell me why the vector s1 below contains missing values?
Thanks in advance!
Jessica
Code:
version 14.2 webuse sysdsn1, clear keep if insure !=. mlogit insure age male nonwhite i.site matrix define b = e(b) tempname noomit _ms_omit_info b local cols = colsof(b) matrix `noomit' = J(1,`cols',1) - r(omit) tab insure, g(insure) tab site, g(site) mata st_view(y1=.,., "insure1") st_view(y2=.,., "insure2") st_view(y3=.,., "insure3") N=rows(y1) cons=J(N,1,1) st_view(X=.,.,"age male nonwhite site2 site3") X=X, cons b=select(st_matrix("b"),(st_matrix(st_local("noomit")))) xb2 = X*b[1..6]' xb3 = X*b[7..12]' p1 = 1 :/ (1 :+ exp(xb2) :+ exp(xb3)) p2 = exp(xb2) :/ (1 :+ exp(xb2) :+ exp(xb3)) p3 = exp(xb3) :/ (1 :+ exp(xb2) :+ exp(xb3)) s1 = X'*(y2 - p2) end
Jessica
Comment