instrumental variables
[rtsls]=iv1(y,y1,x1,xall)
* y = dependent variable vector (nobs x 1)
* y1 = endogenous variables matrix (nobs x g) for this equation
* xexog = exogenous variables matrix for this equation
* xall = instruments for variables y1
* rtsls = a structure tlist with
- rtsls ('meth') = 'tsls'
- rtsls ('nobs') = nobs
- rtsls ('nendog') = # of endogenous
- rtsls ('nexog') = # of exogenous
- rtsls ('nvar') = # of endogenous + # of exogenous
- rtsls ('y') = y data vector
- rtsls ('beta') = bhat estimates
- rtsls ('tstat') = t-statistics
- rtsls ('yhat') = yhat predicted values
- rtsls ('resid') = residuals
- rtsls ('residtsls') = residuals calculated with the endogenous variables replaced by their regression from first stage estimation
- rtsls ('sigu') = e'*e
- rtsls ('sige') = e'*e/(n-k)
- rtsls ('dw') = Durbin-Watson Statistic
- rtsls ('prescte') = boolean indicating the presence or absence of a constant in the regression
- rtsls ('rsqr') = rsquared
- rtsls ('rbar') = rbar-squared
- rtsls ('f') = F-stat for the nullity of coefficients other than the constant
- rtsls ('pvaluef') = its significance level
- rtsls ('grsqr') = generalized rsquared (that is which takes into account the endogeneity of some explicative variables)
x1 = rand(200,1,'n'); x2 = rand(200,1,'n'); y1 = zeros(200,1); y2 = zeros(200,1); evec = rand(200,1,'n'); // // create simultaneously determined variables y1,y2 y1 = 1+x1+evec; y2 = 1+y1+x2+evec; riv=iv1(y2,y1,[ones(200,1) x2],[ones(200,1) x1 x2]) // provides and stores into a tlist the results of the estimation of the regression of y2 onto y1, x2 and a constant, using x1, x2 and the constant as intruments | ![]() | ![]() |