oxdk_day5a - A d v a n c e d P r o g r a m m i n g i n Q u...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A d v a n c e d P r o g r a m m i n g i n Q u a n t i t a t i v e E c o n o m i c s Introduction, structure, and advanced programming techniques 17 – 21 August 2009, Aarhus, Denmark Charles Bos [email protected] VU University Amsterdam Tinbergen Institute Advanced Programming in Quantitative Economics – p. 1 Day 5 - Morning 9.00L Data handling ◦ Difference in formats ◦ Reading large datasets ◦ Selecting and transforming 10.30P Selected exercises. Choice of ◦ Reading HF data ◦ Implement HF Autoregressive Duration Model ◦ Using graphing package ◦ AR(p) estimation with/without ARFIMA package 12.00 Lunch Advanced Programming in Quantitative Economics – p. 2 Input and Output file type extension Names Remark ASCII matrix file .mat- Convenient input ASCII data file with load information .dat + PcGive/OxMetrics data file .in7 (with .bn7) + Retains variable names Excel spreadsheet file .xls + Common format, take care Lotus spreadsheet file .wks/.wk1 + Gauss data file .dht (with .dat) + Gauss matrix file .fmt- Small, save results Stata data file .dta- Input only text file using fscan / fprint functions ? Lots of control binary file using fread / fwrite functions ? loadmat.ox #include <oxstd.h> main() { decl mX, asVar; mX = loadmat("data/data.xls", &asVar); println("Saving data in 5 types of files: ..."); savemat("excl/lm_data.mat", mX); savemat("excl/lm_data1.dat", mX, asVar); savemat("excl/lm_data.dht", mX, asVar); savemat("excl/lm_data.in7", mX, asVar); savemat("excl/lm_data.fmt", mX); println("done."); } Advanced Programming in Quantitative Economics – p. 3 Input: mat format • Text-based format, very convenient for inputting your data • Starts with two numbers, rows and columns of matrix • Followed by numbers; output matrix is filled row-by-row • Numbers are separated by space, comma or new-line • ‘.’, ‘m’, ‘M’ and ’.NaN’ are considered missing • ‘.Inf’ is infinity • Other text leads to skipping the remainder of the line Paths • You may specify a full path (but relative paths are easier). Use either ‘/’ (preferably) or ‘ \\ ’ in your path. • The file is searched first starting from the present directory, then along the value of the OX5PATH environment variable (i.e., usually in the main Ox directory and its include subdirectory). Advanced Programming in Quantitative Economics – p. 4 stackloss.mat example stack/data/stackloss.mat 4 21 // Stackloss.mat // // Hoeting, J. A., Madigan, D., and Raftery, A.E. (1996) ‘‘A Method for // Simultaneous Variable Selection and Outlier Identification in Linear // Regression,’’ Journal of Computational Statistics and Data // Analysis , 22 , 251-270. // // Data source: // Brownlee, K. A. (1965), "Statistical Theory and Methodology in // Science and Engineering", 2nd edition, New York:Wiley....
View Full Document

This note was uploaded on 05/28/2010 for the course ECONOMIC FM407 taught by Professor Kimcj during the Spring '04 term at 카이스트, 한국과학기술원.

Page1 / 29

oxdk_day5a - A d v a n c e d P r o g r a m m i n g i n Q u...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online