<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>


<style>
.ExternalClass .ecxshape
{;}
</style>


<p class="ecxMsoNormal"><span style="font-size:11.0pt;line-height:115%;font-family:"Calibri","sans-serif""></span></p>Hi All<br><br>I need some help about construct MLE logit for Binary Autogressive Moving Average model.<br>Please see the model in the PDF attach file.<br><br>This is what i did.<br><br>y<-c(0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1)      # y is a binary data <br>logitfun <- function(beta,y,){<br>      zeta1<-beta[1]<br>      zeta2<-beta[2]<br>      zeta3<-beta[3]<br>      ne<-zeta1+zeta2*lag(y,-1)+zeta3*lag(y,-2)                        # this is only AR(2) <br>      mu <- exp(ne)/(1.0+exp(ne))<br>      sum( y * log(mu) + (1-y)*log(1-mu) )<br>    }<br>mle<-optim(c(0,0,0),logitfun,y=y)<br>mle<br>summary(mle)<br><br>what i tring to do is to modified "ne<-zeta1+zeta2*lag(y,-1)+zeta3*lag(y,-2)"<br>How can i do "ne" with lag(y,-1) , lag(y,-2), (lag(y,-1)-lag(mu,-1)), (lag(y,-2)lag(mu,-2))<br><br>thanks<br><br>Napon H.<br><br><p class="ecxMsoNormal" style="text-align:center" align="center">
<style>
.ExternalClass .ecxshape
{;}
</style>


</p><p class="ecxMsoNormal" style="text-align:center" align="center"><span style="font-size:11.0pt;line-height:115%;font-family:"Calibri","sans-serif""><br></span></p>



                                          </div></body>
</html>