[R-SIG-Finance] Binart ARMA

Napon Hongsakulvasu econ.napon at hotmail.com
Mon Nov 14 19:12:40 CET 2011







Hi All

I need some help about construct MLE logit for Binary Autogressive Moving Average model.
Please see the model in the PDF attach file.

This is what i did.

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 
logitfun <- function(beta,y,){
      zeta1<-beta[1]
      zeta2<-beta[2]
      zeta3<-beta[3]
      ne<-zeta1+zeta2*lag(y,-1)+zeta3*lag(y,-2)                        # this is only AR(2) 
      mu <- exp(ne)/(1.0+exp(ne))
      sum( y * log(mu) + (1-y)*log(1-mu) )
    }
mle<-optim(c(0,0,0),logitfun,y=y)
mle
summary(mle)

what i tring to do is to modified "ne<-zeta1+zeta2*lag(y,-1)+zeta3*lag(y,-2)"
How can i do "ne" with lag(y,-1) , lag(y,-2), (lag(y,-1)-lag(mu,-1)), (lag(y,-2)lag(mu,-2))

thanks

Napon H.










 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20111114/e478e403/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Model.pdf
Type: application/pdf
Size: 359512 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20111114/e478e403/attachment.pdf>


More information about the R-SIG-Finance mailing list