Berend Hasselman
2017-Jul-13 08:52 UTC
[R] Question on Simultaneous Equations & Forecasting
Frances, I would not advise Gauss-Seidel for non linear models. Can be quite tricky, slow and diverge. You can write your model as a non linear system of equations and use one of the nonlinear solvers. See the section "Root Finding" in the task view NumericalMathematics suggesting three packages (BB, nleqslv and ktsolve). These package are certainly able to handle medium sized models. (https://cran.r-project.org/web/views/NumericalMathematics.html) Write a function with the system of equations with each equation written as y[..] <- lefthandside - (righthandside) You can then include identities naturally. You would have to make the model dynamic but that shouldn't be too difficult using vector indexing. Berend Hasselman> On 13 Jul 2017, at 10:06, Pfaff, Bernhard Dr. <Bernhard_Pfaff at fra.invesco.com> wrote: > > Hi Frances, > > I have not touched the system.fit package for quite some time, but to solve your problem the following two pointers might be helpful: > > 1) Recast your model in the revised form, i.e., include your identity directly into your reaction functions, if possible. > 2) For solving your model, you can employ the Gau?-Seidel method (see https://en.wikipedia.org/wiki/Gauss%E2%80%93Seidel_method). > This has not only the advantage of generating forecasts, in terms of your exogenous variables, but you can also compute 'dynamic ex post' forecasts. This is probably the most powerful testing for dynamic simultaneous equation systems, given that you provide only your predetermined variables as starting values and then apply the Gauss-Seidel method (recursively) in-sample. The progressions of your endogenous variables should then not depart too much from your observed in-sample endogenous variables, i.e., you are assessing the stability of your model. Because forecast-errors cumulate over time in a dynamic ex-post forecast, this is a rather good and stringent model-test. > > Incidentally, when you use simultaneous equation models on a larger scale (say, between 200-300 equations, like medium-sized macroeconomic models), the only route to go for, is by estimating your reaction equations separately and then putting all your pieces - including identities and/or technical equations - together in a format suitable for applying the Gauss-Seidel method. Hence, forget about 2SLS or 3SLS and Haavelmo-bias. > > Best wishes, > Bernhard > > -----Urspr?ngliche Nachricht----- > Von: R-help [mailto:r-help-bounces at r-project.org] Im Auftrag von OseiBonsu, Frances > Gesendet: Mittwoch, 12. Juli 2017 22:36 > An: r-help at r-project.org > Betreff: [EXT] [R] Question on Simultaneous Equations & Forecasting > > Hello, > > I have estimated a simultaneous equation model (similar to Klein's model) in R using the system.fit package. > > I have an identity equation, along with three other equations. Do you know how to explicitly identify the identity equation in R? > > I am also trying to forecast the dependent variables in the simultaneous equation model, while incorporating the identity equation in the forecasts. Is there a way to do this in R? > > The only way that I have been able to forecast the dependent variables has been by getting the predictions of each variable, converting them to time series uni-variables, and forecasting each variable individually. > > Any help would be appreciated. > > Best Regards, > > Frances Osei-Bonsu > Summer Analyst, Research and Strategy > LaSalle Investment Management > 333 West Wacker Drive, Suite 2300, Chicago IL 60606 Email frances.oseibonsu at lasalle.com<mailto:frances.oseibonsu at lasalle.com> > Tel +1 312 897 4024 > lasalle.com<http://www.lasalle.com/> > > > > This email is for the use of the intended recipient(s) only. If you have received this email in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not keep, use, disclose, copy or distribute this email without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. The information contained in this communication may be confidential and may be subject to the attorney-client privilege. If you are the intended recipient and you do not wish to receive similar electronic messages from us in the future then please respond to the sender to this effect. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ***************************************************************** > Confidentiality Note: The information contained in this ...{{dropped:10}} > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Pfaff, Bernhard Dr.
2017-Jul-13 10:55 UTC
[R] Question on Simultaneous Equations & Forecasting
Who was speaking about non-linear models in the first place??? The Klein-Model(s) and pretty much all simultaneous equation models encountered in macro-econometrics are linear and/or can contain linear approximations to non-linear relationships, e.g., production functions of the Cobb-Douglas type. Best, Bernhard -----Urspr?ngliche Nachricht----- Von: Berend Hasselman [mailto:bhh at xs4all.nl] Gesendet: Donnerstag, 13. Juli 2017 10:53 An: OseiBonsu, Frances Cc: Pfaff, Bernhard Dr.; r-help at r-project.org Betreff: [EXT] Re: [R] Question on Simultaneous Equations & Forecasting Frances, I would not advise Gauss-Seidel for non linear models. Can be quite tricky, slow and diverge. You can write your model as a non linear system of equations and use one of the nonlinear solvers. See the section "Root Finding" in the task view NumericalMathematics suggesting three packages (BB, nleqslv and ktsolve). These package are certainly able to handle medium sized models. (https://cran.r-project.org/web/views/NumericalMathematics.html) Write a function with the system of equations with each equation written as y[..] <- lefthandside - (righthandside) You can then include identities naturally. You would have to make the model dynamic but that shouldn't be too difficult using vector indexing. Berend Hasselman> On 13 Jul 2017, at 10:06, Pfaff, Bernhard Dr. <Bernhard_Pfaff at fra.invesco.com> wrote: > > Hi Frances, > > I have not touched the system.fit package for quite some time, but to solve your problem the following two pointers might be helpful: > > 1) Recast your model in the revised form, i.e., include your identity directly into your reaction functions, if possible. > 2) For solving your model, you can employ the Gau?-Seidel method (see https://en.wikipedia.org/wiki/Gauss%E2%80%93Seidel_method). > This has not only the advantage of generating forecasts, in terms of your exogenous variables, but you can also compute 'dynamic ex post' forecasts. This is probably the most powerful testing for dynamic simultaneous equation systems, given that you provide only your predetermined variables as starting values and then apply the Gauss-Seidel method (recursively) in-sample. The progressions of your endogenous variables should then not depart too much from your observed in-sample endogenous variables, i.e., you are assessing the stability of your model. Because forecast-errors cumulate over time in a dynamic ex-post forecast, this is a rather good and stringent model-test. > > Incidentally, when you use simultaneous equation models on a larger scale (say, between 200-300 equations, like medium-sized macroeconomic models), the only route to go for, is by estimating your reaction equations separately and then putting all your pieces - including identities and/or technical equations - together in a format suitable for applying the Gauss-Seidel method. Hence, forget about 2SLS or 3SLS and Haavelmo-bias. > > Best wishes, > Bernhard > > -----Urspr?ngliche Nachricht----- > Von: R-help [mailto:r-help-bounces at r-project.org] Im Auftrag von > OseiBonsu, Frances > Gesendet: Mittwoch, 12. Juli 2017 22:36 > An: r-help at r-project.org > Betreff: [EXT] [R] Question on Simultaneous Equations & Forecasting > > Hello, > > I have estimated a simultaneous equation model (similar to Klein's model) in R using the system.fit package. > > I have an identity equation, along with three other equations. Do you know how to explicitly identify the identity equation in R? > > I am also trying to forecast the dependent variables in the simultaneous equation model, while incorporating the identity equation in the forecasts. Is there a way to do this in R? > > The only way that I have been able to forecast the dependent variables has been by getting the predictions of each variable, converting them to time series uni-variables, and forecasting each variable individually. > > Any help would be appreciated. > > Best Regards, > > Frances Osei-Bonsu > Summer Analyst, Research and Strategy > LaSalle Investment Management > 333 West Wacker Drive, Suite 2300, Chicago IL 60606 Email > frances.oseibonsu at lasalle.com<mailto:frances.oseibonsu at lasalle.com> > Tel +1 312 897 4024 > lasalle.com<http://www.lasalle.com/> > > > > This email is for the use of the intended recipient(s) only. If you have received this email in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not keep, use, disclose, copy or distribute this email without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. The information contained in this communication may be confidential and may be subject to the attorney-client privilege. If you are the intended recipient and you do not wish to receive similar electronic messages from us in the future then please respond to the sender to this effect. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ***************************************************************** > Confidentiality Note: The information contained in this > ...{{dropped:10}} > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Berend Hasselman
2017-Jul-13 11:14 UTC
[R] Question on Simultaneous Equations & Forecasting
> On 13 Jul 2017, at 12:55, Pfaff, Bernhard Dr. <Bernhard_Pfaff at fra.invesco.com> wrote: > > Who was speaking about non-linear models in the first place??? > The Klein-Model(s) and pretty much all simultaneous equation models encountered in macro-econometrics are linearThat's really not true. Klein model is linear but Oseibonsu did not say that explicitly. "Klein like" can just mean same size or same variables.> and/or can contain linear approximations to non-linear relationships, e.g., production functions of the Cobb-Douglas type. >One can indeed sometimes approximate without too much harm. But not always. Berend> Best, > Bernhard > > -----Urspr?ngliche Nachricht----- > Von: Berend Hasselman [mailto:bhh at xs4all.nl] > Gesendet: Donnerstag, 13. Juli 2017 10:53 > An: OseiBonsu, Frances > Cc: Pfaff, Bernhard Dr.; r-help at r-project.org > Betreff: [EXT] Re: [R] Question on Simultaneous Equations & Forecasting > > Frances, > > I would not advise Gauss-Seidel for non linear models. Can be quite tricky, slow and diverge. > > You can write your model as a non linear system of equations and use one of the nonlinear solvers. > See the section "Root Finding" in the task view NumericalMathematics suggesting three packages (BB, nleqslv and ktsolve). These package are certainly able to handle medium sized models. > (https://cran.r-project.org/web/views/NumericalMathematics.html) > > Write a function with the system of equations with each equation written as > > y[..] <- lefthandside - (righthandside) > > You can then include identities naturally. > > You would have to make the model dynamic but that shouldn't be too difficult using vector indexing. > > Berend Hasselman > >> On 13 Jul 2017, at 10:06, Pfaff, Bernhard Dr. <Bernhard_Pfaff at fra.invesco.com> wrote: >> >> Hi Frances, >> >> I have not touched the system.fit package for quite some time, but to solve your problem the following two pointers might be helpful: >> >> 1) Recast your model in the revised form, i.e., include your identity directly into your reaction functions, if possible. >> 2) For solving your model, you can employ the Gau?-Seidel method (see https://en.wikipedia.org/wiki/Gauss%E2%80%93Seidel_method). >> This has not only the advantage of generating forecasts, in terms of your exogenous variables, but you can also compute 'dynamic ex post' forecasts. This is probably the most powerful testing for dynamic simultaneous equation systems, given that you provide only your predetermined variables as starting values and then apply the Gauss-Seidel method (recursively) in-sample. The progressions of your endogenous variables should then not depart too much from your observed in-sample endogenous variables, i.e., you are assessing the stability of your model. Because forecast-errors cumulate over time in a dynamic ex-post forecast, this is a rather good and stringent model-test. >> >> Incidentally, when you use simultaneous equation models on a larger scale (say, between 200-300 equations, like medium-sized macroeconomic models), the only route to go for, is by estimating your reaction equations separately and then putting all your pieces - including identities and/or technical equations - together in a format suitable for applying the Gauss-Seidel method. Hence, forget about 2SLS or 3SLS and Haavelmo-bias. >> >> Best wishes, >> Bernhard >> >> -----Urspr?ngliche Nachricht----- >> Von: R-help [mailto:r-help-bounces at r-project.org] Im Auftrag von >> OseiBonsu, Frances >> Gesendet: Mittwoch, 12. Juli 2017 22:36 >> An: r-help at r-project.org >> Betreff: [EXT] [R] Question on Simultaneous Equations & Forecasting >> >> Hello, >> >> I have estimated a simultaneous equation model (similar to Klein's model) in R using the system.fit package. >> >> I have an identity equation, along with three other equations. Do you know how to explicitly identify the identity equation in R? >> >> I am also trying to forecast the dependent variables in the simultaneous equation model, while incorporating the identity equation in the forecasts. Is there a way to do this in R? >> >> The only way that I have been able to forecast the dependent variables has been by getting the predictions of each variable, converting them to time series uni-variables, and forecasting each variable individually. >> >> Any help would be appreciated. >> >> Best Regards, >> >> Frances Osei-Bonsu >> Summer Analyst, Research and Strategy >> LaSalle Investment Management >> 333 West Wacker Drive, Suite 2300, Chicago IL 60606 Email >> frances.oseibonsu at lasalle.com<mailto:frances.oseibonsu at lasalle.com> >> Tel +1 312 897 4024 >> lasalle.com<http://www.lasalle.com/> >> >> >> >> This email is for the use of the intended recipient(s) only. If you have received this email in error, please notify the sender immediately and then delete it. If you are not the intended recipient, you must not keep, use, disclose, copy or distribute this email without the author's prior permission. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. The information contained in this communication may be confidential and may be subject to the attorney-client privilege. If you are the intended recipient and you do not wish to receive similar electronic messages from us in the future then please respond to the sender to this effect. >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >> ***************************************************************** >> Confidentiality Note: The information contained in this >> ...{{dropped:10}} >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. >
Reasonably Related Threads
- Question on Simultaneous Equations & Forecasting
- Question on Simultaneous Equations & Forecasting
- Question on Simultaneous Equations & Forecasting
- Question on Simultaneous Equations & Forecasting
- Ex ante forecasting from structural equation models (SEM package)