?=================================================================== ? Iterative routine for multiplicative heteroskedasticity. = ? Note that this replicates the HREG command. = ? = ? User must define the data matrix with the following line: = ? = ? NAMELIST ; X = ... $ = ? = ? User's dependent variable is Y. Change the following line = ? = ? CREATE ; Y = the dependent variable $ = ?=================================================================== ? Heteroskedastic regression model: ? ? y = á'x + î, Var[î] = exp(à'z) ? ? (1) Starting values by least squares of Y on X for á, then the log ? of the squared residual on Z. Add 1.2704 to intercept to fix bias ? REGRESS ; lhs = Y ; rhs = X ; Res = e $ MATRIX ; beta = b $ (Retrieve estimate of á) CREATE ; logesq = log(e^2) $ REGRESS ; lhs = logesq ; rhs = Z $ MATRIX ; fix = 1.2704 / 0 ; alpha = b & fix $ (get estimate of à) ? ? (2) Iterative routine. Based on á and à as they enter iteration ? ? get e = (y - Xá), q = exp(à'z), and v = eý/q - 1 ? New á is weighted LS with weights 1/q, ? New à is old à + slopes in regression of v on Z. ? Exit if this update to à is small. c(1) = maximum change in à. ? PROC CREATE ; e = y - dot(X,beta) ; q1=exp(-dot(Z,alpha)) ; v=e^2*q1 - 1 $ REGRESS; lhs = v ; rhs = Z $ MATRIX ; alpha = alpha & b ; c(1) = chng(b) $ REGRESS; lhs = y ; Rhs = X ; Wts = q1 $ ENDPROC EXEC ; query $