Some Code for Solving Various Problems
- C/Gauss
code for computing an inverse of a Normal CDF (also illustrates
foreign language importing, via DLL (dynamic link library) of C code
into Gauss, as if the external code was a Gauss procedure (the C code
is typically orders of magnitude faster than Gauss)
- C/Matlab code
for doing multidimensional interpolation/extrapolation of functions
(also illustrates Matlab's MEX facility for importing foreign language
code, i.e. in this case C-code) which similar to Gauss results in huge
speedups compared to writing the routines in Matlab, especially when
there are many nested do-loops involved.
- ergodic.g Gauss code to compute the invariant
distribution of an nxn Markov transition probability matrix
- quadpoints.g Gauss code to
compute weights and abscissae for Gaussian quadrature
- vint.g Gauss code to interpolate
a multidimensional function via simplicial interpolation (see also
vint.c the C version of this same
code)
- evp.c C code to compute the
conditional expectation of a continuous function of 2 variables with
respect to one of these variables (i.e. with respect to the stochastic
exogenous state variable) conditional on the value of the other
endogenous state variable.
- evpp.c C code to to the same
conditional expectation as evp.c expect this code also returns
probabilities that represent the conditional expectation as an
expectation over the value function at the N grid points in
two-dimensional space, EV= \sum_{i=1}^N V_i p_i(p,q) where V_i are the
values of the value function at the grid points, and p_i(p,q) are the
probability weights returned by evp when called at state point (p,q)
- kseq.g Gauss code to compute the
index of an element in a multidimensional lattice where the lattice
is linearly ordered as a 1-dimensional vector according to a multilevel
do-loop that steps through each element in the array
- kseq.c C version of
kseq.g used in vint.c above.
- mysort.c C function to sort
a vector of numbers from low to high, returning both the sorted vector
and the indices of the sorted array (e.g if the vector is 4.2 -1.2 3.2
then the sorted array is -1.2 3.2 4.2 and the sorted indices are 1 2 0, i.e.
4.2, the 0-th element of the array is )
|
|
|
Send questions/comments to: jrust@econ.umd.edu
|