andrea-luciani / bimets Goto Github PK
View Code? Open in Web Editor NEWTime Series And Econometric Modeling In R
Time Series And Econometric Modeling In R
I have a question about bimets::TSEXTEND() function. Even if I changed EXTMODE, say “CONSTANT” to “MEAN4”, “QUADRATIC”, “GROWTH4”, and so on, the extended values of the variable under the consideration do not change at all. I wonder whether EXTEND() function works properly or not.
I got the pictures of the forecast shown in p. 25 in the bimets manual. I also got the pictures of the stochastic forecast shown in p. 175 in the bimets manual. For these several days, I have learned much about “bimets” by the duplication of the tasks shown in the bimets manual.
Using my data set, I got the picture of the "in-sample" forecast. My next step is the "out-sample" forecast. For the out-sample forecast, I tried to extend the time series of exogenous variables, using TSEXTEND() function. The outputs of TSEXTEND() function do not change at all, as already explained.
Attached are:
(1) test_TSEXTEND.pdf --- The pdf file of my R script for testing EXTEND() function.
(2) data_ISLM.cvs – This data set was sent to you when I got the first question one week ago or so.
(3) test_results_EXTEND.txt --- It shows the results of my test with the above R script.
Could you check what is the problem in my R script? Thank you for your time.
Hiroshi Murao
P.S. I realized that TSEXTEND() function changes the previous values created by the function if we run the whole R script again. That is, it is the idea of running the whole R script again, not running TSEXTEND () function again.
My question was solved. Sorry for my confusion.
The following is a comment for TSEXTEND() function.
It would be nice if we could see how TSEXTEND() function would change the values just after the execution of TSEXTEND() function. Checking the values just after the execution of TSEXTEND() function, we can immediately decide whether our optional choice for EXTMODE is appropriate or not. I am setting the extension values of government spending in an IS-LM model. Even if TSEXTEND() function generates “negative” values to government spending, I cannot check such outcomes immediately.
text_TSEXTEND.pdf
test_results_EXTEND_function.txt
data_ISLM.csv
Dear Andrea,
I was wondering if there is a straightforward way to recover the estimation residuals for data points outside the estimation sample?
MyModel$behaviorals[[var]]$residuals only covers the estimation period and using MyModel$modelData[[var]]-MyModel$simulation[[var]] after a RESCHECK type simulation works nicely for equations estimated in levels, but does not produce the equation residual for a transformed variable on the LHS. I am aware that I could introduce helper equations in the model, but that doesn't seem very robust/flexible/transparent.
My usecase to clarify: Im working on a medium scale forecasting and simulation model of the German economy and want to estimate some of my equations for a reduced time period (e.g. up to 2019, to leave out the COVID period). However, it would still be useful to have residuals up to the current margin of the data (up to 2023), both to check the quality of the estimation and - mainly - for the adjustment of the add factors from 2024 onwards.
I could use a modified version of your code to build the main X matrix with an extended sample, but I was wondering if I am missing a simple way to solve my problem based on core BIMETS functions.
Thank you for suggestions
Ferdinand
I have a question. How do we read the regular data set, say the data set of csv format, into a data set such that bimets works properly?
Suppose that we have 30 variables and each variable 100 observations.
We don't want to use TIMESERIES() function to load the data set to bimets.
If we use TIMESERIES() function, then the task of writing codes will never end.
This kind of task is very basic. But, the manual of bimets does not show it.
The manual shows only the use of TIMESERIES() function.
Could you show me how to read the data set into bimets?
Please also write the task on the manual of bimets.
TSLEAD seems to be not recognized by LOAD_MODEL.
modelo_alimentos <- "
MODEL
EQUATION> ipca_alimentos
EQ> ipca_alimentos = c1*TSDELTA(TSLAG(ipca)) +
c2*TSDELTA(TSLEAD(expectativas_ipca)) +
c3*(TSLAG(crbreais_var_anual)) +
c4*MOVAVG(TSLAG(hiato), 2) +
c5*temperatura^2
COEFF> c1 c2 c3 c4 c5
RESTRICT> c1 + c2 + c3 = 1
END
"
modelo_alimentos <- LOAD_MODEL(modelText = modelo_alimentos)
Error in LOAD_MODEL(modelText = modelo_alimentos) :
LOAD_MODEL(): unsupported functions in EQ definition: "ipca_alimentos=c1*TSDELTA(TSLAG(ipca))+c2*TSDELTA(TSLEAD(expectativas_ipca))+c3*(TSLAG(crbreais_var_anual))+c4*MOVAVG(TSLAG(hiato),2)+c5*temperatura^2+c6*d2002q4+c7*d2008q2+c8*d2013q1+c9*d2010q4+c10*d2007q3" in behavioral "ipca_alimentos": TSLEAD()
Hey Andrea
thank you for creating this awesome package, which I am just starting to use.
I have an issue (more a feature request, to be honest): The incidence matrix accessible through MyModel$incidence_matrix only includes the (contemporary) links between the endogenous variables. While this is obviously what you need for solving the model, it is not sufficient to create a network graph of the model like the one you have in the documentation, which also includes exogenous variables and intertemporal linkages.
I would find it interesting if you could additionally include this "full incidence matrix" as an output of the LOAD_MODEL function. This could then be used to creatin the full graph of the model, e.g. by using it as an argument in the "graph_from_adjacency_matrix" function of the igraph package (which expects the incidence matrix in transposed form compared to the version created by LOAD_MODEL, but that's obviously not a big deal).
Do you think this is something that could be included without too much work? It would be an attractive feature from my point of view. But anyhow: The package is great and looks very useful to me!
Best regards
Ferdinand FIchtner
Problem description:
I found an R code using
COMMENT> ...
BEHAVIORAL> ...
TSRANGE ...
EQ >
COEFF>
STORE > coe(3)
however, I did not find this STORE command anywhere in the documentation, unfortunately.
I am R beginner so maybe I am just confused by something that is no issue for experienced developers...
Potential solution: simply add it in the description vignette document.
Hi, @andrea-luciani
Thank you for replying the question about the output.
If this is not the appropriate forum for these kind of questions, I am open to moving it to the correct place.
I can use TS functions, like this fashion TSLAG(1 + some var). However, it's not possible to make this transformation using the LOG function, or even use it along with TABIT. That is, LOG(1 + some var) inside a model or TABIT(LOG(some var)), returns an error. The same occurs with the EXP function.
Those would be interisting features.
SIMULATE(): exogenous variable "TAX" is not fully defined in the TSRANGE. There are undefined values at year-period 2024-4
My questions or requests are as follows.
(1) Please make a new option for TSEXTEND() function such that it extends the data of seasonal dummy variables.
(2) I would like to know how to solve the current problem.
My R script, its log file, and the data are attached for the concrete information of problem.
Thanks
forecast_out_sample_ISLM.TXT
data_ISLM.csv
record_20024-03-14.txt
I am currently with a model with about 29 variables. Currently I have to create one bimet object for each variable in order to use them on a model. Each of these variable have the same arguments, so it makes the code longer than it needs to be.
This issue might be solved (or improved) if there were a way that I could convert a data frame into a bimets object.
Is it possible to create a bimets data frame?
Congratulations for the great package you have developed.
Is it possible to print (again) the estimate output without reestimating the model?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.