Financial Modeling and Econometrics PDF
Document Details
Uploaded by WellRegardedNovaculite1778
The George Washington University
Elias J. Semaan
Tags
Summary
This document provides an introduction to financial modeling and econometrics. It covers basic definitions, types of statistics, populations, samples and measurement scales. The document also discusses methodology of econometrics.
Full Transcript
Financial Modeling and Econometrics ~ FINA6271 ~ Module 1 © Elias J. Semaan, PhD Masters of Science in Finance The George Washington University 1 Econometrics...
Financial Modeling and Econometrics ~ FINA6271 ~ Module 1 © Elias J. Semaan, PhD Masters of Science in Finance The George Washington University 1 Econometrics Overview Basic Definitions Types of Statistics Descriptive Statistics consists of methods for organizing, displaying, and describing data by using tables, graphs, and summary measures. Inferential Statistics consists of methods that use sample results to help make decisions or predictions about a population - MUST BE RANDMOLY SELECTED! Populations and Samples A population is all members of a specified group. A sample is a subset of a population. A sample statistic is a quantity or value computed from or used to describe a sample. Measurement Scales Nominal scales categorize data but do not rank them. Ordinal scales sort data into categories that are ordered with respect to some characteristic. Ratio scales have all the same characteristics of interval measurement scales as well as a true zero point as the origin. Econometrics Overview What is Econometrics? Methodology of Econometrics: 1- Statement of Hypothesis. 2- Specification of the Mathematical Model. 3- Specification of the Econometric Model,. 4- Obtaining Data. 5- Estimation of Parameters. 6- Hypothesis Testing. 7- Forecasting. 3 Econometrics Overview 1- Statement of Hypothesis. The Marginal Propensity to Consume (MPC) for a unit change in income is greater than zero. 2- Specification of the Mathematical Model. Y=1+ 2X 00 CS=0 CS3 CK Options> Preferences, then select the “Results” tab. Check “listing” and uncheck “Create HTML”. 19 SAS – Getting Raw Data into SAS Numerous methods to get raw data into SAS but we will focus on the four main ones for now: Raw Data SAS Engine 1. “Cards” or “datalines” statement: Allows user to include the raw data as part of the code. Variables have to be defined in the “input” statement. 2. “Infile” statement: Used for certain types of files where the user could tell SAS to extract the contents of the file from a certain location on the hard drive. Just like the cards statement, the variables have to be defined in the “input” statement. 3. Import Wizard: A simple dialogue that could be invoked using the “File>Import” from the menu. Variables do not need to be defined if the header of each column in the original file is the name of the variable. The main issue with this technique is that it is quite unreliable and its success is highly dependent on the installation, the operating system, and other technical factors. 4. Proc Import: Probably the most useful and clearest technique. Variables do not need to be defined if the header of each column in the original file is the name of the variable. 20 SAS – Getting raw data into SAS (cont’d) Files: mod1data.xlsx | Revraw.prn 1. Cards Statement 2. Infile Statement Data Myfile; Filename rawdata “c:\REVRAW.PRN”; Input Name $ Sex $ ID Quiz1 Quiz2; Cards; Kaitlyn F 033786841 45.0 32.0 Data Myfile; James M 204666573 62.5 62.0 INFILE rawdata; SHAWN M 031654522 35.5 40.5 Input Name $ Sex $ ID Q1 Q2; Maria F 226896047 56.5 0.0 CAROLINE F 208790813 53.0 48.0 Jordan M 527983230 43.5 2.0 Kelly F 562041716 42.0 25.0 Proc Print data=myfile; ANDRES M 304256863 74.5 52.5 run; JULIA F 175748283 61.0 62.0 Mark M 275825757 80.5 35.5 NUNO M 028713478 29.0 18.5 Michelle F 094729238 91.0 67.5 Tod M 022749658 22.0 0.0 Tracy F 552779942 44.0 62.0 Eric M 556345600 64.0 22.0 Alyssa F 023688764 95.0 67.5 CARA F 109772956 80.0 4.0 Proc Print data=myfile; run; 21 SAS – Getting raw data into SAS (cont’d) 3. SAS Import Wizard (File>Import) Note that whatever name you choose here Whatever headers you have in the first row becomes the system file’s name. Ex: say we become the name of the variable in SAS file called the file myfilexl, test content by running proc print data=myfilexl; 4. Proc Import proc import out=myfilexl datafile=“c:\mod1data.xlsx” DBMS = XLSX replace; 22 SAS STUDIO: Uploading your file to the online studio first before PROC IMPORT 1. Select ‘my_content’ then click the upload button. 2. Select the excel file you wish to upload from your hard drive. Once your file finishes uploading, you should be able to see it under ‘my_content’. 3. Use the following code to convert it into a SAS system file. 23 SAS – Creating New Variable; Print Out System File The SET statement is used to make adjustments to file content after importing with proc import. Arithmetic Expressions in SAS Operand: variable (eg: Quiz1) or constant. Operator: +, -, *, / Standard rules of operator precedence: 1+2*3 ? 24 SAS – IF THEN Statement Note Tod and Maria records deleted. Logical Expressions in SAS Operand: variable (eg: Quiz1) or constant. Operator: “”, “=”, “=”, “^=”, “AND”, “OR”, “NOT” 25 SAS – IF THEN Statement (2) IF THEN statement can be used to create new variable and can also be nested with multiple levels of IF THEN ELSE. 26 SAS – Sorting Dataset Try this: Proc sort data=example1; by descending sex descending name; 27 SAS – Proc Means Say we want results for only q1 and q2 Say we want these results but ordered by sex Note: In order to run proc means ‘BY’ a certain variable, the datafile needs to be sorted by that variable first. 28 SAS – Match Merging Dataset Details of the match merging process: 1. Both original files (here “example1” and “sexavg”) have to be sorted by the variable that will be matched. 2. New file needs to be created (matchmerged) using the data statement. 3. Files to be merged and matching variable in files is defined. 4. New variables can then be created in the new file. 29 SAS – Calculating returns using lag and dif functions The initial dataset here contains the share prices for pepsi on the last 7 trading days in August 2016. Details of the calculation process: 1. The lag1 function generates the lagged price for pepsi. 2. The dif1 function calculates the difference between every price and the previous price. 3. The Retpep value is the holding period return, that is [(p2-p1)/p1] 30