Example: tourism industry

Applied Financial Econometrics using Stata 1. Introduction ...

Applied Financial Econometrics using Stata1. Introduction to Stata (& Reproducible Research)Stan HurnQueensland University of Technology& National Centre for Econometric ResearchHurn (NCER) Applied Financial Econometrics using Stata1 / 421 Introduction2 Some Stata Commands3 Programming Fundamentals4 Reporting Results5 Estimation Commands6 MataHurn (NCER) Applied Financial Econometrics using Stata2 / 42 IntroductionHousekeepingStan course of lectures will feature Stata 13. to licensing issues, you are not able to accessStata during the lectures, but all the materials toreproduce the results reported during the course areavailable (NCER) Applied Financial Econometrics using Stata3 / 42 IntroductionStataStata is a reasonably fast, powerful statistical package withsmart data-management facilities,a wide array of up-to-date statistical techniques,and an excellent system for producing publication-quality graphicsa large group of users with plenty of lively exchange on the weba built in matrix programming language calledMataThe bad news is that Stata is fairly expensive and there is a startup

Introduction References There are a few excellent texts for learning Stata. Christopher F. Baum An Introduction to Stata Programming, 2009. College Station, TX: Stata Press.

Tags:

  Introduction, Using, College, Applied, Financial, Econometrics, Stata, Baum, Applied financial econometrics using stata, Introduction to stata

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Applied Financial Econometrics using Stata 1. Introduction ...

1 Applied Financial Econometrics using Stata1. Introduction to Stata (& Reproducible Research)Stan HurnQueensland University of Technology& National Centre for Econometric ResearchHurn (NCER) Applied Financial Econometrics using Stata1 / 421 Introduction2 Some Stata Commands3 Programming Fundamentals4 Reporting Results5 Estimation Commands6 MataHurn (NCER) Applied Financial Econometrics using Stata2 / 42 IntroductionHousekeepingStan course of lectures will feature Stata 13. to licensing issues, you are not able to accessStata during the lectures, but all the materials toreproduce the results reported during the course areavailable (NCER) Applied Financial Econometrics using Stata3 / 42 IntroductionStataStata is a reasonably fast, powerful statistical package withsmart data-management facilities,a wide array of up-to-date statistical techniques,and an excellent system for producing publication-quality graphicsa large group of users with plenty of lively exchange on the weba built in matrix programming language calledMataThe bad news is that Stata is fairly expensive and there is a startup cost inlearning to use it (or at least there is for me!)

2 Hurn (NCER) Applied Financial Econometrics using Stata4 / 42 IntroductionWhich EditionThere are a number of different editions of Stata : Stata /MP: The fastest version of Stata (for dual-core andmulticore/multiprocessor computers) Stata /SE: Stata for large datasetsStata/IC: Stata for moderate-sized datasetsSmall Stata : A version of Stata that handles small datasets (forstudents only)Hurn (NCER) Applied Financial Econometrics using Stata5 / 42 IntroductionReferencesThere are a few excellent texts for learning F. BaumAn Introduction to Stata Programming, Station, TX: Stata F. BaumAn Introduction to Modern Econometrics UsingStata, 2006. college Station, TX: Stata Cameron and Pravin TrivediMicroeconometrics using Stata (Revised Edition), 2010.

3 college Station, TX: Stata N. MitchellA Visual Guide to Stata Graphics (ThirdEdition), 2012. college Station, TX: Stata (NCER) Applied Financial Econometrics using Stata6 / 42 IntroductionStata Front End for MacHurn (NCER) Applied Financial Econometrics using Stata7 / 42 IntroductionExtending StataA feature of Stata is that it is continually being expanded. A command, toStata, is an instruction to perform some action. Commands may be either: built in commands (those elements so frequently used that theyhave been coded into the Stata kernel); orwritten in Stata s own programming language using an .ado importance of this program design goes far beyond the limits ofofficial Stata as you are able to acquire new Stata commands from anumber of (NCER) Applied Financial Econometrics using Stata8 / 42 IntroductionUpdate FaciityBuilt-in commands change fairly frequently and are distributed as bugfixes, enhancements to existing commands and even entirely newcommands during the lifetime of a given major release.

4 One of Stata sgreat strengths is that it can be updated over the the commandupdate allfrom the command line will checkfor more recent versions of either Stata s executable (the kernel) orthe from theMenuyou clickHelp - Check for updatesAll that is required to update Stata therefore is that you have a licensedcopy of Stata and access to the (NCER) Applied Financial Econometrics using Stata9 / 42 IntroductionBeyond Official StataThere are two particularly important websitesThe Stata Journal (SJ), a quarterly refereed journal, is the primarymethod for distributing user contributions. The Stata commandfinditwill locate commands that have been documented in the SJand with one click you may install them in your version of Boston college Boston Statistical Software Components (SSC)Archive contains all new general-purpose commands written byindividuals to extend Stata newlists new packagesssc hotreports on the most popular packagesadoupdate, updateupdates your installed the commandsearchplus a few keywords will present results froma keyword database and from the Internet.

5 For instance, FAQs from theStata website, articles in the Stata Journal and Stata Technical Bulletin,and downloadable routines from the SSC Archive and user (NCER) Applied Financial Econometrics using Stata10 / 42 IntroductionSetting up a ProjectI like having the following directory can move between folders like this../../folder moves back two directories ../folder moves back one directory ./folder accesses a subfolder of the current directoryRemember to assign theworking directorywhen you start a (NCER) Applied Financial Econometrics using Stata11 / 42 IntroductionWorking DirectoryThe foot of the Stata screen contains an important piece ofinformation: the Current Working Directory, or cwd is the directory to which any files created in your Statasession will be saved.

6 Likewise, if you try to open a file and give itsname alone, it is assumed to reside in the the file is in another location, you must change the cwd either usingthe menusFile - Change Working Directory ..or issue a command in the do filecd ~/Dropbox/Teaching/Singapore/doHurn (NCER) Applied Financial Econometrics using Stata12 / 42 IntroductionFile ExtensionsFile extensions usually employed (but not required) include:.ado automatic do-file (defines a Stata command).dct data dictionary, optionally used with do-file (user program).dta Stata binary graphics output file (binary).log text log SMCL (markup) log file, for use with ASCII data Stata help fileThese extensions need not be given (except for .ado). If you use otherextensions, they must be explicitly (NCER) Applied Financial Econometrics using Stata13 / 42 IntroductionThe Log FileFor reproducible research it is worthwhile behaving like a benchscientist and keeping a lab notebook the Stata log file plays log file is a record of the Results window.

7 It records all commandsand all textual output as it file is written to disk and protects against power failures orcomputer can save the file in one of two different Markup and Control Language (SMCL) format the files can be translated into a variety of formats readable byapplications other than Stata .Hurn (NCER) Applied Financial Econometrics using Stata14 / 42 Some Stata CommandsStata Command SyntaxStata command syntax follows strict fundamental syntax of all Stata commands follows a all elements of the template are used by all commands, and someelements are only valid for certain commands. But where an elementappears, it will appear in the same place, following the same is case sensitive. Commands must be in lower general syntax of a Stata command is:[prefix_cmd:] cmdname [varlist] [=exp] [if exp][in range] [weight] [ ][,options]where elements in square brackets are optional for some (NCER) Applied Financial Econometrics using Stata15 / 42 Some Stata CommandsPrefix CommandsA number of Stata commands can be used as prefix commands, precedinga Stata command and modifying its :repeats a command over a set of categoriesstatsby:repeats the command and collects statistics from each :runs the command on moving subsets of the data (usually timeseries).

8 Simulate:which simulates a statistical modelbootstrap:computation of statistics from resampled datajackknife:runs a command over jackknife subsets of the (NCER) Applied Financial Econometrics using Stata16 / 42 Some Stata CommandsTwo Important Commandsgenerateis used to produce new variables in the be used to revise an existing variable. Note thatreplacemust always be typed out in full ..Notegenerateandreplaceoperate on all observations in the current dataset, producing a result or a missing value for can restrictgenerateandreplaceto operate on a subset of theobservations with theif [exp]orin rangequalifiers. For example, tolist observations at the end of the current data set, useif -5/lto see the last (NCER) Applied Financial Econometrics using Stata17 / 42 Some Stata CommandsUsing LogicalsYou can take advantage of the fact that the exp specified in generate maybe a logical condition rather than a numeric or string value.

9 This allowsproducing both the 0s and 1s of an indicator (dummy, or Boolean) variablein one command. For instance:generate large = (pop > 5000000) & !mi(pop)This condition makes use of two logical operators: & (AND) and ! (NOT)to add the qualifier that the result variable should be missing if pop ismissing, using themi()function. The third logical operator is the BooleanOR, written as|. Note also that a test for equality is specified with the== operator. The single = is used only for (NCER) Applied Financial Econometrics using Stata18 / 42 Some Stata CommandsThe egen CommandStata is not limited to using the set of defined generate functions. Theegen(extended generate) command makes use of functions written in theStata ado-file language.

10 A number ofegenfunctions provide row-wiseoperations similar to those available in a spreadsheet: row sum, rowaverage, row standard deviation, and so may write their ownegenfunctions. In particular, usefindit egenmorefor a very useful (NCER) Applied Financial Econometrics using Stata19 / 42 Programming FilesStata may be used in an interactive mode, and those learning thepackage may wish to make use of the menu you execute a command from a pull-down menu, it records thecommand that you could have typed in the Review window, and thusyou may learn that with experience you could type that command (ormodify it and resubmit it) more quickly than by use of the do-file editor which allows you to easily enter, execute and savesequences of commands, or program fragments.


Related search queries