Difference between revisions of "MATLAB"

From ECLR
Jump to: navigation, search
(Created page with "== <div id="Essential"></div>The Essential MATLAB Programming Techniques == In this section we will introduce a number of basic and intermediate programming techniques. Whate...")
 
(Special Econometric Topics)
 
(15 intermediate revisions by 3 users not shown)
Line 44: Line 44:
 
| [[ArrayStructures|Discussion]]
 
| [[ArrayStructures|Discussion]]
 
| coming soon
 
| coming soon
| coming soon
+
| [[Graphing|Discussion]]
 
| [[Anonym|Discussion]]
 
| [[Anonym|Discussion]]
 
|}
 
|}
Line 78: Line 78:
 
! scope="col"| Univariate<br>Time Series
 
! scope="col"| Univariate<br>Time Series
 
! scope="col"| Unit Root and<br>Stationarity Testing
 
! scope="col"| Unit Root and<br>Stationarity Testing
 +
! scope="col"| Forecasting
 
|-
 
|-
 
| [[RobInf|Discussion]]<br>[[ExampleCodeOLShac|Example Code]]
 
| [[RobInf|Discussion]]<br>[[ExampleCodeOLShac|Example Code]]
 
| [[UniTS|Discussion]]<br>[[media:FXrateUSEU.xls|FXrateUSEU.xls]]<br>[[media:USGDP.xls|USGDP.xls]]
 
| [[UniTS|Discussion]]<br>[[media:FXrateUSEU.xls|FXrateUSEU.xls]]<br>[[media:USGDP.xls|USGDP.xls]]
 
| coming soon
 
| coming soon
 +
| [[Forecasting|Discussion]]
 
|}
 
|}
  
Line 89: Line 91:
 
! scope="col"| Generalized<br>Methods of Moments
 
! scope="col"| Generalized<br>Methods of Moments
 
! scope="col"| Instrumental<br>Variables
 
! scope="col"| Instrumental<br>Variables
 +
! scope="col"| Bayesian<br>Estimation
 
|-
 
|-
 
| [[MaxLik|Discussion]]<br>[[MaxLikCode|Example Code]]
 
| [[MaxLik|Discussion]]<br>[[MaxLikCode|Example Code]]
| coming soon
+
| [[GMM|2-step est]]<br>[[GMM_over|2-step est (overident)]]<br>[[numgrad_m|numgrad.m]]<br>[https://youtu.be/qwDPOomNG1c YouTube (1h 45min)] <br>[[media:US3monthRate.xlsx|US3monthRate.xlsx]]
 
| [[IV|Discussion]]<br>[[ExampleCodeIV|Example Code]]
 
| [[IV|Discussion]]<br>[[ExampleCodeIV|Example Code]]
 +
| [[Bayes|Discussion]]
 
|}
 
|}
  
Line 101: Line 105:
 
! scope="col"| Handling High<br>Frequency Data
 
! scope="col"| Handling High<br>Frequency Data
 
|-
 
|-
| [[Monte-Carlo|Monte-Carlo]]
+
| coming soon
 
| coming soon
 
| coming soon
 
| coming soon
 
| coming soon
Line 107: Line 111:
 
|}
 
|}
  
== Authors, Maintenance and Contributions ==
+
== Other useful MATLAB resources ==
 +
 
 +
=== The MATLAB Software ===
  
This wiki was created by [mailto:ralf.becker@manchester.ac.uk Ralf Becker] and [mailto:arthur.sinko@manchester.ac.uk Arthur Sinko] with the financial support of a University of Manchester Investing in Success grant. If you have any suggestions please contact us by email. Contributions to this wiki are encouraged. Please contact us for details.
+
The software is available on University of Manchester Computer Labs. If you make regular use of MATLAB you should consider purchasing your own software. The Student Version of MATLAB is available, for instance, from [http://www.amazon.co.uk/MATLAB-Simulink-Student-Version-R2014a/dp/0989614026/ref=sr_1_1?s=software&ie=UTF8&qid=1411983990&sr=1-1&keywords=matlab+2014 Amazon] for £66. This is a real bargain, considering that the equivalent non-discounted package would come in at about £4,000.
  
== Other useful MATLAB resources ==
 
 
=== Freely available toolboxes ===
 
=== Freely available toolboxes ===
  
Line 126: Line 131:
 
* Higham, D.J. and Higham, N.J. (2005) MATLAB Guide, Society for Industrial and Applied Mathematics [http://www.amazon.co.uk/MATLAB-Guide-Desmond-J-Higham/dp/0898715784/ref=sr_1_1?s=books&ie=UTF8&qid=1347377409&sr=1-1]
 
* Higham, D.J. and Higham, N.J. (2005) MATLAB Guide, Society for Industrial and Applied Mathematics [http://www.amazon.co.uk/MATLAB-Guide-Desmond-J-Higham/dp/0898715784/ref=sr_1_1?s=books&ie=UTF8&qid=1347377409&sr=1-1]
 
This website does not cover any theoretical ground and is no substitute for any Econometric Textbook. There is a wide range of very good Econometric Textbooks available. If you are concerned about programming in MATLAB than you are likely to appreciate textbooks that use matrix notation. Here are two very good books that fit that bill:
 
This website does not cover any theoretical ground and is no substitute for any Econometric Textbook. There is a wide range of very good Econometric Textbooks available. If you are concerned about programming in MATLAB than you are likely to appreciate textbooks that use matrix notation. Here are two very good books that fit that bill:
* Heij C, de Boer P., Franses P.H., Kloek T. and van Dijk H.K (2004) Econometric Methods with Applications in Business and Economics, Oxford University Press, New York.[http://www.amazon.co.uk/Econometric-Methods-Applications-Business-Economics/dp/0199268010/ref=sr_1_1?s=books&ie=UTF8&qid=1354473313&sr=1-1]
+
* Heij C., de Boer P., Franses P.H., Kloek T. and van Dijk H.K (2004) Econometric Methods with Applications in Business and Economics, Oxford University Press, New York.[http://www.amazon.co.uk/Econometric-Methods-Applications-Business-Economics/dp/0199268010/ref=sr_1_1?s=books&ie=UTF8&qid=1354473313&sr=1-1]
 
* Greene W.H. (2012) Econometric Analysis, Pearson, Harlow.[http://www.amazon.co.uk/Econometric-Analysis-William-H-Greene/dp/0273753568/ref=sr_1_1?ie=UTF8&qid=1354473593&sr=8-1]
 
* Greene W.H. (2012) Econometric Analysis, Pearson, Harlow.[http://www.amazon.co.uk/Econometric-Analysis-William-H-Greene/dp/0273753568/ref=sr_1_1?ie=UTF8&qid=1354473593&sr=8-1]

Latest revision as of 08:43, 8 February 2022

The Essential MATLAB Programming Techniques

In this section we will introduce a number of basic and intermediate programming techniques. Whatever language you program in you will encounter these techniques, although the details will, of course, vary. We recommend that you ensure that you are familiar with these before you progress to Special Econometric Topics .

Basic Programming

Basics and
Matrices
Loading Data and
Date Formats
Program Flow and
Logicals
Functions Saving Data and
Screen Output
Discussion
Example Clip
Discussion
ExampleClip
Discussion Discussion
Example Code
OLSexample.xls
Example Clip
Discussion

After having gone through these basic techniques you may want to test your newly acquired skills with the following examples.

Example 1 Example 2
Example 1 Example2a
Example2b

Intermediate Programming

Statistical
Functions
Arrays and
Structures
Debugging Graphing Data Function Handlers
Anonymous Functions
Discussion Discussion coming soon Discussion Discussion

Advanced Programming

Sorry, but this cannot be taught! It will come with experience. Find someone who has experience in MATLAB programming and let him or her look over your code.

Nonlinear Optimisation

The optimal parameters in a linear econometric model (assuming certain assumptions) can be found analytically. We call them the Ordinary Least Squares (OLS) estimates and they are easily calculated with a certain formula (see the OLSest.m function). When econometric models do not have such an analytical solution, an alternative parameter estimation strategy is required. In essence it is a clever "trial and error" strategy. This is often called nonlinear optimisation.

Nonlinear optimisation is a very important, but also a very tricky area of econometric computing. It certainly helps to understand some of the underlying theory and therefore we have below separate sections on the theory and implementation.

Theory Implementation Constrained
Optimisation
Discussion Discussion Discussion

Special Econometric Topics

Topics in this Section will assume that you have mastered all the techniques covered in the Essential Programming Section

Robust standard
errors
Univariate
Time Series
Unit Root and
Stationarity Testing
Forecasting
Discussion
Example Code
Discussion
FXrateUSEU.xls
USGDP.xls
coming soon Discussion
Maximum
Likelihood
Generalized
Methods of Moments
Instrumental
Variables
Bayesian
Estimation
Discussion
Example Code
2-step est
2-step est (overident)
numgrad.m
YouTube (1h 45min)
US3monthRate.xlsx
Discussion
Example Code
Discussion
Monte-Carlo/
Simulation Techniques
Binary Response
Models
Handling High
Frequency Data
coming soon coming soon coming soon

Other useful MATLAB resources

The MATLAB Software

The software is available on University of Manchester Computer Labs. If you make regular use of MATLAB you should consider purchasing your own software. The Student Version of MATLAB is available, for instance, from Amazon for £66. This is a real bargain, considering that the equivalent non-discounted package would come in at about £4,000.

Freely available toolboxes

The following toolboxes are freely available and contain extremely useful procedures

  • Spatial Econometrics by James P. LeSage [1]. This toolbox contains a wide variety of useful econometrics functions. It also contains an excellent documentation. In addition to quite general econometric functions you will, as the name suggests, find a huge list of functions relevant if you are working with spatial data.
  • Oxford MFE toolbox by Kevin Sheppard [2]. Use the download link in the box on the right that starts with "Owner: Kevin Sheppard". This toolbox contains many useful functions for uni- and multivariate volatility models.

You need to copy these toolboxes into your MATLAB toolbox folder and add the respective path to the MATLAB list of folders it searches for functions. (In the main menu select FILE and then SET PATH where you can add the folders you added.) If you work on a computer for which you have no administrator rights, this strategy may not work. This Example Clip demonstrates what to do in that case. It is just a matter of adding one line into your code! Piece of cake.

Literature and other learning resources

  • Kevin Sheppard's MATLAB introduction.
  • Martin V., Hurn S. and Harris D. (2012) Econometric Modelling with Time Series: Specification, Estimation and Testing (Themes in Modern Econometrics).[3] This book contains an extensive library of relevant MATLAB codes.
  • Higham, D.J. and Higham, N.J. (2005) MATLAB Guide, Society for Industrial and Applied Mathematics [4]

This website does not cover any theoretical ground and is no substitute for any Econometric Textbook. There is a wide range of very good Econometric Textbooks available. If you are concerned about programming in MATLAB than you are likely to appreciate textbooks that use matrix notation. Here are two very good books that fit that bill:

  • Heij C., de Boer P., Franses P.H., Kloek T. and van Dijk H.K (2004) Econometric Methods with Applications in Business and Economics, Oxford University Press, New York.[5]
  • Greene W.H. (2012) Econometric Analysis, Pearson, Harlow.[6]