selection_iis {robust2sls}R Documentation

Create selection (non-outlying) vector from IIS model

Description

selection_iis uses the data and isat model object to create a list with five elements that are used to determine whether the observations are judged as outliers or not.

Usage

selection_iis(x, data, yvar, complete, rownames_orig, refmodel)

Arguments

x

An object of class ivisat.

data

A dataframe.

yvar

A character vector of length 1 that refers to the name of the dependent variable in the data set.

complete

A logical vector with the same length as the number of observations in the data set that specifies whether an observation has any missing values in any of y, x, or z variables.

rownames_orig

A character vector storing the original rownames of the dataframe.

refmodel

A model object that will be stored in $model.

Value

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 model object based on which the four vectors were calculated.

Note

IIS runs multiple models, similar to saturated_init but with multiple block search. These intermediate models are not recorded. For simplicity, the element $model of the returned list stores the full sample model result, identical to robustified_init.

Warning

Unlike the residuals stored in a model object (usually accessible via model$residuals), this function returns vectors of the same length as the original data set even if any of the y, x, or z variables are missing. The residuals for those observations are set to NA.


[Package robust2sls version 0.2.2 Index]