Empirical Asset Pricing

Similar documents
Principles of Biostatistics and Data Analysis PHP 2510 Lab2

I Launching and Exiting Stata. Stata will ask you if you would like to check for updates. Update now or later, your choice.

Introduction to Stata Toy Program #1 Basic Descriptives

A quick introduction to STATA

/23/2004 TA : Jiyoon Kim. Recitation Note 1

Introduction to Stata

BIOSTATISTICS LABORATORY PART 1: INTRODUCTION TO DATA ANALYIS WITH STATA: EXPLORING AND SUMMARIZING DATA

Soci Statistics for Sociologists

Stata version 13. First Session. January I- Launching and Exiting Stata Launching Stata Exiting Stata..

Stata v 12 Illustration. First Session

Introduction to Stata: An In-class Tutorial

Recoding and Labeling Variables

STATA Note 5. One sample binomial data Confidence interval for proportion Unpaired binomial data: 2 x 2 tables Paired binomial data

After opening Stata for the first time: set scheme s1mono, permanently

Dr. Barbara Morgan Quantitative Methods

Exercise 1: Introduction to Stata

Introduction to Stata - Session 2

Econ Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva

Getting started with Stata 2017: Cheat-sheet

PubHlth 640 Intermediate Biostatistics Unit 2 - Regression and Correlation. Simple Linear Regression Software: Stata v 10.1

STATA 13 INTRODUCTION

PAM 4280/ECON 3710: The Economics of Risky Health Behaviors Fall 2015 Professor John Cawley TA Christine Coyer. Stata Basics for PAM 4280/ECON 3710

Introduction to STATA 6.0 ECONOMICS 626

Getting Started Using Stata

range: [1,20] units: 1 unique values: 20 missing.: 0/20 percentiles: 10% 25% 50% 75% 90%

A Short Guide to Stata 10 for Windows

Introduction to R. Introduction to Econometrics W

ECONOMICS 452 TIME SERIES WITH STATA

Introduction to Stata Session 3

Stata versions 12 & 13 Week 4 Practice Problems

Results Based Financing for Health Impact Evaluation Workshop Tunis, Tunisia October Stata 2. Willa Friedman

An Introductory Guide to Stata

Introduction to Stata First Session. I- Launching and Exiting Stata Launching Stata Exiting Stata..

ECON Stata course, 3rd session

STAT:5400 Computing in Statistics

A Quick Guide to Stata 8 for Windows

Cluster Randomization Create Cluster Means Dataset

Introduction to Stata - Session 1

Chapter 1. Looking at Data-Distribution

Tutorial 1: Unix Basics

050 0 N 03 BECABCDDDBDBCDBDBCDADDBACACBCCBAACEDEDBACBECCDDCEA

SPSS. (Statistical Packages for the Social Sciences)

An Introduction to STATA ECON 330 Econometrics Prof. Lemke

GETTING STARTED WITH STATA. Sébastien Fontenay ECON - IRES

Sacha Kapoor - Masters Metrics

SigmaXL Feature List Summary, What s New in Versions 6.0, 6.1 & 6.2, Installation Notes, System Requirements and Getting Help

Revision of Stata basics in STATA 11:

If you use Stata for Windows, starting Stata is straightforward. You just have to double-click on the wstata (or stata) icon.

Introductory Guide to SAS:

Getting Started Using Stata

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

STATA Hand Out 1. STATA's latest version is version 12. Most commands in this hand-out work on all versions of STATA.

Workshop for empirical trade analysis. December 2015 Bangkok, Thailand

Week 1: Introduction to Stata

1 Introducing Stata sample session

Lec 1 add-on: Linux Intro

SISG/SISMID Module 3

Mills HPC Tutorial Series. Linux Basics I

STATISTICAL TECHNIQUES. Interpreting Basic Statistical Values

2011 NAICC ARM 8 Introduction Training, Jan. 2011

Introduction to STATA

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

Introduction to MATLAB

What is Stata? A programming language to do sta;s;cs Strongly influenced by economists Open source, sort of. An acceptable way to manage data

Introduction to Linux Environment. Yun-Wen Chen

Getting started with MATLAB

Data Analysis and Solver Plugins for KSpread USER S MANUAL. Tomasz Maliszewski

1. NORM.INV function Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.

ECO375 Tutorial 1 Introduction to Stata

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Introduction to R. UCLA Statistical Consulting Center R Bootcamp. Irina Kukuyeva September 20, 2010

Appendix II: STATA Preliminary

Introduction: The Unix shell and C programming

Week 4: Simple Linear Regression III

Command Line Interface The basics

STATA Tutorial. Introduction to Econometrics. by James H. Stock and Mark W. Watson. to Accompany

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT

050 0 N 03 BECABCDDDBDBCDBDBCDADDBACACBCCBAACEDEDBACBECCDDCEA

Week 4: Simple Linear Regression II

Subset Selection in Multiple Regression

Unit 1 Review of BIOSTATS 540 Practice Problems SOLUTIONS - Stata Users

Introduction to Unix

EXST SAS Lab Lab #6: More DATA STEP tasks

Review of Stata II AERC Training Workshop Nairobi, May 2002

A Short Introduction to STATA

Linux Command Line And Shell Scripting Bible 3rd Edition

Assignments Fill out this form to do the assignments or see your scores.

Intermediate Stata. Jeremy Craig Green. 1 March /29/2011 1

Shell Programming Overview

The Stata Bible 2.0. Table of Contents. by Dawn L. Teele 1

A quick introduction to STATA:

University of Massachusetts Amherst * Boston * Dartmouth * Lowell * President s Office * Worcester

STATA 12 Tutorial. by Manfred W. Keil. to Accompany. Introduction to Econometrics. by James H. Stock and Mark W. Watson

GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL

Appendix II: STATA Preliminary

Chapter Two. Lesson A. Objectives. Exploring the UNIX File System and File Security. Understanding Files and Directories

ECONOMICS 351* -- Stata 10 Tutorial 1. Stata 10 Tutorial 1

You should see something like this, called the prompt :

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Transcription:

Department of Mathematics and Statistics, University of Vaasa, Finland Texas A&M University, May June, 2013 As of May 17, 2013

Part I Stata Introduction

1 Stata Introduction Interface Commands Command syntax Immediate commands Stata help Loading data Stata working tips: directories Stata working tips: log file Stata working tips: do-file Stata resources

Interface Review window: Past comments Results window: Displays results Variables window: Displays variables and their labels Properties window: Displays data properties Command window: Commands are typed here

Commands Commands typed in the command windows are exercised immediately after hitting the return key: E.g. typing: display 5*2 produces in the Results window. display 2*5 10 Note: Stata commands are case sensitive!. Display 2 + 2 unrecognized command: r(199); Display

Commands scatter r1 rm, by(event) lfit r1 rm estimation period event period.05 0.05.1.02 0.02.04.02 0.02.04 Market return Merril Lynch & Co Inc Fitted values Graphs by Event/Estimation period

Command syntax Generally the commands are of the form [prefix:] command [if] [in] [weight] [, options] Brackets indicate optional parts. summarize r1 r2 if event == 1. summarize r1 r2 if event == 1 Variable Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- r1 62 -.0012754.0222433 -.0541516.0658915 r2 62.0016534.0291768 -.0677966.0754717

Command syntax. summarize r1 if event == 1, detail Merrill Lynch & Co Inc ------------------------------------------------------------- Percentiles Smallest 1% -.0541516 -.0541516 5% -.0371747 -.0524345 10% -.0319149 -.0413534 Obs 62 25% -.0110294 -.0371747 Sum of Wgt. 62 50% 0 Mean -.0012754 Largest Std. Dev..0222433 75%.0113636.0297398 90%.023166.0339623 Variance.0004948 95%.0297398.0472441 Skewness.0692 99%.0658915.0658915 Kurtosis 3.789862

Immediate commands Immediate commands turn Stata into a useful calculator. They do not affect data in memory. Usually have also a nonimmediate (computed from data) counterparts. End in the letter i (the converse is not true). Confidence interval of Merrill Lynch & Co Inc daily returns.. ci r1 Variable Obs Mean Std. Err. [95% Conf. Interval] ---------+-------------------------------------------------------- r1 127 -.0000973.0021306 -.0043136.0041191

Immediate commands Suppose that in a simulation study the empirical rejection rate at 0.05 level of the null hypothesis by a new test statistic was 0.071 in 1, 000 independent replications. Size problems with the new test? Immediate command for variable distributed as binomial cii #obs #succ [, ciib_options] cii 1000 71 -- Binomial Exact -- Variable Obs Mean Std. Err. [95% Conf. Interval] ---------+------------------------------------------------ 1000.071.0081215.0558646.0887164

Immediate commands Alternatively, using binomial test: Immediate form of binomial probability test bitesti #N #succ #p [, detail]. bitesti 1000 71.05 N Observed k Expected k Assumed p Observed p --------------------------------------------------------- 1000 71 50 0.05000 0.07100 Pr(k >= 71) = 0.002330 (one-sided test) Pr(k <= 71) = 0.998458 (one-sided test) Pr(k <= 30 or k >= 71) = 0.003607 (two-sided test)

Immediate commands For further information, see Stata help help immediate commands

Stata help To get help type: help command name For example, help ttest opens a new window, called viewer window See also the search command. Type: help search to learn more. You can also use the help menu.

Loading data Data can be loaded as a Stata file (.dta), various forms of text files and from various applications like Excel (Stata version 12). See, Menu: File > Import Files can be also loaded from the internet. Stata web-site has several example data sets. For example use http://www.stata-press.com/data/r12/ibm opens the file with comments. use http://www.stata-press.com/data/r12/ibm (Source: Yahoo! Finance)

Loading data. describe Contains data from http://www.stata-press.com/data/r12/ibm.dta obs: 494 Source: Yahoo! Finance vars: 5 12 Jan 2011 09:32 size: 9,880 -------------------------------------------------------------------- storage display value variable name type format label variable label -------------------------------------------------------------------- date float %td Date irx float %9.0g Annual return / 365 (percent) ibm float %9.0g Daily return (percent) spx float %9.0g Daily return (percent) t float %9.0g -------------------------------------------------------------------- Sorted by: date

Loading data Listing 5 first observations. list in 1/5 +--------------------------------------------------+ date irx ibm spx t -------------------------------------------------- 1. 02jan2003.0032603.. 1 2. 03jan2003.0032603 1.340452 -.0484035 2 3. 06jan2003.0032329 2.375989 2.247436 3 4. 07jan2003.0032055 2.883125 -.654462 4 5. 08jan2003.0032055-2.104648-1.408558 5 +--------------------------------------------------+

Stata working tips: directories It is a good idea to organize the project to directories. For example: Documents, Data, Results, Stata, etc. Directories and files can be managed from Stata with command: pwd to see the current directory mkdir to create a new directory dir or ls to list the names of the files cd to change a directory type to list file contents erase or rm to delete a file

Stata working tips: log file Output goes to the Results window. To keep a permanent record you can open a log file: log using filename, text replace The options text makes the file as a text file and replace specifies that the file will be overwritten if it exists.

Stata working tips: do-file Stata commands can be written into a text file, called do file. Stata has a build-in do-file Editor. New do-file can be opened by command doedit or Ctrl-9 (version 12, Ctrl-8 in earlier versions) or by clicking New Do-file Editor in the task bar or by selecting menu Window > Do-file Editor > New Do-file Editor. Crtl-d to run the whole do-file or mark by paint specific lines to run (Menu: Tools > Execute).

Stata working tips: do-file In a do-file everything followed // to the end of file is a comment (Note the exception, url http://) Everything between /* */ is comment. * in the first column indicates a comment line /// indicates line continuation. Text after /// is ignored, i.e., is comment

Stata working tips: do-file Sample do-file

Stata resources Menu: Home page: http://www.stata.com Net course: http://www.stata.com/netcourse/ Faq: http://www.stata.com/support/faqs/ Tutorials http://data.princeton.edu/stata/default.html http://www.ats.ucla.edu/stat/stata/ Manuals (version 11 and above): Help > PDF Documentation User written additions to Stata can be found by Stata prompt net from http://stata.com