[R-sig-Finance] arma model results when exogenouse variables used in ARMA(p=5, q=(1-6, 19))
Joe Byers
joe-byers at utulsa.edu
Thu Jul 6 18:38:02 CEST 2006
All,
I posted a message earlier about fitting an ARMA(p=5,q=(1-6,19)) with
exnogenouse variables (xreg=exovars), and masking (fixed=fixedparms) the
MA terms 7-18 to get the model to run. I am reposting some of the
message to help with understanding the summary() function problem
My code is
fixed=c(rep(NA,5),rep(NA,6),rep(0,12),NA,NA);#5 ar terms, 19 ma
terms fixed 7-18 lag ma term, intercept
fixed<-c(fixed,NA); #add the lin.trend term
ts.results.2.ma<-armaFit(datats~arma(5,19),xreg=cbind(Lin.Trend=d$factor.Lin.Trend.),
include.mean=TRUE,optim.control=list(maxit=500),fixed=fixed);
summary.fARMA.HTML(ts.results.2.ma,title="AR(5) MA(1:6,19) with
Intercept and Linear Trend");# this function is a modification of
summary.fARMA to work with r2HTML replacing the cat() functions.
The problem I have is that the @fit$coef(26) and @fit$se.coef(14) are of
different lengths causing the t-stats calculation is summary to issue
warnings.
Warning messages:
1: longer object length
is not a multiple of shorter object length in:
object$coef/object$se.coef
2: number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1,
format(object$coef, digits = digits), format(object$se.coef,
The tval and prob are not correct.
The summary() code is
tval <- object$coef/object$se.coef
prob <- 2 * (1 - pnorm(abs(tval)))
ans$coefmat <- cbind(format(object$coef,digits=digits),
format(object$se.coef,digits=digits),
format(tval,digits=digits), prob=format.pval(prob,digits=digits))
dimnames(ans$coefmat) <- list(names(object$coef), c(" Estimate",
" Std. Error", " t value", "Pr(>|t|)"))
row.names(ans$coefmat)<-toupper(row.names(ans$coefmat))
I can modify tval as
tval<-subset(object$coef,object$mask)/object$se.coef
prob <- 2 * (1 - pnorm(abs(tval)))
The subset functions removes all FALSE or masked MA terms from the coef
vector. It will return a vector of length 14. Now I have to expand
tval, prob and se.coef out to match the length of coef to get the the
results printed correctly.
Can anyone help me with this? It would probably be a good thing to
include in future versions of rMetrics as well.
Thank you
Joe W. Byers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: joe-byers.vcf
Type: text/x-vcard
Size: 104 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20060706/a4c15bae/attachment.vcf
More information about the R-SIG-Finance
mailing list