arima x12 help - repost
£10-15 GBP / hour
I am trying to run the Arima x12 from the census bureau. [url removed, login to view] 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
'[url removed, login to view]()' for an HTML browser interface to help.
Type 'q()' to quit R.
> rm(list=ls())
> [url removed, login to view](TZ='GMT')
> .libPaths("P:\Rlibs")
> library(RODBC)
> library(zoo)
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
[url removed, login to view], [url removed, login to view]
> 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
> [url removed, login to view] <- "R:\ECONOMICRESEARCH\EM\Emerging Markets - Monthly\Trade\trade script EX [url removed, login to view]"
> channel <- odbcConnectExcel([url removed, login to view])
> [url removed, login to view] <- sqlFetch(channel, "Sheet1")
> [url removed, login to view][sh.regressors=="#N/A"] <- NA
> close(channel)
>
> a=[url removed, login to view]([url removed, login to view][18,2:ncol([url removed, login to view])])
> a = a[![url removed, login to view](a)]
> a = ts(a,start = c(2000, 1), frequency = 12)
> [url removed, login to view] <- [url removed, login to view](a)
>
> for (currentrow in 2:nrow([url removed, login to view])) {
+ setwd("P:\Arima\")
+
+ # look for start date of data series
+ ok <- [url removed, login to view](![url removed, login to view]([url removed, login to view][currentrow,2:ncol([url removed, login to view])]))
+ test = [url removed, login to view](ts(ok, start = 2000, frequency = 12))
+ [url removed, login to view] = zoo(ts(ok, start = 2000, frequency = 12))
+ [url removed, login to view] <- [url removed, login to view][test.logic==TRUE]
+
+ # construct a time series with the correct start date
+ a = [url removed, login to view]([url removed, login to view][currentrow,2:ncol([url removed, login to view])])
+ startdate <- substr(time([url removed, login to view][1]),1,4)
+ a = ts(a,start = c([url removed, login to view](startdate), 1), frequency = 12)
+
+ # seasonal adjustment
+ x12out <- x12(a,x12path="P:\Arima\WinX12\x12a\[url removed, login to view]",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 [url removed, login to view]
+ [url removed, login to view] <- [url removed, login to view]([url removed, login to view],[url removed, login to view](x12out$d11))
+ }
Error in .local(object, x12Parameter, x12BaseInfo, ...) :
unused arguments (x12path = "P:\Arima\WinX12\x12a\[url removed, login to view]", transform = "auto", arima = c(0, 1, 1), sarima = c(0, 1, 1), regvariables = "lpyear", sigmalim = c(2, 3), outlier = "all")
> colnames([url removed, login to view]) <- [url removed, login to view]([url removed, login to view][,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
> [url removed, login to view] <- zoo([url removed, login to view],yearmon(time([url removed, login to view])))
>
> # write output to a new spreadsheet
>
> fileName <- "R:\ECONOMICRESEARCH\EM\Emerging Markets - Monthly\Trade\trade script EX [url removed, login to view]"
> if ([url removed, login to view](fileName)) {[url removed, login to view](fileName)}
> channel <- odbcConnectExcel(fileName,readOnly=FALSE)
> varTypes <- c(date="datetime")
> sqlSave(channel=channel, dat=[url removed, login to view](date=[url removed, login to view](time([url removed, login to view])),[url removed, login to view]),tablename="output",rownames=1,varTypes=varTypes)
> close(channel)
Project ID: #5151353
About the project
2 freelancers are bidding on average £15/hour for this job
As discussed. Sorry for the delay, but I have now placed the bid....................................
Guaranteed solution provided by an experienced statistical programmer with a PhD degree. The R script will be rewritten and tested by this weekend. Cheers!