Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in apply(y, 1L, rank) : dim(X) must have a positive length #4

Open
samyoung0424 opened this issue Jan 16, 2019 · 3 comments
Open

Comments

@samyoung0424
Copy link

It seems that if your ts object doesn't populated at the very beginning of your time, the error Error in apply(y, 1L, rank) : dim(X) must have a positive length will be thrown.

like this:

testdata <- ts(data = as.vector(mydata$V4), start = c(2016,3), frequency = 12)
fit <- mlp(testdata)
Error in apply(y, 1L, rank) : dim(X) must have a positive length
@trnnick
Copy link
Owner

trnnick commented Jan 17, 2019

When you say it is not populated, do you mean it has NAs?

@senatorcasey
Copy link

I'm getting the same error, but I don't know if it's for the same reason. Here's my time series:
`

ts027016
Time Series:
Start = c(2017, 5)
End = c(2019, 7)
Frequency = 52
[1] 2 5 3 6 3 2 0 0 2 3 1 2 2 2 5 2 1 2 2 3 4 0 2 1 4 1 1
[28] 0 0 1 2 0 0 1 1 1 1 1 1 1 5 2 3 1 0 3 3 0 0 0 8 2 0 0
[55] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 2
[82] 1 0 3 0 1 2 3 5 1 2 4 2 0 0 0 0 0 0 0 0 12 2 6 4 2 1
mlp(ts027016)
Error in apply(y, 1L, rank) : dim(X) must have a positive length`

It seems to work fine for this time series:
`

ts038178
Time Series:
Start = c(2014, 22)
End = c(2019, 10)
Frequency = 52
[1] 1 2 2 2 0 0 3 2 8 5 11 1 7 4 4 8 2 5 4 3 2 2 2 4 3 1 3
[28] 4 3 4 5 1 2 4 2 4 1 3 2 3 2 6 3 2 1 4 4 5 1 6 2 3 4 3
[55] 7 7 4 6 5 3 9 9 8 9 10 8 11 5 3 4 5 2 2 3 5 5 6 10 7 8 6
[82] 2 8 6 6 8 7 5 5 3 4 4 4 6 4 3 3 4 4 4 7 6 10 14 6 7 11 14
[109] 13 9 21 14 18 18 9 16 19 14 6 17 13 7 10 8 5 10 5 10 9 5 7 5 10 7 0
[136] 6 4 8 10 11 19 9 8 5 8 11 13 10 6 14 13 4 15 17 18 10 14 12 10 14 22 22
[163] 17 28 27 11 22 26 15 18 16 19 14 9 10 5 8 10 7 6 7 7 10 6 10 13 10 10 12
[190] 9 5 14 11 8 11 13 5 6 10 9 7 8 11 9 10 10 12 8 12 9 13 14 14 12 25 15
[217] 23 14 28 14 19 18 8 21 14 18 9 6 10 19 7 4 15 13 2 3 6 6 15 13 7 14 13
[244] 15 11 7 12 1 7
mlp(ts038178)
MLP fit with 5 hidden nodes and 20 repetitions.
Series modelled in differences: D1D52.
Univariate lags: (1,2,3,4,5,6,11,12,14,16,20,22,24,26,39,44,45,47,48,52)
Forecast combined using the median operator.
MSE: 0.1165.
`

There isn't anything outstandingly irregular about the first time series, is there? Sorry, I'm new to this. Let me know if there's any more info I can offer to help, or if I'm using it wrong.
Kevin

@tschijvenaars
Copy link

tschijvenaars commented Nov 25, 2020

I had the same problem. I tried everything, but I think it is a faulty implementation of the mlp() and elm() functions when they use msts. When using a normal ts, I can specify 'start' as c(yyyy,dd), but when I tried the same for msts, I got this error. When I switched to year only (start=1996) I got no more error. Please look into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants