[R] Binary ARMA
Napon H.
econ.napon at hotmail.com
Mon Nov 14 19:20:11 CET 2011
http://r.789695.n4.nabble.com/file/n4040429/model.jpg
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.
--
View this message in context: http://r.789695.n4.nabble.com/Binary-ARMA-tp4040429p4040429.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list