prdk_syntax - 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–7. 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 Syntax slides Below a series of slides on syntax in Ox. Read them through, try out in small programs if you understand the meaning. Advanced Programming in Quantitative Economics – p. 2 Chapter 1: Getting started Exercise: 1. Copy the file <ox-home>/samples/myfirst.ox to your personal directory. 2. Open the file in OxEdit (e.g. Windows Explorer, walk there, right mouse button, Send To - OxEdit ) 3. Run the program (through Modules - Run - Ox ) (If there is no Ox option under the Run menu, load the .tool file from the students directory, using Tools - Add/remove modules - Load from ) Output Ox version 5.10 (Linux_64/MT) (C) J.A. Doornik, 1994-2008 two matrices 2.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000 0.0000 0.0000 0.0000 1.0000 1.0000 1.0000 Advanced Programming in Quantitative Economics – p. 3 Using OxEdit One tab has program Running the program puts output in separate file/sheet Errors in code can appear in output file Workspace indicates opened files Advanced Programming in Quantitative Economics – p. 4 Type of errors 1. Compilation errors: Like the above, error in the syntax of Ox myfirst err.ox print "two matrices", m1, m2); // gives compile-time error---------------- Ox version 5.10 (Linux_64/MT) (C) J.A. Doornik, 1994-2008 myfirst_err.ox (12): ’;’ expected but found ’<string>’ myfirst_err.ox (12): ’;’ expected but found ’)’ myfirst_err.ox (12): ’)’ out of place 2. Runtime errors: Impossible computations or commands myfirst err.ox print ("product of two matrices", m1 * m2); // gives run-time error---------------- Ox version 5.10 (Linux_64/MT) (C) J.A. Doornik, 1994-2008 ... Runtime error: ’matrix[3][3] * matrix[2][3]’ bad operand Runtime error occurred in main(14), call trace: myfirst_err.ox (14): main One error can lead to multiple messages: Start solving first in list. Advanced Programming in Quantitative Economics – p. 5 Chapter 2: Syntax - Comments / * This is standard comment, which / * may be nested * /. * / decl x; // declare the variable x Use them well, use them extensively oxtut2a.ox / * ** olsc(const mY, const mX, const amB); ** mY in: T x n matrix Y ** mX in: T x k matrix X ** amB in: address of variable ** out: k x n matrix with OLS coefficients ** ** Return value ** integer: 1: success, 2: rescaling advised, **-1: X’X is singular, -2: combines 2 and -1. ** ** Description ** Performs OLS, expecting the data in columns....
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 / 36

prdk_syntax - 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 - 7. Sign up to view the full document.

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