Skip to contents

Returns the regressor matrix (X), instrument matrix (Z), or projected regressors (X_hat = P_Z X), as used in estimation. For models estimated with partial, these are the post-partialling matrices that coef(), residuals(), and vcov() correspond to. The returned matrices do not depend on whether the model was fitted with x = TRUE: when the matrices were not stored, they are reconstructed from the model frame and the same partialling projection is re-applied.

Usage

# S3 method for class 'ivreg2'
model.matrix(
  object,
  component = c("regressors", "projected", "instruments"),
  ...
)

Arguments

object

An object of class "ivreg2".

component

Character: which matrix to return. "regressors" (default) returns the regressor matrix X; "instruments" returns the full instrument matrix Z (NULL for OLS); "projected" returns the projected regressors X_hat (equals X for OLS).

...

Additional arguments (ignored).

Value

A numeric matrix, or NULL if component = "instruments" for an OLS model.