[R] assign estimated values

Pete Brecknock Peter.Brecknock at bp.com
Mon Feb 11 02:26:37 CET 2013


malaka wrote
> Hi,
> I want to assign the ar1 , ma 1 and the intercept estimated by the
> following code to three variables a, b and c respectively.
> 
> Can anyone help me with this please?
> 
> code:
> 
> a0 = 0.05; a1 = 0.1; b1 = 0.85
> nu = rnorm(2500)
> epsi = rep(0, 2500)
> h = rep(0, 2500)
> for (i in 2: 2500) { h[i] = a0 + a1 * epsi[i-1]^2 + b1 * h[i-1]  ; epsi[i]
> = nu[i] * sqrt(h[i])}
> epsi = epsi[1501:2500]
> epsi=epsi*epsi
> arma(epsi,order=c(1,1))

You haven't specified a library for the arma function. Your code doesn't
work for me in the form you posted it.

However, changing ...

arma(epsi, order=c(1,1)) to 

mod = arima(epsi, order=c(1,0,1))

You can extract the parameters of interest using 

a= mod$coef["ar1"] 
b= mod$coef["ma1"]
c= mod$coef["intercept"]

HTH

Pete



--
View this message in context: http://r.789695.n4.nabble.com/assign-estimated-values-tp4658139p4658141.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list