Econometric Analysis Using Stata Introduction Time Series Panel

  • Slides: 7
Download presentation
Econometric Analysis Using Stata Introduction Time Series Panel Data

Econometric Analysis Using Stata Introduction Time Series Panel Data

Time Series Analysis Using Stata • Declare time series data and variables – tsset

Time Series Analysis Using Stata • Declare time series data and variables – tsset • Time series operators – L. ; F. ; D. ; S. • Commands with time series options – regress …, if tin(. , . ) – generate – summarize

Example: U. S. GDP Growth gdp 2009. txt gdp 2009. dta • • Time

Example: U. S. GDP Growth gdp 2009. txt gdp 2009. dta • • Time series setup Time series operators Time series line plot (graphics) Time series regression

gdp 1. do * Read text data file (. txt) and covert it to

gdp 1. do * Read text data file (. txt) and covert it to Stats dataset file (. dta) infile year quarter gdpdef using “course 14ec 572datagdp 2009. txt" describe summarize label data "U. S. GDP: 1947. 1 -2013. 3" label variable gdp "GDP (billion of current dollars)" label variable gdpdef "Implicit GDP price deflator (year 2009 = 100)" * delete the 1 st line of variable names drop in 1 * create a time series dataset generate time=yq(year, quarter) tsset time, quarterly label variable time "Time" drop year quarter describe summarize * save it as a Stata dataset, if it has not done yet save "course 14ec 572datagdp 2009"

gdp 2. do * use graph to represent the data * a graph is

gdp 2. do * use graph to represent the data * a graph is worth of thousand words clear use http: //web. pdx. edu/~crkl/ec 572/data/gdp 2009. dta * is this time series data? tsset d su * generate new variable gen rgdp=100*gdp/gdpdef gen lrgdp=ln(rgdp) gen gq=100*D. lrgdp gen ga=100*(lrgdp-L 4. lrgdp) su * time series line plots tsline rgdp, name(rgdp) tsline gq ga, name(growth) * time regression reg lrgdp time

Example: SP-500 sp 500 new. xml • • Reading from an Excel XML database

Example: SP-500 sp 500 new. xml • • Reading from an Excel XML database file Time series (daily) data setup Time series line plot (graphics) Time series analysis

sp 500 new 0. do /* ** Time Series Analysis of U. S. SP

sp 500 new 0. do /* ** Time Series Analysis of U. S. SP 500 Stock Market Index ** Latest update: 12/31/2013 ** Retrieve monthly data, converted from daily format */ clear set more off xmluse "Course 14EC 572datasp 500 new. xml", doctype(excel) sheet(Monthly) cells(A 2: G 769) clear save "Course 14EC 572datasp 500 m", replace gen date=var 1 gen vol=var 6 gen idx=var 7 sort date drop var* gen month=mofd(date) tsset month, monthly gen r=100*(ln(idx)-ln(L. idx)) //gen r=100*(ln(idx)-ln(idx[_n-1])) summarize tsline idx, name(SP 500 m_INDEX, replace) tsline r, name(SP 500 m_Returns, replace) * * Is IDX stationary? IDX~I(1) Is R stationary? R~I(0) ARMA and ARCH structures of R SP 500 Forecasts?