Error in R tbats function - r

I have 548 weeks of data and am trying to use tbats with little success. I get the following error:
Error in checkForRemoteErrors(val) :
3 nodes produced errors; first error: function cannot be evaluated at initial parameters
my data:
weeklyu <-structure(list(V1 = c(18594L, 13593L, 9854L, 12040L, 12920L,
13302L, 12500L, 13073L, 13801L, 12895L, 13199L, 21568L, 19848L,
13418L, 13188L, 13560L, 21327L, 17724L, 11875L, 12475L, 15130L,
14497L, 16289L, 22388L, 17091L, 21104L, 19579L, 18432L, 13234L,
16728L, 15368L, 18105L, 14715L, 16763L, 16788L, 15701L, 17331L,
18725L, 24336L, 16186L, 14299L, 15144L, 17444L, 19384L, 17035L,
18611L, 25946L, 32773L, 41676L, 59446L, 74874L, 19839L, 18325L,
17417L, 14025L, 15225L, 15323L, 16075L, 14756L, 15567L, 19416L,
15190L, 14349L, 19137L, 17714L, 22033L, 20182L, 16660L, 23325L,
19769L, 19465L, 16379L, 20762L, 19084L, 17395L, 21461L, 17616L,
25190L, 22671L, 21138L, 15302L, 19633L, 18951L, 20609L, 16493L,
18680L, 19583L, 18474L, 17654L, 20000L, 26003L, 17507L, 16547L,
18051L, 18627L, 19451L, 17682L, 19522L, 26240L, 33652L, 44835L,
59187L, 84620L, 32522L, 19829L, 17226L, 14330L, 15146L, 16043L,
16891L, 14569L, 14405L, 15919L, 13953L, 13014L, 16951L, 19543L,
23729L, 21614L, 14385L, 18847L, 17892L, 13140L, 11989L, 31371L,
32555L, 27598L, 29342L, 20787L, 30886L, 31296L, 26188L, 18586L,
22866L, 23160L, 26679L, 19641L, 20722L, 23915L, 16546L, 21480L,
21822L, 32611L, 21739L, 19410L, 17950L, 20800L, 22238L, 22667L,
21158L, 29635L, 38873L, 51334L, 67618L, 102150L, 56709L, 27771L,
20496L, 15617L, 17840L, 19616L, 19477L, 19703L, 17789L, 22365L,
21165L, 19706L, 30054L, 28939L, 26935L, 24446L, 18319L, 27419L,
43941L, 21068L, 18139L, 18385L, 22229L, 23650L, 28577L, 22497L,
27637L, 32822L, 28892L, 22691L, 23788L, 23727L, 22212L, 19853L,
21458L, 24941L, 23761L, 22393L, 20688L, 30884L, 30939L, 19373L,
19446L, 22363L, 25349L, 24333L, 24361L, 25849L, 40634L, 52033L,
68422L, 112772L, 84959L, 31343L, 24789L, 22639L, 19352L, 22176L,
21494L, 20161L, 17960L, 22985L, 24113L, 20326L, 20605L, 23159L,
28641L, 34736L, 22614L, 28310L, 33962L, 23836L, 21205L, 19933L,
23414L, 24127L, 25762L, 27898L, 27069L, 37598L, 32451L, 31210L,
24470L, 26281L, 23764L, 24506L, 21034L, 27204L, 29456L, 26162L,
25692L, 33738L, 32727L, 22314L, 22937L, 23974L, 28979L, 26481L,
27885L, 28264L, 41185L, 53924L, 62340L, 109928L, 97952L, 33023L,
27537L, 19913L, 18757L, 24361L, 22391L, 22402L, 19865L, 23339L,
23995L, 19874L, 19599L, 24435L, 31449L, 24959L, 18649L, 22280L,
32005L, 23227L, 18678L, 17894L, 23540L, 26109L, 26178L, 36432L,
30085L, 34126L, 28556L, 22603L, 21849L, 27871L, 22422L, 23984L,
19919L, 26152L, 28189L, 23459L, 20078L, 28310L, 31234L, 22394L,
20988L, 21401L, 28869L, 29915L, 25649L, 28483L, 40985L, 56049L,
65034L, 107110L, 103296L, 28677L, 23472L, 21035L, 18810L, 21639L,
22750L, 22675L, 19938L, 20674L, 24204L, 18657L, 20852L, 24986L,
26861L, 34310L, 22236L, 32884L, 37194L, 24933L, 18839L, 19396L,
24473L, 27922L, 24582L, 30348L, 23238L, 33199L, 31392L, 24778L,
20016L, 28230L, 24011L, 21890L, 20894L, 25797L, 29816L, 23384L,
21111L, 23517L, 30393L, 32004L, 20316L, 19941L, 25712L, 27371L,
23985L, 26508L, 39417L, 56225L, 65534L, 106220L, 135823L, 34772L,
24237L, 21064L, 19184L, 22146L, 25044L, 21753L, 21482L, 22178L,
25718L, 21384L, 21099L, 26945L, 33711L, 35273L, 24807L, 22027L,
34099L, 29842L, 21348L, 18802L, 25595L, 27276L, 24056L, 29279L,
24938L, 36060L, 33213L, 30601L, 20955L, 24773L, 28693L, 31301L,
24287L, 24545L, 30910L, 27261L, 23929L, 25167L, 34285L, 35096L,
21831L, 22137L, 25630L, 26853L, 25871L, 27499L, 36479L, 52402L,
58148L, 83033L, 122756L, 58313L, 26249L, 22310L, 17733L, 19202L,
22390L, 20969L, 20553L, 17860L, 24034L, 20915L, 19864L, 25003L,
31461L, 30302L, 21518L, 21273L, 24785L, 28366L, 26014L, 20288L,
21098L, 23394L, 21124L, 26181L, 24367L, 33042L, 32558L, 27164L,
20895L, 24235L, 26494L, 26734L, 17734L, 19397L, 25407L, 23536L,
21434L, 22248L, 34186L, 25554L, 18707L, 17292L, 19123L, 23300L,
21337L, 23136L, 27681L, 49923L, 59344L, 77552L, 97665L, 68414L,
27532L, 21217L, 16269L, 17607L, 22626L, 21087L, 20776L, 15611L,
22448L, 20070L, 18562L, 22027L, 25401L, 33810L, 21264L, 28131L,
28179L, 39713L, 23450L, 20752L, 23593L, 27141L, 25511L, 30010L,
23526L, 29145L, 34520L, 32609L, 30214L, 25018L, 26091L, 22625L,
21205L, 21550L, 29100L, 27555L, 21273L, 22519L, 32719L, 29749L,
29160L, 19621L, 23631L, 27312L, 26380L, 25949L, 30285L, 46186L,
59925L, 71215L, 120941L, 87855L, 32558L, 23906L, 22984L, 19685L,
23324L, 20996L, 21947L, 17577L, 23871L, 22242L, 18914L, 18821L,
24463L, 33096L, 27962L, 20848L, 26917L, 34725L, 21951L, 18351L,
17952L, 24975L, 23563L, 23275L, 29248L, 28011L, 37056L)), .Names = "V1", class = "data.frame", row.names = c(NA,
-548L))
The data has 53 weeks in a leap year and there are two seasonalities present: 52.25 and 209.
weeklyts <- msts(weeklyu, seasonal.period=c(52.25,209),
ts.frequency=52.25)
I then try:
weeklytbat <- tbats(weeklyts)
and then get the error above.
It will work if I set seasonal.periods to c(52,209) or c(52.3,209) or c(52.2501,209).
Any help would be much appreciated

This was a bug in the function caused by one seasonal period being a small multiple of the other. It is now fixed in the github version at https://github.com/robjhyndman/forecast. The CRAN version will be updated in due course.

If you run traceback() on your error message, you can see that the error originates from a function call in the parallel package. By default, tbats attempts to use parallel processing.
You can forego parallel processing with use.parallel = FALSE, but then there is a different error message which ties more closely to the source of the issue.
weeklytbat <- tbats(weeklyts, use.parallel=F)
Error in optim(par = param.vector$vect, fn = calcLikelihoodTBATS, method = "Nelder-Mead", :
function cannot be evaluated at initial parameters
I would suggest using one of your other seasonal periods unless you want to dig in to the optimization routine for your data.
HTH

Related

Multiple Changepoint Analysis: penalty and significance

I am analyzing changes in unique users' ratings for different movies in time. In order to find significant changepoints in time, I am using the 'changepoint' package and the PELT method.
I understand that there are different types of penalties, however, I
am still unsure which one to use.
I tried to make an elbow plot to see the optimal number of changes,
but somehow it does not work. Here is what I have so far, based on,
for example, the movie "Inception".
Also, are all changepoints significant? Is there a way to prove
significance?
My data: timestamp_date = date; cummean = all ratings for the day:
timestamp_date cummean
18-07-2010 4.15384615
19-07-2010 4.23809524
20-07-2010 4.23880597
21-07-2010 4.24390244
22-07-2010 4.19387755
23-07-2010 4.21186441
24-07-2010 4.23758865
25-07-2010 4.28804348
26-07-2010 4.32126697
27-07-2010 4.34063745
28-07-2010 4.36330935
29-07-2010 4.35521886
30-07-2010 4.35448916
31-07-2010 4.34005764
1-08-2010 4.34741144
2-08-2010 4.35604113
3-08-2010 4.34725537
4-08-2010 4.33073497
5-08-2010 4.34051724
6-08-2010 4.34114053
7-08-2010 4.3467433
8-08-2010 4.32909091
9-08-2010 4.32901554
10-08-2010 4.32171799
11-08-2010 4.32316119
12-08-2010 4.32375189
13-08-2010 4.32532751
14-08-2010 4.32932011
15-08-2010 4.32855191
16-08-2010 4.33266932
17-08-2010 4.33246415
18-08-2010 4.33312102
19-08-2010 4.32982673
20-08-2010 4.33212121
21-08-2010 4.33195755
22-08-2010 4.33198614
23-08-2010 4.33370913
24-08-2010 4.3342511
25-08-2010 4.33441208
26-08-2010 4.33439153
27-08-2010 4.33541018
28-08-2010 4.331643
29-08-2010 4.32954545
30-08-2010 4.32992203
31-08-2010 4.330468
1-09-2010 4.33002833
2-09-2010 4.32679739
3-09-2010 4.32763401
4-09-2010 4.33091568
5-09-2010 4.33081033
6-09-2010 4.3289358
7-09-2010 4.33072917
8-09-2010 4.33104631
9-09-2010 4.33347422
10-09-2010 4.33430962
11-09-2010 4.33251029
12-09-2010 4.33292782
13-09-2010 4.33360129
14-09-2010 4.33359936
15-09-2010 4.33307024
16-09-2010 4.33268025
17-09-2010 4.33256528
18-09-2010 4.33358548
19-09-2010 4.33247232
20-09-2010 4.33734088
21-09-2010 4.33758621
22-09-2010 4.34044715
23-09-2010 4.34026846
24-09-2010 4.33878505
25-09-2010 4.33542631
26-09-2010 4.33409836
27-09-2010 4.33268482
28-09-2010 4.3332256
29-09-2010 4.33451157
30-09-2010 4.33545108
1-10-2010 4.33470032
2-10-2010 4.33550995
3-10-2010 4.33374384
4-10-2010 4.33455882
5-10-2010 4.33638026
6-10-2010 4.33704819
7-10-2010 4.33871933
8-10-2010 4.33881579
9-10-2010 4.33718861
10-10-2010 4.33931725
11-10-2010 4.34020918
12-10-2010 4.33927545
13-10-2010 4.33714286
14-10-2010 4.33730835
My code:
inds <- seq(as.Date("2010-07-18"), as.Date("2010-10-14"), by = "day")
myts <- ts(inception$cummean, start = c(2010, as.numeric(format(inds[1], "%j"))), frequency = 365)
#single changepoint: method AMOC
cpt <- changepoint::cpt.meanvar(myts)
cpts(cpt)
cpts.ts(cpt)
param.est(cpt)
plot(cpt)
summary(cpt)
#multiple changepoints: method PELT
mcpt <- changepoint::cpt.meanvar(myts, method = "PELT")
cpts(mcpt)
cpts.ts(mcpt)
param.est(mcpt)
ncpts(mcpt)
plot(mcpt)
summary(mcpt)
Also, as I use a ts.object, I cannot convert the date to appear right when I plot cpt, what am I doing wrong?
Thank you!!

Error while fitting data in auto.arima - R

I am running auto.arima for forecasting time series data and getting the following error:
1: The time series frequency has been rounded to support seasonal
differencing.
2: In value[3L] : The chosen test encountered
an error, so no seasonal differencing is selected. Check the time
series data.
This is what I am executing:
fit <- auto.arima(data,seasonal = TRUE, approximation = FALSE)
I have weekly time series data.
This is how dput(data) looks like:
structure(c(12911647L, 12618317L, 12827388L, 12967840L, 13264925L,
13557838L, 13701131L, 13812463L, 13971928L, 13837658L, 13550635L,
13022371L, 13507596L, 13456736L, 12992393L, 12831883L, 13262301L,
12831691L, 12808893L, 12726330L, 11893457L, 12434051L, 12363464L,
12077055L, 12107221L, 11986124L, 11997087L, 12264971L, 12164412L,
12438279L, 12733842L, 12543251L, 12627134L, 12480153L, 12276238L,
12443655L, 12497753L, 12279060L, 12549138L, 12308591L, 12416680L,
12516725L, 12326545L, 12772578L, 12524848L, 13429830L, 14188044L,
16611840L, 16476565L, 15659941L, 10785585L, 12150894L, 13436366L,
12985213L, 13097555L, 13204872L, 13786040L, 13760281L, 13295389L,
14734578L, 15043941L, 14821169L, 14361765L, 14300180L, 14357964L,
14271892L, 13248168L, 13813784L, 14092489L, 14100024L, 13378374L,
13225650L, 12582444L, 13267163L, 13026181L, 12747286L, 12707074L,
12534595L, 12546094L, 13030406L, 12950360L, 12814398L, 13405187L,
13277755L, 13142375L, 12742153L, 12610817L, 12267747L, 12570075L,
12704157L, 12835948L, 12851893L, 12978880L, 13104906L, 12754018L,
13213958L, 13584642L, 13963433L, 14471672L, 16312595L, 16630000L,
16443882L, 11555299L, 12018373L, 13031876L, 13013945L, 13164137L,
13313246L, 13652605L, 13803606L, 13308310L, 14466211L, 15092736L,
15346015L, 14467260L, 14767785L, 13914271L, 14185070L, 13851028L,
13605858L, 13597999L, 13876994L, 13026270L, 13113250L, 12288727L,
12925846L, 13525010L, 12594472L, 12654512L, 12888260L), .Tsp = c(2016.00819672131,
2018.48047598209, 52.1785714285714), class = "ts")
This is how I am reading data from the csv
read_data <- read.csv(file="data.csv", header=TRUE)
data_ts <- ts(read_data, freq=365.25/7, start=decimal_date(ymd("2016-1-4")))
data <- data_ts[, 2:2]
This is the data in the csv:
Year si_act
1/4/16 12911647
1/11/16 12618317
1/18/16 12827388
1/25/16 12967840
2/1/16 13264925
2/8/16 13557838
2/15/16 13701131
2/22/16 13812463
2/29/16 13971928
3/7/16 13837658
3/14/16 13550635
3/21/16 13022371
3/28/16 13507596
4/4/16 13456736
4/11/16 12992393
4/18/16 12831883
4/25/16 13262301
5/2/16 12831691
5/9/16 12808893
5/16/16 12726330
5/23/16 11893457
5/30/16 12434051
6/6/16 12363464
6/13/16 12077055
6/20/16 12107221
6/27/16 11986124
7/4/16 11997087
7/11/16 12264971
7/18/16 12164412
7/25/16 12438279
8/1/16 12733842
8/8/16 12543251
8/15/16 12627134
8/22/16 12480153
8/29/16 12276238
9/5/16 12443655
9/12/16 12497753
9/19/16 12279060
9/26/16 12549138
10/3/16 12308591
10/10/16 12416680
10/17/16 12516725
10/24/16 12326545
10/31/16 12772578
11/7/16 12524848
11/14/16 13429830
11/21/16 14188044
11/28/16 16611840
12/5/16 16476565
12/12/16 15659941
12/19/16 10785585
12/26/16 12150894
1/2/17 13436366
1/9/17 12985213
1/16/17 13097555
1/23/17 13204872
1/30/17 13786040
2/6/17 13760281
2/13/17 13295389
2/20/17 14734578
2/27/17 15043941
3/6/17 14821169
3/13/17 14361765
3/20/17 14300180
3/27/17 14357964
4/3/17 14271892
4/10/17 13248168
4/17/17 13813784
4/24/17 14092489
5/1/17 14100024
5/8/17 13378374
5/15/17 13225650
5/22/17 12582444
5/29/17 13267163
6/5/17 13026181
6/12/17 12747286
6/19/17 12707074
6/26/17 12534595
7/3/17 12546094
7/10/17 13030406
7/17/17 12950360
7/24/17 12814398
7/31/17 13405187
8/7/17 13277755
8/14/17 13142375
8/21/17 12742153
8/28/17 12610817
9/4/17 12267747
9/11/17 12570075
9/18/17 12704157
9/25/17 12835948
10/2/17 12851893
10/9/17 12978880
10/16/17 13104906
10/23/17 12754018
10/30/17 13213958
11/6/17 13584642
11/13/17 13963433
11/20/17 14471672
11/27/17 16312595
12/4/17 16630000
12/11/17 16443882
12/18/17 11555299
12/25/17 12018373
1/1/18 13031876
1/8/18 13013945
1/15/18 13164137
1/22/18 13313246
1/29/18 13652605
2/5/18 13803606
2/12/18 13308310
2/19/18 14466211
2/26/18 15092736
3/5/18 15346015
3/12/18 14467260
3/19/18 14767785
3/26/18 13914271
4/2/18 14185070
4/9/18 13851028
4/16/18 13605858
4/23/18 13597999
4/30/18 13876994
5/7/18 13026270
5/14/18 13113250
5/21/18 12288727
5/28/18 12925846
6/4/18 13525010
6/11/18 12594472
6/18/18 12654512
6/25/18 12888260
I was able to read the data without any errors before, initially, I had 160 records & the model does not throw any error but, then for 80-20 test I removed the last 30 records and this error cropped up. Now also, if I run with all the data I don't get any error but is I run it with first 130 as 80% I get this error.
when using auto.arima with seasonal = TRUE the parameter S is not calibrated but taken from the frequency of the ts object you are providing. So in your case S = 52.17.
In case the frequency of the time series is not and integer, S is rounded to next integer so auto.arima takes S = 52.
With S=52 and a data of length 150 it becomes difficult to calibrate a seasonal arima model: e.g if P = 2 and and all other variables are zero the first 104 observations cannot be used. I guess that is what the warning is about. You are being told that the seasonal component cannot be calibrated due to the large coefficient S (or due to your short data).
So either you get a longer data history, or you aggregate your data to monthly data (such that S = 12).

Error in inherits(f, "fitdist") : object 'fitw' not found

I am using R for modelling distributions with package fitdistrplus, I got a problem that
Error in inherits(f, "fitdist") : object 'fitw' not found.
Attached is the code I am using for modelling. does anyone know what is wrong with my code?
library(fitdistrplus)
timegaplist = c(133408000, 150828000, 175692000, 96000, 143000, 169000, 207000,
220000, 304000, 333000, 371000, 549000, 605000, 643000, 848000,
874000, 907000, 935000, 1054000, 1068000, 1481000, 2082000, 2440000,
2658000, 2836000, 3580000, 4138000, 4478000, 4536000, 4886000,
6238000, 6532000, 6609000, 6676000, 6886000, 7742000, 7931000,
8607000, 9186000, 9433000, 9575000, 9979000, 11139000, 13012000,
13099000, 13220000, 13660000, 13849000, 15585000, 16787000, 17591000,
18889000, 19169000, 19529000, 20863000, 22924000, 23463000, 24438000,
25203000, 25364000, 25557000, 27173000, 27436000, 28769000, 30435000,
31880000, 32342000, 33237000, 33497000, 34657000, 35227000, 35660000,
36641000, 37488000, 38384000, 38930000, 38950000, 39652000, 41143000,
44787000, 44979000, 45088000, 47357000, 52694000, 56774000, 59568000,
70066000, 73901000, 76181000, 78820000, 1875073000, 197330000,
197981000, 205765000, 216749000)
fitW = fitdist(timegaplist, "weibull",lower = c(0, 0))
gofw=gofstat(fitw)
wc=c(gofw$ks,gofw$kstest,gofw$aic,gofw$bic)
names(wc)=c("weibull.KS","weibull.KSTest","weibull.AIc","weibull.BIc")

Error when using cluster package to compute euclidean distances

I have been working on a text mining project. I have performed some LDA topic modelling and now I have my topic probabilities. I would like to use the cluster package so that I can get the euclidean distances between documents so I can create a network graph, but I keep on getting an error. Any recommendation for good visualisation techniques would also be warmly welcomed :)
library(cluster)
FundDist <- as.matrix(daisy(EUTopicNetworks, metric = "euclidean", stand = TRUE))
Error in daisy(EUTopicNetworks, metric = "euclidean", stand = TRUE) : invalid type character for column numbers 1
In addition: Warning messages:
1: In data.matrix(x) : NAs introduced by coercion
2: In daisy(EUTopicNetworks, metric = "euclidean", stand = TRUE) :
with mixed variables, metric "gower" is used automatically
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf
I have never uploaded reproducible data on this website using the dput() function before. So I hope I have done this correct. I have copied and pasted the output below. Thank you for taking the time to read my problem.
EUTopicNetworks <- structure(list(Filename = c("AT_Burenland_2007.txt", "AT21_Kaernten_07.txt",
"AT12_LowerAustria_07_13.txt", "AT_Nat_2007.txt", "AT34_Salzburg_07.txt",
"AT22_Steiermark_07.txt", "AT36_Tirol_07.txt", "UpperAustria2007.txt",
"AT13_Vienna_07.txt", "vorarlberg2007.txt", "AT_Austria_1.txt",
"AT11_Burgenland_1", "lowe austria 2014.txt", "AT13_Vienna2_14.txt",
"AT21_Kaernten_14.txt", "AT22_Steiermark_14.txt", "AT31_UpperAustria_14.txt",
"AT35_Salzburg_14.txt", "AT36_Tirol_14.txt", "AT37_Vorarlberg_14.txt",
"abbruzzo2007-2013.txt", "calabria2007-2013.txt", "campania2007-2013.txt",
"emiliaromagna2007-2013.txt", "sicily2007.txtt", "friuli2007-2013.txt",
"lazio2007-2013.txt", "liguria2007.txt", "lombardy2007-2013.txt",
"piemonte2007-2013.txt", "puglia2007-2013.txt", "sardinia2007-2013.txt",
"Bolzano_07.txt", "umbria 2007-2013.txt", "valledaosta 2007-2013.txt",
"tuscany2007.txt", "VENETO2007-2013.txt", "abruzzo2014-2020.txt",
"basilicata2014-2020.txt", "calabria2014-2020.txt", "campania2014-2020.txt",
"emiliaromagna2014-2020.txt", "sicily2014.txt", "friuli2014-2020.txt",
"lazio2014.txt", "liguria2014.txt", "lombardia2014-2020.txt",
"piemonte2014-2020.txt", "puglia_14.txt", "sardinia2014.txt",
"Bolzano_14.txt", "umbria2014.txt", "valledaosta 2014-2020.txt",
"tuscany2014.txt", "molise_14.txt", "molise_07.txt", "trento2007.txt",
"trento2014.txt", "ITALIANSTRATEGICPLAN2007-2013.txt", "italyinnovationstrategy2014-2020.txt",
"veneto2014-2020.txt", "aquitanie2014-2020.txt", "aquitanie2007.txt",
"auvergne2014-2020.txt", "auvergne_07.txt", "bretagne2014-2020.txt",
"bretagne_07.txt", "centre2014-2020.txt", "centre2007.txt", "champagne-ardenne 2007.txt",
"champagne-ardenne 2014.txt", "PICARDIE2007.txt", "picardie2014.txt",
"bassenormandie 2007.txt", "bassenormandie 2014.txt", "bourgogne2014.txt",
"bourgogne_07.txt", "midi-pyrenees2007.txt", "midipyrennes14.txt",
"franche-comte2014-2020.txt", "franche-comte_2007.txt", "hautenormandie2007.txt",
"hautenormandie2014-2020.txt", "limousine2014-2020.txt", "limousine2007.txt",
"loire2007.txt", "loire2014-2020.txt", "lorraine2014-2020.txt",
"lorraine2007.txt", "nordpasdecalais2007.txt", "nordpasdecalais2014-2020.txt",
"rhonealpes2014-2020.txt", "rhone-alpes2007.txt", "poitou-charenter2007.txt",
"poituou-charentes2014.txt", "corse2007.txt", "corsica.txt",
"bretagne_07.txt", "bretagne2014-2020.txt", "Baden-Wu_07.txt",
"Baden-wu14.txt", "bavaria2007.txt", "BAVARIA_14.txt", "BERLIN2014-2020.txt",
"Berlin_07.txt", "bradenburgh2014.txt", "Bradenburgh2007.txt",
"bremen2007.txt", "bremen2014.txt", "hamburg_07.txt", "HAMBURGO2014-2020.txt",
"Hessen_07.txt", "Hessian1.txt", "LowerSaxony2_07.txt", "LOWERSAXONY2014-2020.txt",
"Mecklenburg_07.txt", "MECKPOMM2014-2020.txt", "rheinland2014-2020.txt",
"RhinelanPlatz_07.txt", "saarland2014-2020.txt", "saarland_07.txt",
"sachsen-anhalt2014-2020.txt", "sachsen-anhelt2007.txt", "saxony_07.txt",
"saxony_14.txt", "Schleswig-Holstein2020.txt", "Schleswig-Holstein_07.txt",
"thuringia2007.txt", "THURINGIA2014-2020.txt", "Andalucia_2007-2013.txt",
"Andalusia_14.txt", "Aragon_14.txt", "Aragon_2007.txt", "Asturias_2007.txt",
"ES12_Asturias.txt", "Baleares_2007.txt", "Balears_14.txt", "Canarias_07.txt",
"Canaries_14.txt", "Cantabria_2007.txt", "ES13_Cantabria_14.txt",
"Castillala_Mancha_2007.txt", "ES42_Castilla-la_mancha.txt",
"CastillayLeon_dic_2007.txt", "ES41_Castilla-Leon.txt", "ES51_Catalonia_14.txt",
"catalonia2007.txt", "Madrid_2007-13.txt", "Madrid_14.txt", "Murcia_14.txt",
"murcia2007.txt", "Valencia_14.txt", "Valenciana_2007.txt", "laRioja2007.txt",
"CombiEngland_07.txt", "EastWales_07.txt", "NorthernIreland_07.txt",
"Scotland_07.txt", "WestWales_07.txt", "EastWales_14.txt", "England_14.txt",
"Northern_Ireland14.txt", "Scotland14.txt", "Westwales_14.txt",
"malta2007-2013.2.txt", "malta2014-2020.txt2.txt"), Funds = c(0.028649302,
0.036198106, 0.041060412, 0.036543709, 0.047044295, 0.01659907,
0.019221094, 0.056763265, 0.052615278, 0.045216842, 0.048176521,
0.038976137, 0.027341846, 0.037721688, 0.049252945, 0.05918185,
0.05440539, 0.017412537, 0.029307636, 0.022385126, 0.019737738,
0.027626844, 0.0334503, 0.043976555, 0.042856083, 0.021046234,
0.018061427, 0.014983543, 0.067145641, 0.019741648, 0.019018285,
0.030614714, 0.019666862, 0.028158874, 0.026009936, 0.019330949,
0.023088856, 0.044273539, 0.021168401, 0.017627883, 0.030486684,
0.017509486, 0.034035728, 0.034106673, 0.043486846, 0.029087254,
0.050564915, 0.047219925, 0.051437475, 0.029694445, 0.008588781,
0.045469371, 0.060967658, 0.049260664, 0.015106536, 0.026186649,
0.023254401, 0.053579943, 0.031056644, 0.045125396, 0.057680642,
0.01125217, 0.042532521, 0.041545015, 0.047940862, 0.036641552,
0.072252939, 0.035679102, 0.067488953, 0.008492444, 0.021052205,
0.020152732, 0.040564092, 0.02921307, 0.018565646, 0.022775302,
0.011711217, 0.019967731, 0.00877454, 0.022250866, 0.003696986,
0.011277284, 0.007740289, 0.02790784, 0.008134596, 0.014931457,
0.03269353, 0.041386999, 0.066164327, 0.011440048, 0.006215758,
0.010688796, 0.003811851, 0.003303556, 0.023094521, 0.010550119,
0.018023822, 0.022757839, 0.017667203, 0.02073341, 0.013537221,
0.011950717, 0.009010298, 0.019796088, 0.011314152, 0.01098032,
0.008832217, 0.040330019, 0.005822583, 0.006599734, 0.016338338,
0.013906508, 0.010973094, 0.010448791, 0.003723683, 0.013769165,
0.007583811, 0.009724543, 0.00237987, 0.005005899, 0.005048481,
0.013000829, 0.012671508, 0.003054379, 0.03508621, 0.012981055,
0.021982606, 0.009448894, 0.014883524, 0.018772709, 0.006068872,
0.018122102, 0.020449118, 0.015102835, 0.005449833, 0.011014679,
0.016602374, 0.006482356, 0.009969209, 0.002646448, 0.01205523,
0.04659564, 0.010866707, 0.0144986, 0.046946229, 0.028629168,
0.034634807, 0.059078927, 0.002919951, 0.016168915, 0.024403654,
0.09171777, 0.009978063, 0.015196456, 0.015174811, 0.047399696,
0.015303701, 0.011753077, 0.014862118, 0.01487099, 0.011742448,
0.018346786, 0.010785336, 0.010421162, 0.013791872, 0.026389358
), Biotech = c(0.024814541, 0.005668351, 0.017716491, 0.00853945,
0.015916015, 0.03888657, 0.001333459, 0.017368849, 0.023781704,
0.051278428, 0.005484117, 0.021759003, 0.027973849, 0.002774256,
0.005744201, 0.004244159, 0.00468969, 0.000581776, 0.022734494,
0.03445351, 0.000800523, 0.000362683, 0.026945766, 0.006823146,
0.005847249, 0.000630851, 0.020794353, 0.035979974, 0.006165474,
0.027793267, 0.00504312, 0.018927097, 0.000760576, 0.012289583,
0.002109001, 0.000442817, 0.000594334, 0.00037428, 0.06596126,
0.027988907, 0.019067461, 0.024872467, 0.015379713, 0.015295277,
9.36e-05, 0.000117979, 4e-05, 0.031220784, 0.001357913, 0.040951957,
0.000438858, 0.038880733, 0.00115553, 0.041152387, 0.042576251,
0.002254845, 0.022345729, 0.002596388, 0.022562024, 0.000243528,
0.000885187, 0.013339204, 0.001418329, 0.028089687, 0.002057198,
0.000244579, 0.000140129, 0.051721762, 0.014989271, 0.001673642,
0.04500578, 0.001615416, 0.00010688, 8.18e-05, 0.000526549, 0.024849247,
0.032961749, 0.033875354, 0.032145136, 0.012619383, 0.003522134,
0.012225185, 0.043464039, 0.077400519, 0.056308327, 0.020638077,
0.049992043, 0.038864222, 0.039459316, 0.034937031, 0.037406742,
0.029987413, 0.002413193, 0.000584526, 0.004584848, 0.012491496,
0.031710331, 0.017858395, 0.030812232, 0.003435739, 0.02648106,
0.006927007, 0.030785802, 0.044329986, 0.009838859, 0.002951219,
0.030722621, 0.020511401, 0.013623405, 0.081263322, 0.029623712,
0.003790876, 0.00335598, 0.018842609, 0.008430911, 0.032611226,
0.057455638, 0.004304486, 0.015733474, 0.043981231, 7.95e-05,
0.004054158, 0.045173701, 0.016378658, 0.015906368, 2.92e-05,
0.00057313, 0.00079682, 0.013209159, 0.039911915, 0.000237856,
0.022373161, 0.015821272, 0.026750309, 0.048698356, 0.041430357,
0.00287091, 0.007965338, 0.034481633, 0.001543219, 0.022152119,
0.041801127, 0.017463336, 0.038010604, 0.050393079, 0.045031199,
0.043613378, 0.037411148, 0.00186188, 0.018962051, 0.043254408,
0.018666636, 0.027696462, 0.024293257, 0.062711642, 0.000519461,
0.001056595, 0.031300324, 0.024742217, 0.024718682, 0.000780182,
0.01862668, 0.000973041, 0.000542227, 0.001011475, 0.011077226
), Transfers = c(0.00473547, 0.00038783, 0.000424567, 0.000695775,
0.000135175, 0.010334213, 0.000106781, 0.003008423, 0.000608193,
0.010326284, 0.000934925, 0.031277279, 0.00572826, 0.000260722,
0.001021529, 0.000154104, 0.000220061, 4.32e-05, 0.018335222,
0.013011634, 2.49e-05, 4.83e-05, 0.021935677, 0.000390414, 0.000130749,
3.77e-05, 0.009460382, 0.146681735, 7.44e-05, 0.082389135, 0.000592343,
0.000562132, 1.53e-05, 0.020403948, 1.31e-05, 2.46e-05, 5.51e-05,
0.000321357, 0.037377138, 0.006516009, 0.022055996, 0.041838049,
0.002549792, 0.00271147, 8.55e-05, 0.001550897, 0.001094715,
0.002059784, 2.73e-05, 0.012813067, 9.84e-06, 0.009924993, 8.74e-05,
0.004619721, 0.013069859, 2.14e-05, 0.053722696, 5.79e-05, 0.006753522,
1.18e-05, 0.005116721, 0.000108002, 2.73e-05, 0.003596542, 2.79e-05,
0.00438903, 8.31e-05, 0.026310482, 0.001005592, 0.000428282,
0.049529581, 1.93e-05, 8.57e-05, 0.001610554, 9.92e-06, 0.094923027,
0.031919217, 0.13955002, 0.083229087, 0.000284159, 0.000267466,
0.000349366, 0.056697448, 0.049064161, 0.075636951, 0.004204928,
0.006115066, 0.007264789, 0.002044115, 0.043477142, 0.046506897,
0.082070827, 0.00035585, 0.010126049, 0.000178782, 0.000133394,
0.019258021, 9.19e-05, 0.069771158, 0.164961859, 0.030302868,
0.008376654, 0.095394069, 0.069931231, 0.000553351, 0.000544636,
0.095332857, 0.001748097, 0.000288915, 0.049584358, 0.095331287,
0.000598831, 0.001574565, 0.124263691, 3.34e-05, 0.107925558,
0.087354139, 0.000618826, 0.000110399, 0.035831715, 5.52e-06,
0.003000538, 0.076722556, 0.001625612, 0.00057855, 2.15e-05,
6.78e-05, 0.000268523, 0.000567245, 0.04113056, 1.71e-05, 0.03401376,
0.001848523, 0.029357767, 0.078771496, 0.05552954, 0.068487283,
0.001617493, 0.045003856, 0.000170027, 0.102169304, 0.033286348,
0.000645582, 0.123061518, 0.024437451, 0.002628661, 0.013120533,
0.002000205, 0.000545963, 0.103891281, 0.01547252, 0.004918401,
0.032767954, 0.084638687, 0.093356166, 0.000156201, 0.000752217,
0.109659324, 0.208642497, 0.208474925, 0.000404265, 0.078084401,
0.000538784, 0.012066067, 0.018067282, 0.000205862), Collab = c(0.030001488,
0.036707564, 0.01458121, 0.026231048, 0.018525526, 0.011553297,
0.058634057, 0.001686141, 0.001348074, 0.006757227, 0.013508918,
0.003715637, 0.002921306, 0.009278328, 0.004626478, 0.002879119,
0.055770088, 0.095661212, 0.017193222, 0.004260887, 0.0994825,
0.094794299, 0.00236101, 0.05708391, 0.070789976, 0.093534164,
0.001109712, 0.009766358, 0.033402635, 0.011669702, 0.06682796,
0.001608723, 0.076258585, 0.0177607, 0.081032098, 0.094412392,
0.105163053, 0.000130001, 0.000308904, 0.000673957, 0.000108183,
0.006185235, 0.001417778, 0.001392482, 0.001763266, 4.19e-05,
0.000316372, 0.000538187, 0.057255911, 0.000888558, 0.117687659,
0.002003037, 0.068194122, 0.000653657, 0.000152612, 0.089555908,
0.002829031, 0.032391752, 0.000114824, 0.001213285, 0.000386851,
0.015705495, 0.049863754, 0.000186015, 0.036288112, 0.000121075,
0.001514642, 0.00150885, 0.000594681, 0.139375952, 0.002323917,
0.075647519, 0.002870689, 3.77e-05, 0.077144908, 0.026437255,
0.000115174, 0.00227099, 0.004700389, 0.041492391, 0.122675327,
0.020817113, 6.89e-05, 0.000303617, 0.000137477, 0.001432608,
0.000184365, 0.001050974, 0.000709209, 0.000270104, 0.000303001,
0.018320147, 0.099247105, 0.082998488, 0.000888759, 0.016183068,
0.006294048, 0.002853816, 0.019514895, 0.038458183, 0.002923949,
0.106293548, 0.011739459, 0.000128574, 0.007004556, 0.114129525,
0.012154148, 0.00942754, 0.009594396, 1.79e-05, 0.003734627,
8.05e-06, 0.119908919, 0.018081544, 0.075305864, 0.008538072,
0.000172614, 0.011539718, 0.001156176, 2.3e-05, 0.06492041, 0.12754611,
0.00024379, 0.006267908, 0.00306844, 0.001193837, 0.013286424,
0.113241894, 0.00550093, 0.000513184, 0.164987722, 0.008430982,
0.01127053, 0.00073653, 0.000330426, 0.002238095, 0.104762755,
0.010050252, 0.000469937, 0.145991698, 0.016278919, 0.000640692,
0.005282822, 0.005445685, 0.00014593, 0.000589578, 0.003085291,
0.003763146, 0.118843056, 0.019891671, 0.007112815, 0.004553507,
0.014161345, 0.011043344, 1.65e-05, 0.05419503, 0.107074967,
0.01952576, 0.015831838, 0.015618949, 0.133629759, 0.016718132,
0.120940954, 0.072855599, 0.066799617, 0.006925232)), .Names = c("Filename",
"Funds", "Biotech", "Transfers", "Collab"), class = "data.frame", row.names = c(NA,
-166L))
As #Cath mentioned, your problem is with the column of text. Removing this works:
EUTopicNetworks2 <- EUTopicNetworks[,-1]
class(EUTopicNetworks2)
library(cluster)
FundDist <- as.matrix(daisy(EUTopicNetworks2, metric = "euclidean", stand = TRUE))
By running this code I was able to answer the question I posed in one of the comments
row.names(EUTopicNetworks) <- EUTopicNetworks[,1]
EUTopicNetworks <- EUTopicNetworks[,-1]
library(cluster)
FundDist <- as.matrix(daisy(EUTopicNetworks, metric = "euclidean", stand = TRUE))

Is there an 11 digits limit for time series numbers in x12 for R?

I am trying to use the x12 function in the x12 package for R.
My problem is, when using time series object (tso) with monthly data and each observation is a large number (11 or more digits), the function is making a spec file which x12a.exe (binaries) can not read.
x12 binaries does not allow the spec file to be wider then 132 column.
In my example, the spec file have 144 columns, which I believe give me this error message in R:"ERROR: Input record longer than limit : 133".
When I am using smaller numbers (fewer columns) in the spec file, there are no problem so far. When creating the spec file on my own, when using x12-arima for windows, I have never seen the problem before, because I always use the "free" format (one observation per line) for the series in x12-arima.
My question is: How do I make the format for the time series object = "free", or some how just one observation per line, in the "Rout.spc" file, while using x12 function in the x12 package for R?
I am using R version 2.15.2 and R-studio version 0.97.318
Attached is my example code in R-studio, output in R-console, and the spec file
"Rstudio"
library(x12)
alt <- read.csv2("alt.csv",header=T)
tal <- ts(data=alt,start=c(1995,4),freq=12)
x12path <- shortPathName("C:\\Dokumenter\\X_12_Arima_Program\\x12a\\x12a.exe")
x12tal <- x12(tso=tal,automdl=T,x12path=x12path,period=12,trendma=23)
"Console"
C:\Dokumenter\Eksperimentering\x12>md gra
C:\Dokumenter\Eksperimentering\x12>C:\DOKUME~1\X_12_A~2\x12a\x12a.exe Rout -g gra
X-12-ARIMA Seasonal Adjustment Program
Version Number 0.3 Build 192
Execution began Mar 12, 2013 23.46.25
Reading input spec file from Rout.spc
Storing any program output into Rout.out
Storing any program error messages into Rout.err
ERROR: Input record longer than limit : 133
Line 6: start=1995.4
^
ERROR: Expected an real number not "111"
Program error(s) halt execution for Rout.spc
Check error file Rout.err
Error messages generated from processing the X-12-ARIMA spec file
Rout.spc:
Error in readx12Out(file, freq_series = frequency(tso), start_series = start(tso), :
Error! No proper run of x12! Check your parameter settings.
"The spec file: Rout.spc"
series{
title="R Output for X12a"
decimals=2
start=1995.4
period=12
data=(
14056669449 12785389868 12772341230 12342935128 12081332395 12110109950 12367542268 12911930417 12836340370 12214486074 12057940408 11555540809
10002847699 9199284760 8704422249 8492914782 8507816348 8470254675 8665139772 8653204621 9177471163 9676069791 9483990311 9825510541
7613345714 7168896536 7527318694 7721174940 7584049271 7586159794 7411383039 7565724342 7555103032 7148551906 7792379395 7493885451
6636374143 6390731897 6160711917 6003196233 5955867663 5868369296 5858314348 6098506333 6297774946 6074680955 6132163345 5875098456
5198306672 4891946405 4875765641 4834436461 4835096514 4804664875 4684550404 4733459404 5056773308 4912329843 5080643820 4568733581
4286693348 3898776528 3872776341 3842469172 3756957390 3782676505 3924066331 3810475969 3943259720 3665136687 3962811976 3449264257
3120637669 2813261665 2692920289 2652153941 2557247524 2658115616 2777287302 2688976703 2712004412 2596430893 2520548046 2455531008
2429263753 2187017586 2181610529 2139024441 2008850781 2049874584 2110715482 2218937956 2565352715 2635375627 2598584163 2435211675
2433625715 2350144562 2298764466 2242464445 2288528533 2532374821 2696862060 2877128057 3086285374 3309497319 3684989376 3709283880
3483967873 3294407926 3465439983 3546006197 3526166213 3625899404 3774201496 3941610691 4325836434 4466576126 4115121591 4036118609
3824882119 3552896925 3649624960 3570454122 3622089655 3662984491 3601306018 3604389348 3620162022 3401732239 3158217491 2896252892
2800864675 2630474256 2668229303 2631120097 2343131082 2163910930 2108285015 2067601541 2099699134 1803097392 1742652674 1626660618
1560369744 1448264771 1419659828 1547101381 1310783818 1358686467 1300281852 1315247637 1380387680 1286158497 1329769957 1272124521
1185603967 1125238745 1217223861 1265616553 1222054134 1279497332 1499392605 1810208712 2314301847 2908395453 3388479445 3441615991
3432688695 3691000321 3891303059 4111250935 4258776704 4586315450 5050122946 5156728599 5550332779 5769588984 5943764465 6032516246
5765718572 5521116586 5498458566 5374456514 5130561755 5219814632 5542173962 6883624616 7744043244 7913799960 7416210299 7127265644
6790509897 6562709494 6390985216 6126897801 5855125688 6259675447 6439114484 6634617502 6771498442 6674343925 6295709586 5890916431
5545655270 5315444742 5205711894 5115065476 4648229650 4724377012 4816989052 5049928441 5041395923
)
}
transform{
function=auto
}
automdl {
maxorder=(3,2)
maxdiff=(1,1)
balanced=yes
savelog=(adf amd b5m mu)
}
forecast {
}
x11{
sigmalim=(1.5,2.5)
trendma=23
excludefcst=yes
final=(user)
appendfcst=yes
savelog=all
}

Resources