Skip to content

predict.ar() produces wrong SE's (PR#9614)

1 message · kirk.hampel at abs.gov.au

#
Full_Name: Kirk Hampel
Version: 2.4.1
OS: Windows
Submission from: (NULL) (144.53.251.2)


Given an AR(p) model, the last p SE's are wrong.

The source of the bug is that the C code (ver 2.4.0) assumes *npsi is the length
of the psi vector (which is n+p), whilst the predict.ar function in R passes out
as.integer(npsi), where npsi <- n-1.

Some R code following reproduces the error. Let p=4, n=6, then
[1] 1.037580 2.444163 2.444163 2.581298
[1] 1.000000 1.250000 1.312500 1.328125 1.332031 1.332031
[1] 1.000000 1.250000 1.500000 1.750000 2.000000 2.219727