search for: logprobind

Displaying 1 result from an estimated 1 matches for "logprobind".

2007 May 11
0
EM covergence problem
...:4] V22 = Y[301:800,]%*%b[3:4] V31 = X[801:1000,]%*%b[5:6] V32 = Y[801:1000,]%*%b[5:6] V1 = rbind(V11,V21,V31)+rnorm(1000) V2 = rbind(V12,V22,V32)+rnorm(1000) oo = exp(V1)+exp(V2) P1 = exp(V1)/oo P2 = exp(V2)/oo D = ifelse(V1>V2,0,1) #second part of Q function Q2 = function(Beta,H){ probs = logProbInd(Beta) li = sum(H*probs) return(li) } logProbInd=function(Beta){#X, Y, D values take as is from environment dim(Beta) = c(2,3) Beta = t(Beta) probs = matrix(,nrow = 1000, ncol = 3) for(i in 1:3){ v1 = X%*%Beta[(i-1)*2+1:2] v2 = Y%*%Beta[(i-1)*2+1:2] p1 = exp(v1)/(exp(v1)+exp(v2)) p2...