Python implementation of the Salanie-Wolak FRAC method to estimate quasi-linear random coefficients models.
The model must have the form
-
$\eta$ and$A^\ast$ have the same dimension$J$ -
$E(\eta_j\vert Z_j)=0$ for all$j$ -
$\beta$ has$p$ elements and$f_1(Y)$ is$(J,p)$ -
$\varepsilon$ has$M$ elements, a mean zero and a variance$\Sigma$ .
Observations are
Our aim is to estimate
The user must specify
- the data
$Y$ as a Numpy array$(T,J,n_Y)$ - the function that computes
$f_1$ for each observation:$f_1(Y_t,a_t)$ (or its values$(f_{1,t})$ in the sample, an array $(T,J,p)$); where$a_t$ represents all the other arguments needed; - the function that computes
$A^\ast$ for each observation - the instruments
$Z$ , a Numpy array$(T,J,n_Z)$ ;
and, optionally:
5. the function
The program does 2SLS of
The corrected version replaces
For
For
Or use scipy.optimize.root(vfun, vx0, jac=True)
where vfun
returns
We iterate Newton:
- solve
$A^\prime(f^{(k+1)}) d = -A(f^{(k)})$ - make
$f^{(k+1)}=f^{(k)}+d$ .
For