Defines functions checkIMRcollinearity

checkIMRcollinearity <- function(X, tol=1e6) {
   ## This small utility checks whether inverse Mills ratio is (virtually) collinear to the other explanatory
   ## variables.  IMR is in the last columns.
   ## In case of collinearity it returns TRUE, otherwise FALSE
   X <- X[!apply(X, 1, function(row) any(is.na(row))),]
   if(kappa(X) < tol)
   if(kappa(X[,-ncol(X)]) > tol)
                           # it is multicollinear,
                           # but not (just) due to IMR

Try the sampleSelection package in your browser

Any scripts or data that you put into this service are public.

sampleSelection documentation built on Dec. 7, 2017, 5:07 p.m.