Bug 15068 - arima.sim returns a series with the wrong length for an ARIMA(0,0,0) model
arima.sim returns a series with the wrong length for an ARIMA(0,0,0) model
Status: CLOSED FIXED
Product: R
Classification: Unclassified
Component: Language
R 2.15.1
All All
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-08 02:03 UTC by Peter Green
Modified: 2012-10-08 14:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Green 2012-10-08 02:03:40 UTC
This should result in a time series with length 5, but gives length 6:

> arima.sim(model=list(), n=5)
Time Series:
Start = 1 
End = 6 
Frequency = 1 
[1]           NA  0.830040023 -1.622808195 -0.006672163  0.340905781
[6] -0.372877880

Caused by using 1L:n.start instead of seq_len(n.start) in two places (1L:n could also be replaced with seq_len(n)).



> version
               _                            
platform       i686-redhat-linux-gnu        
arch           i686                         
os             linux-gnu                    
system         i686, linux-gnu              
status                                      
major          2                            
minor          15.1                         
year           2012                         
month          06                           
day            22                           
svn rev        59600                        
language       R                            
version.string R version 2.15.1 (2012-06-22)
nickname       Roasted Marshmallows
Comment 1 Brian Ripley 2012-10-08 14:16:26 UTC
I'm not sure that really is an ARIMA model, but we'll adapt it to work in that case.

Note that seq_len came many years later.