I am trying to run the Arima x12 from the census bureau. [login to view URL] to seasonally adjust historical economics data. Can someone help to resolve this?
I have written the sript and it worked before fine, now its throwing up errors.
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'[login to view URL]()' for an HTML browser interface to help.
Type 'q()' to quit R.
> rm(list=ls())
> [login to view URL](TZ='GMT')
> .libPaths("P:\Rlibs")
> library(RODBC)
> library(zoo)
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
[login to view URL], [login to view URL]
> library(x12)
x12 is ready to use.
Load the package x12GUI for a Graphical User Interface.
It is advised to set the path to the X12 or X13 executables
with x12path(validpath) or x13path(validpath)!
>
> # load data from spreadsheet
> [login to view URL] <- "R:\ECONOMICRESEARCH\EM\Emerging Markets - Monthly\Trade\trade script EX [login to view URL]"
> channel <- odbcConnectExcel([login to view URL])
> [login to view URL] <- sqlFetch(channel, "Sheet1")
> [login to view URL][sh.regressors=="#N/A"] <- NA
> close(channel)
>
> a=[login to view URL]([login to view URL][18,2:ncol([login to view URL])])
> a = a[![login to view URL](a)]
> a = ts(a,start = c(2000, 1), frequency = 12)
> [login to view URL] <- [login to view URL](a)
>
> for (currentrow in 2:nrow([login to view URL])) {
+ setwd("P:\Arima\")
+
+ # look for start date of data series
+ ok <- [login to view URL](![login to view URL]([login to view URL][currentrow,2:ncol([login to view URL])]))
+ test = [login to view URL](ts(ok, start = 2000, frequency = 12))
+ [login to view URL] = zoo(ts(ok, start = 2000, frequency = 12))
+ [login to view URL] <- [login to view URL][test.logic==TRUE]
+
+ # construct a time series with the correct start date
+ a = [login to view URL]([login to view URL][currentrow,2:ncol([login to view URL])])
+ startdate <- substr(time([login to view URL][1]),1,4)
+ a = ts(a,start = c([login to view URL](startdate), 1), frequency = 12)
+
+ # seasonal adjustment
+ x12out <- x12(a,x12path="P:\Arima\WinX12\x12a\[login to view URL]",transform="auto",
+ arima=c(0,1,1),sarima=c(0,1,1),regvariables="lpyear",
+ sigmalim=c(2.0,3.0),outlier="all")
+
+ # collect results into [login to view URL]
+ [login to view URL] <- [login to view URL]([login to view URL],[login to view URL](x12out$d11))
+ }
Error in .local(object, x12Parameter, x12BaseInfo, ...) :
unused arguments (x12path = "P:\Arima\WinX12\x12a\[login to view URL]", transform = "auto", arima = c(0, 1, 1), sarima = c(0, 1, 1), regvariables = "lpyear", sigmalim = c(2, 3), outlier = "all")
> colnames([login to view URL]) <- [login to view URL]([login to view URL][,1])
Error in `colnames<-`(`*tmp*`, value = c("Albania", "Algeria", "Argentina", :
attempt to set 'colnames' on an object with less than two dimensions
>
> aa# convert time to yearmon
Error: object 'aa' not found
> [login to view URL] <- zoo([login to view URL],yearmon(time([login to view URL])))
>
> # write output to a new spreadsheet
>
> fileName <- "R:\ECONOMICRESEARCH\EM\Emerging Markets - Monthly\Trade\trade script EX [login to view URL]"
> if ([login to view URL](fileName)) {[login to view URL](fileName)}
> channel <- odbcConnectExcel(fileName,readOnly=FALSE)
> varTypes <- c(date="datetime")
> sqlSave(channel=channel, dat=[login to view URL](date=[login to view URL](time([login to view URL])),[login to view URL]),tablename="output",rownames=1,varTypes=varTypes)
> close(channel)