statsmodels.sandbox.regression.gmm.NonlinearIVGMM¶
- class statsmodels.sandbox.regression.gmm.NonlinearIVGMM(endog, exog, instrument, func, **kwds)[source]¶
Class for non-linear instrumental variables estimation wusing GMM
The model is assumed to have the following moment condition
E[ z * (y - f(X, beta)] = 0
Where y is the dependent endogenous variable, x are the explanatory variables and z are the instruments. Variables in x that are exogenous need also be included in z. f is a nonlinear function.
Notation Warning: our name exog stands for the explanatory variables, and includes both exogenous and explanatory variables that are endogenous, i.e. included endogenous variables
- Parameters:
- endogarray_like
dependent endogenous variable
- exogarray_like
explanatory, right hand side variables, including explanatory variables that are endogenous.
- instrumentsarray_like
Instrumental variables, variables that are exogenous to the error in the linear model containing both included and excluded exogenous variables
- func
callable
function for the mean or conditional expectation of the endogenous variable. The function will be called with parameters and the array of explanatory, right hand side variables, func(params, exog)
Notes
This class uses numerical differences to obtain the derivative of the objective function. If the jacobian of the conditional mean function, func is available, then it can be used by subclassing this class and defining a method jac_func.
TODO: check required signature of jac_error and jac_func
- Attributes:
endog_names
Names of endogenous variables.
exog_names
Names of exogenous variables.
Methods
calc_weightmatrix
(moms[, weights_method, ...])calculate omega or the weighting matrix
fit
([start_params, maxiter, inv_weights, ...])Estimate parameters using GMM and return GMMResults
fitgmm
(start[, weights, optim_method, ...])estimate parameters using GMM
fitgmm_cu
(start[, optim_method, optim_args])estimate parameters using continuously updating GMM
fititer
(start[, maxiter, start_invweights, ...])iterative estimation with updating of optimal weighting matrix
fitstart
()Create array of zeros
from_formula
(formula, data[, subset, drop_cols])Create a Model from a formula and dataframe.
get_error
(params)Get error at params
gmmobjective
(params, weights)objective function for GMM minimization
gmmobjective_cu
(params[, weights_method, wargs])objective function for continuously updating GMM minimization
gradient_momcond
(params[, epsilon, centered])gradient of moment conditions
jac_error
(params, weights[, args, centered, ...])jac_func
(params, weights[, args, centered, ...])momcond
(params)Error times instrument
momcond_mean
(params)mean of moment conditions,
predict
(params[, exog])Get prediction at params
score
(params, weights, **kwds)Score
score_cu
(params[, epsilon, centered])Score cu
set_param_names
(param_names[, k_params])set the parameter names in the model
start_weights
([inv])Starting weights
Properties
Names of endogenous variables.
Names of exogenous variables.