Extract the model matrix from a fitted model object
Extract the model matrix from a fitted model object
Extract the model matrix (X) from a fitted model object.
## S3 method for class 'splm'model.matrix(object,...)## S3 method for class 'spautor'model.matrix(object,...)## S3 method for class 'spglm'model.matrix(object,...)## S3 method for class 'spgautor'model.matrix(object,...)
Arguments
object: A fitted model object from splm(), spautor(), spglm(), or spgautor().
...: Other arguments. Not used (needed for generic consistency).
Returns
The model matrix (of the fixed effects), whose rows represent observations and whose columns represent explanatory variables corresponding to each fixed effect.
Examples
spmod <- splm(z ~ water + tarp, data = caribou, spcov_type ="exponential", xcoord = x, ycoord = y
)model.matrix(spmod)