Displaying 1 result from an estimated 1 matches for "lltm1".
2011 Jul 19
2
loops and simulation
...> theta.t=theta
> beta.t=beta
>
> # Define log-likelihood function
> ll <- function(y, k, c){
> n*log(c*k)-(k+1)*( sum(log(1+c*Y))+sum( R*log(1+c*Y)+1/k ) )
> }
>
> # Compute the log-likelihood for the initial values, and ignoring the
> missing data mechanism
> lltm1 <- ll(Yobs, theta.t, beta.t)
>
> repeat{
> # E-step
>
> Bbar<- function(theta.t,beta.t){
> sum(R*(1+beta.t*(theta.t+1)*Yobs)/(beta.t*(theta.t+1)*(1+beta.t*Yobs)))
> }
>
> Abar<- function(theta.t,beta.t){
> sum( R* ( log(1+beta.t*Yobs)+ 1/theta.t ))
> }
&...