Class1Computational Tools for Econometris and Statistics

Page 1

Computational Tools for Econometris and Statistics Mariano Matilla‐García


Econometric and Statistical Available Software • What for? – Currently you cannot do anything (econometrics) without software aid – But, there are many possible choices, what should I choose? • First, let us see the options • Then we will find a procuder for choosing the one you need


2 general types of software • Type 1: Canned‐packages – Pros: • You don´t need to know the formulas • You can do every‐day work • Don´t need programming

– Cons: • Some times the user does not know what is (s)he doing: black box • You cannot experiment on new results • You cannot update new results until is commercially attracive


2 types cont… • Type 2: Language programs (non basic level) – You need to learn how to interact with the program, – You can do what you want to do, at the risk of doing it wrong – There are bunches of code for handling everyday tasks – Note: I suggest reading this reference: McCullough, B.D. and Vinod, H.D. (1999): "The Numerical Reliability of Econometric Software", Journal of Economic Literature, vol. 27, june, pp. 633‐665


Canned‐Packages • For statistics, and some econometrics tools – SPSS (Windows and Mac) – SAS (Windows) – Both extremely fantastic for presentations

• For econometrics and statistics – Eviews: can do almost every thing in econometrics • www.eviews.com • Linux and Mac users: (www.tspintl.com)

– Stata: real competitor • (www.stata.com)

– You pay for them, but not for GRETL (http://gretl.sourceforge.net/)

• All of them have very active communities


Matrix oriented programming languages • Commercial – Matlab: (www.mathworks.com) – Gauss (www.aptech.com) – Rats

• Free under GNU license – Octave (windows, mac and linux users) – R /(http://www.r‐project.org/) – Ox (http://www.doornik.com/index.html


Are these all available ones? • NO, of course. You should take a look at: http://www.oswego.edu/~economic/econsoftw are.htm • How can I be able to learn all of them? – You can, if wanted; but there is no need – You can learn how to program in one and then this knowledge will smooth the way for others (in case you desperately need them)


Instalation Octave


Download other Version • Step 1: go to http://sourceforge.net/projects/octave/files/Octave_Win dows%20‐ %20MinGW/Octave%203.2.4%20for%20Windows%20Mi nGW32%20Installer/ and install in the OCTAVE directory, but in a different folder than the other version you have Octave‐3.2.4_i686‐pc‐mingw32_gcc‐4.4.0_setup.exe Notice that this IS NOT the version INSTALLED at class • Step 2: Modify in GUIOCTAVE the route where you have OCTAVE


Step 2


Steps 3 and 4 • Step 3: Then exit GUIOctave and then open again GUIoctave and write down the next 3 lines (line by line) pkg rebuild ‐auto pkg rebuild ‐noauto ad windows pkg rebuild ‐auto java

• Step 4: Go to File>Set Paths>Add folders with subfolders and select firstly C\Octave\3.2.4_gcc‐4.4.0\share\octave\packages and then C\Octave\3.2.4_gcc‐4.4.0\libexec\octave\packages


Step 5 • Go to file>packages and wait until they appear


Installing GNU Octave for Windows • Download from: http://octave.sourceforge.net/


Install the .exe file


Executing Octave


Not very friendly interface, but… • Install a Graphic User Interface (ie. GUI) – There are several – My recommendation is • http://guioctave.com/?page_id=2 – Download and install – Look here for some screenshots http://guioctave.com/?page_id=5


New interface


First code %my first code for Octave and Matlab. Type this%in the command window x = randn(100,1); plot(x)



How can I learn • This is the handbook http://www.gnu.org/software/octave/doc/interpret er/

• But practice is the best way – There are a lot of packages – They are categorized by subjects – How to know the packages you already have got • File ‐>Packages… – If you don´t find them, then you should download them:


Download packages



What if I want to install others? • Go to – http://octave.sourceforge.net/packages.php – Also there is substantial documentation about the package

• Look for your need package • See before ‘details’ as there might be dependencies • Download them (it), and then go back to GUI Octave • Use refresh, and install them


Plots •

hist – help hist – Code load forearm subplot(1,2,1) % The hist function optionally returns the % bin centers and frequencies. [n,x] = hist(forearm); % Plot and use the argument of width=1 % to produce bars that touch. bar(x,n,1); axis square title('Frequency Histogram') % Now create a relative frequency histogram. % Divide each box by the total number of points. subplot(1,2,2) bar(x,n/140,1) title('Relative Frequency Histogram') axis square



QQ‐plots • Compare 2 distributions, samples, … – With different scale – With different number of observations

• Each quantile is considered as a ‘point’ – If both sets come from the same distribution, then all points will be on the same line xuni=rand(100,1); qqplot (xuni, "uniform", 0, 1)


QQ plots for 2 samples • What if I want to compare 2 samples of size n and m?? See exampleQQplot


Bivariate Normal Distribution % Create a bivariate standard normal. % First create a grid for the domain. [x,y] = meshgrid(-3:.1:3,-3:.1:3); % Evaluate using the bivariate standard normal. z = (1/(2*pi))*exp(-0.5*(x.^2+y.^2)); % Do the plot as a surface. surf(x,y,z)


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.