/* The following code replicates the code shown in Table A2 of the appendix of the article: "A Simple and Efficient Method of Estimating the Magnitude and Precision of Welfare Changes" by Jon A. Breslaw and J. Barry Smith It should work with all versions of GAUSS */ @ ================================================================ @ @ Purpose: Evaluates the CV for a given price change @ @ using the Vartia method. @ @ ================================================================ @ @ -------------- Hausman's Gasoline Example -----------------------@ clear p, y, x; @ clear globals @ p0 = .75; @ starting price @ p1 = 1.5; @ finish price @ y0 = 720; @ income @ num = 100; @ number of steps @ let b = 4.95 -14.22 .082; @ parameters in demand function @ call vartia; @ evaluate compensating variation @ end; proc q(x,b); @ demand function @ local p, y, z; p = x[1]; y = x[2]; z = b[1] + b[2]*p + b[3]*y; retp(z); endp; @==================================================================@ proc (0) = vartia; @ Vartia method @ local del, p,np, ny, y, tcv, h, g, cv, dwl, dhdp, icnt, j, oldy, newy, xc, xt, ybase; tcv = y0; ybase = y0; del = (p1-p0)/num; @ step size @ p = p0; @ initial price vector @ y = y0; @ initial income @ np = rows(p); @ number of prices @ ny = np+1; @ index of income @ xc = q(p|y,b); @ initial demand @ j = 2; do until j > num; @ loop through steps @ icnt = 0; cont: @ label for jump @ icnt = icnt + 1; @ augment counter @ p = p0 + (j-1)*del; @ augment price @ oldy = y; xt = q(p|y,b); @ new Marshallian demand @ cv = .5*(xt+xc)'del; @ Sterlings approx @ newy = cv + ybase; @ augment income @ y = newy; if (icnt == 500); @ check for iteration limit @ "Not converged"; end; endif; xc = xt; @ update base demand @ if (abs(newy-oldy) > .0001); @ check for convergence @ goto cont; endif; ybase = newy; j = j+1; endo; tcv = y - tcv; dwl = tcv - (p1-p0)'q(p1|y,b); @ q evaluated at new p and y @ "TCV = " tcv; "DWL = " dwl; endp; @ ================================================================ @