class1 cima

Upload: arkelmak

Post on 04-Jun-2018

251 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Class1 Cima

    1/28

    Computational Toolsfor

    Econometris andStatistics

    Mariano

    Matilla

    Garca

  • 8/13/2019 Class1 Cima

    2/28

    Econometric andStatistical Available

    Software

    What for?

    Currently you cannot doanything (econometrics)

    without softwareaid

    But,there aremany possible choices,what should

    Ichoose?

    First,let us see the options

    Then we will find aprocuder for choosing the one you

    need

  • 8/13/2019 Class1 Cima

    3/28

    2general

    types of

    software

    Type1:Cannedpackages

    Pros:

    Youdontneedtoknowtheformulas

    Youcandoeverydaywork

    Dont

    need

    programming

    Cons:

    Sometimestheuserdoesnotknowwhatis(s)hedoing:blackbox

    Youcannotexperimentonnewresults

    Youcannot updatenewresultsuntiliscommerciallyattracive

  • 8/13/2019 Class1 Cima

    4/28

    2types cont

    Type2:Languageprograms(non basiclevel)

    Youneed

    to

    learn

    how

    to

    interact

    with

    the

    program,

    Youcandowhatyouwanttodo,attheriskofdoingit

    wrong

    Thereare

    bunches

    of

    code

    for

    handling

    everyday

    tasks

    Note:Isuggestreadingthisreference:

    McCullough,B.D.andVinod,H.D.(1999):"TheNumerical

    Reliabilityof

    Econometric

    Software", JournalofEconomic

    Literature,vol.27,june,pp.633665

  • 8/13/2019 Class1 Cima

    5/28

  • 8/13/2019 Class1 Cima

    6/28

    Matrix oriented programming

    languages

    Commercial

    Matlab:(www.mathworks.com)

    Gauss(www.aptech.com)

    Rats

    FreeunderGNUlicense

    Octave(windows,macandlinux users)

    R/(http://www.r

    project.org/)

    Ox(http://www.doornik.com/index.html

  • 8/13/2019 Class1 Cima

    7/28

    Arethese all available ones?

    NO,ofcourse.Youshouldtakealookat:

    http://www.oswego.edu/~economic/econsoftw

    are.htm

    Howcan

    Ibe

    able

    to

    learn

    all

    of

    them?

    Youcan,ifwanted;butthereisnoneed

    Youcanlearnhowtoprograminoneandthenthis

    knowledgewill

    smooth

    the

    way

    for

    others

    (in

    case

    youdesperatelyneedthem)

  • 8/13/2019 Class1 Cima

    8/28

    Instalation Octave

  • 8/13/2019 Class1 Cima

    9/28

    Download other Version Step 1:go to

    http://sourceforge.net/projects/octave/files/Octave_Windows%20%20MinGW/Octave%203.2.4%20for%20Windows%20MinGW32%20Installer/

    andinstall in

    the OCTAVE

    directory,

    but in

    adifferentfolderthan the other version you have

    Octave3.2.4_i686pcmingw32_gcc4.4.0_setup.exe

    Notice that this ISNOTthe version INSTALLEDatclass

    Step 2:Modify in

    GUIOCTAVE

    the route where you

    have OCTAVE

  • 8/13/2019 Class1 Cima

    10/28

    Step 2

  • 8/13/2019 Class1 Cima

    11/28

    Steps 3and

    4

    Step 3:Then exit GUIOctave andthen openagainGUIoctave andwrite down the next 3lines (lineby line)

    pkg rebuild

    autopkg rebuildnoauto adwindowspkg rebuildautojava

    Step 4:Go to File>Set

    Paths>Add folders

    with

    subfolders

    andselect firstly

    C\Octave\3.2.4_gcc4.4.0\share\octave\packages

    andthen

    C\Octave\3.2.4_gcc4.4.0\libexec\octave\packages

  • 8/13/2019 Class1 Cima

    12/28

    Step 5 Go to file>packages

    andwait until they appear

  • 8/13/2019 Class1 Cima

    13/28

    Installing GNUOctave

    for Windows

    Download from:

    http://octave.sourceforge.net/

  • 8/13/2019 Class1 Cima

    14/28

    Install the .exe file

  • 8/13/2019 Class1 Cima

    15/28

    Executing Octave

  • 8/13/2019 Class1 Cima

    16/28

    Not very friendly interface,but

    Install aGraphic User Interface (ie.GUI)

    There areseveral

    Myrecommendation is

    http://guioctave.com/?page_id=2

    Download and install

    Look here for some screenshots

    http://guioctave.com/?page_id=5

  • 8/13/2019 Class1 Cima

    17/28

    ew n er ace

  • 8/13/2019 Class1 Cima

    18/28

    First code%myfirst code for Octaveand Matlab.Type

    this%in the command windowx =randn(100,1);

    plot(x)

  • 8/13/2019 Class1 Cima

    19/28

  • 8/13/2019 Class1 Cima

    20/28

    How

    can

    I

    learn This is the handbook

    http://www.gnu.org/software/octave/doc/interpreter/

    But practice is the bestway

    There arealot of packages

    They arecategorized bysubjects

    How

    to know

    the packages you already have got

    File>Packages

    If you dont find them,then you should download them:

  • 8/13/2019 Class1 Cima

    21/28

    Download packages

  • 8/13/2019 Class1 Cima

    22/28

  • 8/13/2019 Class1 Cima

    23/28

    What if I

    want to install others? Go to

    http://octave.sourceforge.net/packages.phpAlsothereissubstantialdocumentationaboutthe

    package

    Lookforyourneedpackage

    Seebefore

    details

    as

    there

    might

    be

    dependencies

    Downloadthem(it),andthengobacktoGUI

    Octave Userefresh,andinstallthem

  • 8/13/2019 Class1 Cima

    24/28

    Plots hist

    help hist

    Code

    l oad f orear msubpl ot ( 1, 2, 1)% The hi st f unct i on opt i onal l y r et ur ns t he% bi n cent er s and f r equenci es.[ n, x] = hi st ( f or ear m) ;% Pl ot and use t he argument of wi dt h=1% t o pr oduce bar s t hat t ouch.bar ( x, n, 1) ;axi s squar et i t l e( ' Frequency Hi st ogr am' )% Now cr eat e a r el at i ve f r equency hi st ogr am.

    % Di vi de each box by t he t ot al number of poi nt s.subpl ot ( 1, 2, 2)bar ( x, n/ 140, 1)t i t l e( ' Rel at i ve Fr equency Hi st ogr am' )axi s squar e

  • 8/13/2019 Class1 Cima

    25/28

  • 8/13/2019 Class1 Cima

    26/28

    QQ

    plots Compare2distributions,samples,

    With different scale

    With different number of observations

    Each quantile is considered asapoint

    If both setscomefrom the same distribution,then

    all points will beon the same line

    xuni =r and( 100, 1) ;qqpl ot ( xuni , "uni f or m" , 0, 1)

  • 8/13/2019 Class1 Cima

    27/28

    QQ

    plots for 2

    samples What if Iwant to compare2samples of size n

    and m??

    See exampleQQplot

  • 8/13/2019 Class1 Cima

    28/28

    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)