Displaying 1 result from an estimated 1 matches for "getprobfromtheta".
2012 Apr 26
0
Problem with constrOptim when hitting boundary
...else stop("Programming error -- single row wtMat")
}
###Need to convert so in terms of pi[-0]
transMat<-rbind(rep(-1,K),diag(K))
Aid<-A%*%transMat
numGr<-wtMat %*% Aid #N x K matrix
init<-rep(1/(K+1),length=K) #equal distribution; could perhaps choose better init value
getProbFromTheta<-function(theta){
return(c(1-sum(theta),theta))
}
neglik<-function(theta){
probDist<-as.vector(A%*%getProbFromTheta(theta)) #should be a vector of probabilities
if(length(probDist)!=K+1) stop("Programming error -- wrong length")
if(any(probDist< -1e-10)) stop("P...