user_init {robust2sls}R Documentation

User-specified initial estimator

Description

user_init uses a model supplied by the user as the initial estimator. Based on this estimator, observations are classified as outliers or not.

Usage

user_init(data, formula, cutoff, user_model)

Arguments

data

A dataframe.

formula

A formula in the format y ~ x1 + x2 | x1 + z2 where y is the dependent variable, x1 are the exogenous regressors, x2 the endogenous regressors, and z2 the outside instruments.

cutoff

A numeric cutoff value used to judge whether an observation is an outlier or not. If its absolute value is larger than the cutoff value, the observations is classified as an outlier.

user_model

A model object of class ivreg whose parameters are used to calculate the residuals.

Value

user_init returns a list with five elements. The first four are vectors whose length equals the number of observations in the data set. Unlike the residuals stored in a model object (usually accessible via model$residuals), it does not ignore observations where any of y, x or z are missing. It instead sets their values to NA.

The first element is a double vector containing the residuals for each observation based on the model estimates. The second element contains the standardised residuals, the third one a logical vector with TRUE if the observation is judged as not outlying, FALSE if it is an outlier, and NA if any of y, x, or z are missing. The fourth element of the list is an integer vector with three values: 0 if the observations is judged to be an outlier, 1 if not, and -1 if missing. The fifth and last element stores the ivreg user-specified model object based on which the four vectors were calculated.

Warning

Check Jiao (2019) about conditions on the initial estimator that should be satisfied for the initial estimator (e.g. they have to be Op(1)).


[Package robust2sls version 0.2.2 Index]