Comments (15)
Maybe a new optional argument could be added to indicate what series each regressor corresponds to, and if not given, xreg
is applied to all series.
I'm thinking along the lines of how the gts
object is created. Either a list with entries for each regressor and the series/groups it corresponds to, or an indicator matrix of size n-series x m-regressors.
That way xreg
would just be a single large matrix, and specific columns can be assigned to any given (and possibly multiple) series, including at different levels like in the question above.
If, say, using an indicator matrix, 1 and 3 would be the default when NULL, 2 would just be a diagonal matrix, and a denser one could address 4.
from hts.
This is trickier than I thought. There are several possibilities:
- The same vector regressor is applied to all series.
- A different vector regression is applied to each series.
- The same matrix regressor is applied to all series.
- A different matrix regressor is applied to each series.
The old code handled 1. The new code handles 1 & 2. It should be easy to
handle 3, but if the number of regressors is the same as the number of
series, then it will not be obvious whether 2 or 3 is required. For 4, we
would need an array argument.
Any ideas how to make the interface simple while handling all 4 cases?
Rob J Hyndman
www.robjhyndman.com
On Thu, Jul 17, 2014 at 5:05 PM, Earo Wang [email protected] wrote:
—
Reply to this email directly or view it on GitHub
#6 (comment).
from hts.
Could we use lists to handle the case where a different matrix or vector should be applied to each level? A list of length equal to the number of levels could contain a vector or matrix to apply to the series in the same column position in the hts/gts. If the xreg/newxreg is a vector or matrix, that vector/matrix would be applied to every level of the series.
from hts.
Hi,
Is there a workaround for this issue? If yes, could you please point me to it?
I am trying to forecast demand across a geographical hierarchy (Cities, States, Countries). I am using external regressors like temperature, humidity etc. which assume different values for different cities. Hence, I need to pass a matrix of external regressors for each bottom node of the hierarchy.
Also, how can we aggregate external regressors from one hierarchy level to another (eg. Cities to States)? Sometimes we would need to take their sum, and sometimes average.
I apologize if this is the wrong forum to ask this question. If a similar topic exists in another forum, please point me to it.
Any help would be appreciated.
Thanks
from hts.
You currently have to create your own forecasts in a loop and then use combinef()
from hts.
See the example for combinef()
. Your groups matrix should not have the same number of columns as the forecast matrix.
from hts.
a matrix can be passed to xreg
and newxreg
now
htseg2x <- matrix(rnorm(16*17),nrow=16,ncol=17)
htseg2nx <- matrix(rnorm(10*17),nrow=10,ncol=17)
forecast(htseg2 , h=10, fmethod="arima", xreg=htseg2x, newxreg = htseg2nx)
from hts.
I am using the hts
package for a project and I thought that if I provided a matrix regressor I would be in case 3. So Am I using the package incorrectly?
from hts.
@robjhyndman : thanks for amazing package, Can anyone help me on how to pass "different matrix regressor is applied to each series." ? or is this still not supported with the current version of the package ?
Thanks a ton !
from hts.
@robjhyndman , thanks for your response, I will try the following steps, please let me know if I am missing anything.
-
I will need to create series at the least granular level and create a
gmatrix
accordingly. -
But the forecast will be made at individual series for all levels using respective
xreg
andnewxreg
matrix in for loop. -
Create
fcasts
matrix and usecombinef()
to get optimal forecasts at all levels.
Thanks,
Sagar
from hts.
Hi @robjhyndman ,
I have tried combinef()
as directed.
Generated the individual forecasts and executed the following.
combinef(as.matrix(REV_FORECAST),keep="gts",groups=gps,algorithms = "lu")
and got this error.
Error: Argument fcasts requires all the forecasts.
I believe I have all the forecast avaialble as per the group object that i created. Could you please let me how can i fix this issue.
dim(gps)
[1] 3 8764
dim(REV_FORECAST)
[1] 8 8764
Thanks,
Sagar
from hts.
I generated forecasts separately at lowest level granularity. do i need to manually create forecasts for interactions between groups as well ?
- For example:
I have 7 unique values in group1, 1252 in group2 and created 8764 (1252*7) forecasts
and now trying group them usingcombinef()
.
with your comment, I understand that I need to create additional forecasts
- 1 at top level (aggregating all the series together)
- 1252 (at group 2 level) &
- 7(at group 1 level)).
But when I execute forecast using:
gps <- rbind( rep(1:1252,each=7), # group 1 rep(1:7,each=1252), # group 2 rep(1:(1252*7),each=1) # group 1 X group 2 )
Followed by :
gy <- gts(y, groups=gps)
and
print gy
Grouped Time Series 5 Levels Number of groups at each level: 1 1252 7 1252 8764 Total number of series: 11276 Number of observations per series: 28
1 (top level) 1252 (aggregate by group1) 7 (aggregate by group2) 1252 (what are these series? ) 8764(series at combination of group1 and 2 )
At what level I should generate the other 1252 forecast and in what order should arrange before passing the forecast matrix to combinef()
.
Sorry If I missing anything here, thanks a lot for your time.
from hts.
Can anyone provide me insight on how to generate individual forecasts and use by combinef()
to get optimal forecast considering there groups present in data.
from hts.
@robjhyndman,
I figured out the issue, I created groups
object that does not align with my setup. Thank you !
from hts.
This is trickier than I thought. There are several possibilities:
- The same vector regressor is applied to all series.
- A different vector regression is applied to each series.
- The same matrix regressor is applied to all series.
- A different matrix regressor is applied to each series.
The old code handled 1. The new code handles 1 & 2. It should be easy to
handle 3, but if the number of regressors is the same as the number of
series, then it will not be obvious whether 2 or 3 is required. For 4, we
would need an array argument.Any ideas how to make the interface simple while handling all 4 cases?
Rob J Hyndman
www.robjhyndman.comOn Thu, Jul 17, 2014 at 5:05 PM, Earo Wang [email protected] wrote:
Closed #6 #6.
—
Reply to this email directly or view it on GitHub
#6 (comment).
Hi There,
Thanks for Amazing package.
any updates on 4th point ?
from hts.
Related Issues (20)
- Extension of createNotes() to work with levels specified by seperators HOT 6
- combinef return
- MinT: Error in if (!is.symmetric.matrix(x)) stop("argument x is not a symmetric matrix") : missing value where TRUE/FALSE needed HOT 1
- MinT needs covariance matrix to be positive definite. HOT 9
- parallel doesnt work on custom functions HOT 2
- Implement Hyndman's fix for non conforming forecast
- Issue with gts
- Error in install.packages : cannot open the connection HOT 1
- Predictions are always flat? HOT 8
- Interop with tidyverts HOT 6
- Warning message if constant columns are passed to MinT
- Getting fitted and residual values when using comb nonnegative method
- How to work on a single level hierarchy?
- hts cannot create a hierarchical time series for a single observation HOT 1
- A typo in the code causes error when calling forecast.gts() with nonnegative=T parameter HOT 1
- Missing nodes (time-series) in hierarchy: combinef reconciliation function error HOT 2
- combinef function to constrain bottom level predictions with external predictions in gts
- Sample covariance calculation HOT 2
- Failed to install 'hts' due to RcppEigen.h
- forecast.gts argument conflicts with auto.arima via ... HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hts.