x12 not transforming series

104 views
Skip to first unread message

Joshua Abel

unread,
Jan 10, 2012, 11:28:42 AM1/10/12
to iris-toolbox-discussion
I recently downloaded your IRIS Toolbox for MATLAB to help me perform
seasonal adjustment (I know this only scratches the surface of what
IRIS can do, but it's all I need for now), but I am having trouble
getting it to work. I am hoping maybe you can set me straight.

When I use the x12 command on a time series object, I do not get an
error, but the output from my command is the same as the input. For
instance, if I were to run

x = tseries(mm(1990,1):mm(1999,12),rand(120,1))
y = x12(x)

... x and y come out to be the same series. This problem holds even
when I am using data that has a seasonal trend (which the random data
I generate above obviously does not).

When I run [y,outp,err] = x12(x), outp{1} and err{1} are empty.

I use MATLAB version 11b, and IRIS version 20111222. I suspect I did
not correctly install IRIS (or perhaps the Census X12 program), but
since I am not getting an error, I am not sure what to do. I
appreciate any help you can offer.

Jaromir Benes

unread,
Jan 10, 2012, 11:42:41 AM1/10/12
to iris-t...@googlegroups.com
What is your operating system: Win, Unix/Linux, or OSX? (unfortunately, this matters, too)

Jaromir

Jaromir Benes

unread,
Jan 10, 2012, 12:09:21 PM1/10/12
to iris-t...@googlegroups.com
I think I got it. It's a combination of three things.

First, if X12 fails to run (for whatever reason) I mistakenly changed the function recently so that it returns the original series. I'll fix this bug.

Second, if x12 fails, it should still though generate a warning. The fact that you don't see one is because your matlab warnings are probably switched off. Check out
>> warning
in the command window.

Third, why is x12 failing on your computer? It could be because you run a Mac with OSX -- there's unfortunately no official version of x12 for Mac/OSX. There are, though, executables for Mac/OSX (compiled form the original source code) available from third parties, such as GRETL. I do plan to incorporate these at some point in IRIS, too, but haven't got time to do it yet.

Alternatively, some people have occasionally troubles running x12 on Unix/Linux, or when IRIS is installed on a network drive. In that case, we should be able to fix it.

Let me know if my guess is correct.

Jaromir

Joshua Abel

unread,
Jan 10, 2012, 12:13:43 PM1/10/12
to iris-toolbox-discussion
I am operating on UNIX/LINUX.

Thanks so much for the help!

Jaromir Benes

unread,
Jan 10, 2012, 12:56:57 PM1/10/12
to iris-t...@googlegroups.com
Can you do the following:

1. Grab the file I'm attaching here, testairline.spc, and save it in the folder where IRIS stores the x12 file. This is $irisroot$/+thirdparty/+x12, where you need to replace $irisroot$ with the proper root directory where IRIS resides on your computer.

2. In Matlab, change your directory to the above one.

3. Run

>> !wine "x12.exe" testairline

from the Matlab command window.

Then let me know again whether it runs all right and produces the normal output files, ie. testairline.out, testairline.log, testairline.err.

Jaromir
testairline.spc

Joshua Abel

unread,
Jan 10, 2012, 1:24:43 PM1/10/12
to iris-toolbox-discussion
When I perform those steps, I get the message:

/bin/bash: wine: command not found

Josh
>  testairline.spc
> < 1KViewDownload

Jaromir Benes

unread,
Jan 10, 2012, 1:42:47 PM1/10/12
to iris-t...@googlegroups.com
Ok, that explains a lot.

Now, do the following:

1. Go to http://www.census.gov/srd/www/x12a/x12downv03_unix.html, and download the omegav03.tar.gz package (it's under the heading "X12-ARIMA Version 0.3 Program Archives" down on the page).

2. Unzip the package, and save the file x12a, which is contained therein, again in the $irisroot$/+thirdparty/+x12 directory.

2. Switch to that directory in Matlab, and run

>> !"x12a" testairline

(including the double quotes)

Does it run all right now?

Joshua Abel

unread,
Jan 10, 2012, 2:04:45 PM1/10/12
to iris-toolbox-discussion
Still doesn't seem to be working. Now I get:

/bin/bash: x12a: command not found

Josh

On Jan 10, 1:42 pm, Jaromir Benes <jaromir.be...@gmail.com> wrote:
> Ok, that explains a lot.
>
> Now, do the following:
>
> 1. Go tohttp://www.census.gov/srd/www/x12a/x12downv03_unix.html, and
> download the *omegav03.tar.gz<http://www.census.gov/ts/x12a/v03/unix/omegav03.tar.gz>
> * package (it's under the heading "X12-ARIMA Version 0.3 Program Archives"

Jaromir Benes

unread,
Jan 10, 2012, 2:12:22 PM1/10/12
to iris-t...@googlegroups.com
Can you make sure you really saved the x12a file in the right directory and that you really switched to that directory (run >>ls and >>pwd in the command window)?

Joshua Abel

unread,
Jan 10, 2012, 2:19:21 PM1/10/12
to iris-toolbox-discussion
Okay.

>> ls yields:
default.spc omega03.tar.gz testairline.spc x12a x12a.exe x12.m

>> pwd yields:
.../IRIS/+thirdparty/+x12

Josh

Joshua Abel

unread,
Jan 10, 2012, 2:22:50 PM1/10/12
to iris-toolbox-discussion
Is it possible that it is looking for the x12 material in the wrong
directory? When I installed IRIS, I ran installiris.m and I may have
set the x12 path to something different. Would that be causing this
problem?

Jaromir Benes

unread,
Jan 10, 2012, 2:24:56 PM1/10/12
to iris-t...@googlegroups.com
I know practically nothing about Unix/Linux (too bad for me, I know...), but I thought when you had an executable in the working directory, you should be able to run it from within that directory... Am I missing something?


Jaromir Benes

unread,
Jan 10, 2012, 2:28:32 PM1/10/12
to iris-t...@googlegroups.com
No, x12 is now "hard-wired" in IRIS (irisinstall was meant for older version... now you can simply unzip the archive where you want without the need to set up anything).

What happens if you switch to that x12 directory in the system prompt, and try to run x12a from the system prompt (not from matlab)?

Jaromir Benes

unread,
Jan 10, 2012, 2:30:15 PM1/10/12
to iris-t...@googlegroups.com
In other words, could you somehow get the x12a program up and running from the system command prompt (asking someone for help?)?


Joshua Abel

unread,
Jan 10, 2012, 2:36:57 PM1/10/12
to iris-toolbox-discussion
It seems to basically work when I try running with system command
prompt. I get the following error:

X-12-ARIMA Seasonal Adjustment Program
Version Number 0.3 Build 192
Execution began Jan 10, 2012 14.33.09

ERROR: Must specify either an input specification file name
(-i infile or infile) or an input metafile name (-m metafile).

See Section 2 of the X-12-ARIMA Reference Manual for more
information on how to run X-12-ARIMA.

I suppose it failed because I did not feed it any data, but it works.
Unfortunately, I'll need it to work IN MATLAB (my program is set up to
seasonally adjust data each time through a loop, so I need it to
function with the program - I cannot simply feed it seasonally
adjusted data).

Josh

Joshua Abel

unread,
Jan 10, 2012, 2:38:48 PM1/10/12
to iris-toolbox-discussion
If you think this an issue with my server and not really an IRIS
problem that you will be able to resolve remotely, I understand and
will begin to pursue other avenues. I don't mean to take up too much
of your time.

Jaromir Benes

unread,
Jan 10, 2012, 2:43:11 PM1/10/12
to iris-t...@googlegroups.com
One more idea...

Try to run it again from Matlab, but call the entire path to the x12a, i.e.

>> !$irisroot$/+thirdparty/+x12/x12a

where again replace $irisroot$ with the correct path.

Probably, when you run a system command from within Matlab in Unix/Linux, it does not preserve the current working directory...

Jaromir Benes

unread,
Jan 10, 2012, 2:43:54 PM1/10/12
to iris-t...@googlegroups.com
Don't worry, this is useful for me, too...

Joshua Abel

unread,
Jan 10, 2012, 2:58:20 PM1/10/12
to iris-toolbox-discussion
Ahh progress! Now, I am getting that same error i got from the system
command prompt, but in MATLAB.

Unfortunately, I'm still confused. What is the command that will
actually perform the seasonal adjustment (ie. y = f(x)).
!$irisroot$/+thirdparty/+x12/x12a finds the x12 program, but I am not
sure how to feed my data into it and get an output...

Thanks so much for your help! We're almost there...

Jaromir Benes

unread,
Jan 10, 2012, 3:06:39 PM1/10/12
to iris-t...@googlegroups.com
Easy-peasy now.

Get the m-file I'm attaching now (x12.m), and replace the one you have in the iris x12 directory with this one (i.e. just delete the x12.m file you have in that directory, and save this one in the same location instead).

Also you make sure you still keep the x12a executable you downloaded earlier in that very same directory.

Then, with this new m-file you should be able to use the x12 command as before

>> x = tseries(...);
>> y = x12(x)

(of course let me know if there's still something not working...)

I'll make all this changes part of the next release, so you will not have to take care of anything from now on...

Jaromir

x12.m

Joshua Abel

unread,
Jan 10, 2012, 3:21:04 PM1/10/12
to iris-toolbox-discussion
Fantastic, it's working! Thanks so much for your help - I appreciate
it a lot.

Josh
>  x12.m
> 8KViewDownload

Jaromir Benes

unread,
Jan 10, 2012, 3:26:24 PM1/10/12
to iris-t...@googlegroups.com
Huhu, in return, I hope you'll also use the more substantial features in IRIS... :)

J

Joshua Abel

unread,
Jan 10, 2012, 3:50:27 PM1/10/12
to iris-toolbox-discussion
I'll certainly pass on the word about IRIS.

Thanks again.

Josh
Reply all
Reply to author
Forward
0 new messages