search for: sumloglik

Displaying 2 results from an estimated 2 matches for "sumloglik".

2007 Mar 06
2
Estimating parameters of 2 phase Coxian using optim
...heta[3] p<-Matrix(c(1, 0), nrow=1, ncol=2) Q<-Matrix(c(-(lambda1 + mu1), 0, lambda1, -mu2), nrow=2, ncol=2) q<-Matrix(c(mu1, mu2), nrow=2, ncol=1) for (i in 1:length(y)){ loglik<-log(p %*% expm(Q * y(i)) %*% q) return(loglik)} sumloglik<-sum(loglik) return(-sumloglik) } I have installed the Matrix package. y is a vector of 240 survival times. In the R console I typed > source("/private/var/automount/users/lhill07/Desktop/cox2.lik.R") > optim(c(0.5, 0.5, 0.5), cox2.lik, y=y, method="BFGS&quot...
2007 Mar 13
0
multiplying matrix by vector of times
...>>>>> q<-Matrix(c(mu1, mu2), nrow=2, ncol=1) >>>>> >>>>> for (i in 1:length(y)){ >>>>> loglik<-log(p %*% expm(Q * y(i)) %*% q) >>>>> return(loglik)} >>>>> >>>>> sumloglik<-sum(loglik) >>>>> >>>>> return(-sumloglik) >>>>> } >> >> >> >> Hi Gad, >> >> Yes that's exactly hat I am trying to do. If I gave you a simple example, >> could you perhaps tell me how I coul...