RTOC Instruction |
RTOC( options ) start end newstart
# list of real series
# list of complex series
RATS has no instruction which allows you to read data directly into complex series. Instead, you can read data into regular real-valued series, and then use RTOC (Real TO Complex) to transfer values to a complex series. CTOR (Complex TO Real) transfers data in the other direction.
Parameters
start, end |
Range of entries to transfer. This defaults to the defined range of each real series, determined separately for each series. |
newstart |
Entry in the complex series for the start entry of the real series. By default, same as start. The default starting entry may change from series to series if you use the default start and end range. |
Description
RTOC transfers data from the real series on the first supplementary card to the corresponding complex series on the second card. It sets the imaginary parts of the complex series to zero.
Options
[PAD]/NOPAD
By default, RTOC sets to zero all the entries of the complex series which it doesn’t explicitly transfer from the real series. Thus the “defined length” of the complex series is just its total length. You can suppress this automatic padding with the NOPAD option.
RTOC will pad both ends of the series if necessary. For instance, residuals from a regression involving lags have beginning entries which aren’t defined. If you use the defaults for the RTOC parameters, it will transfer the defined portion of the real series and set the initial undefined observations to zero.
EVEN/[NOEVEN]
With EVEN, RTOC will take a one-sided sequence and turn it into a symmetric two-sided sequence by reflecting the sequence around the midpoint of the series. This can be useful if you have a set of autocovariances which have only been computed in one direction in the real domain.
[LABELS]/NOLABELS
RTOC transfers the labels of the real series to the complex series unless you use NOLABELS.
Variables Defined
%NOBS |
Number of observations transferred (taken from the last series on the list) (INTEGER) |
Missing Values
RTOC sets to zero any entries of the complex series which correspond to missing values in the real series.
Example
This transfers series RESIDS1 to complex series 1 and RESIDS2 to complex series 2 and pads both complex series to 256 entries.
frequency 5 256
rtoc
# resids1 resids2
# 1 2
Using Matrices
It is possible to read and write complex series with the matrix input instruction READ. You must use OVERLAY to place a complex vector over the set of entries to be read or written. For example, the following overlays complex series 2 with CSERIES (a VECTOR[COMPLEX]) and reads data for it using READ:
freq 5 128
open data freqs.dat
declare vector[complex] cseries
overlay %z(1,2) with cseries(128)
read cseries
Copyright © 2025 Thomas A. Doan