Running ‘Mroz87SelectionTest.R’ [7s/19s]
  Comparing ‘Mroz87SelectionTest.Rout’ to ‘Mroz87SelectionTest.Rout.save’ ... OK
  Running ‘binarySelectionOutcome.R’ [71s/177s]
  Comparing ‘binarySelectionOutcome.Rout’ to ‘binarySelectionOutcome.Rout.save’ ...2471c2471
< BFGS maximization, 55 iterations
---
> BFGS maximization, 56 iterations
  Running ‘fail.R’
  Comparing ‘fail.Rout’ to ‘fail.Rout.save’ ... OK
  Running ‘heckitIvTest.R’ [4s/10s]
  Comparing ‘heckitIvTest.Rout’ to ‘heckitIvTest.Rout.save’ ... OK
  Running ‘intervalTest.R’ [85s/206s]
  Comparing ‘intervalTest.Rout’ to ‘intervalTest.Rout.save’ ... OK
  Running ‘invMillsRatioTest.R’ [22s/56s]
  Running ‘probit.R’ [6s/16s]
  Comparing ‘probit.Rout’ to ‘probit.Rout.save’ ... OK
  Running ‘selection.R’ [23s/57s]
  Comparing ‘selection.Rout’ to ‘selection.Rout.save’ ... OK
Running the tests in ‘tests/invMillsRatioTest.R’ failed.
Complete output:
  > library( "sampleSelection" )
  Loading required package: maxLik
  Loading required package: miscTools
  
  Please cite the 'maxLik' package as:
  Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.
  
  If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
  https://r-forge.r-project.org/projects/maxlik/
  > options( digits = 3 )
  > 
  > ## Wooldridge( 2003 ): example 17.5, page 590
  > data(Mroz87)
  > myProbit <- glm( lfp ~ nwifeinc + educ + exper + I( exper^2 ) + age +
  +       kids5 + kids618, family = binomial( link = "probit" ), data=Mroz87 )
  > Mroz87$IMR <- invMillsRatio( myProbit )$IMR1
  > myHeckit <- lm( log( wage ) ~ educ + exper + I( exper^2 ) + IMR,
  +    data = Mroz87[ Mroz87$lfp == 1, ] )
  > 
  > # using NO labor force participation as endogenous variable
  > Mroz87$nolfp <- 1 - Mroz87$lfp
  > myProbit2 <- glm( nolfp ~ nwifeinc + educ + exper + I( exper^2 ) + age +
  +       kids5 + kids618, family = binomial( link = "probit" ), data=Mroz87 )
  > all.equal( invMillsRatio( myProbit )$IMR1, invMillsRatio( myProbit2 )$IMR0 )
  [1] TRUE
  > # should be true
  > 
  > # example for bivariate probit
  > library( "mvtnorm" )
  > library( "VGAM" )
  Loading required package: stats4
  Loading required package: splines
  
  Attaching package: 'VGAM'
  
  The following object is masked from 'package:sampleSelection':
  
      probit
  
  > set.seed( 321 )
  > 
  > nObs <- 10000
  > 
  > # error terms (trivariate normal)
  > sigma <- symMatrix( c( 2, 0.7, 1.2, 1, 0.5, 1 ) )
  > myData <- as.data.frame( rmvnorm( nObs, c( 0, 0, 0 ), sigma ) )
  > names( myData ) <- c( "e0", "e1", "e2" )
  > 
  > # exogenous variables (indepently normal)
  > myData$x0 <- rnorm( nObs )
  > myData$x1 <- rnorm( nObs )
  > myData$x2 <- rnorm( nObs )
  > 
  > # endogenous variables
  > myData$y0 <-   -1.5 + 0.8 * myData$x1 + myData$e0
  > myData$y1 <- (  0.3 + 0.4 * myData$x1 + 0.3 * myData$x2 + myData$e1 ) > 0
  > myData$y2 <- ( -0.1 + 0.6 * myData$x1 + 0.7 * myData$x2 + myData$e2 ) > 0
  > 
  > # bivariate probit (using rhobit transformation)
  > bProbit <- vglm( cbind( y1, y2 ) ~ x1 + x2, family = binom2.rho,
  +    data = myData )
  > summary( bProbit )
  
  Call:
  vglm(formula = cbind(y1, y2) ~ x1 + x2, family = binom2.rho, 
      data = myData)
  
  Pearson residuals:
                    Min     1Q Median    3Q  Max
  probitlink(mu1) -6.98 -0.887  0.441 0.747 2.74
  probitlink(mu2) -5.74 -0.671 -0.182 0.676 7.88
  rhobitlink(rho) -8.60 -0.620  0.236 0.517 9.39
  
  Coefficients: 
                Estimate Std. Error z value Pr(>|z|)    
  (Intercept):1   0.3031     0.0134   22.70  < 2e-16 ***
  (Intercept):2  -0.1004     0.0141   -7.14  9.6e-13 ***
  (Intercept):3   1.1049     0.0400   27.65  < 2e-16 ***
  x1:1            0.4050     0.0142   28.57  < 2e-16 ***
  x1:2            0.5743     0.0158   36.31  < 2e-16 ***
  x2:1            0.3108     0.0137   22.70  < 2e-16 ***
  x2:2            0.6796     0.0162   41.87  < 2e-16 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Names of linear predictors: probitlink(mu1), probitlink(mu2), rhobitlink(rho)
  
  Log-likelihood: -10858 on 29993 degrees of freedom
  
  Number of Fisher scoring iterations: 2 
  
  No Hauck-Donner effect found in any of the estimates
  
  > 
  > # bivariate probit (NOT using rhobit transformation)
  > bProbit2 <- vglm( cbind( y1, y2 ) ~ x1 + x2, family = binom2.rho(
  +    lrho = "identitylink" ), data = myData )
  > summary( bProbit2 )
  
  Call:
  vglm(formula = cbind(y1, y2) ~ x1 + x2, family = binom2.rho(lrho = "identitylink"), 
      data = myData)
  
  Pearson residuals:
                    Min     1Q Median    3Q  Max
  probitlink(mu1) -6.97 -0.889  0.438 0.753 2.74
  probitlink(mu2) -5.64 -0.671 -0.180 0.677 7.62
  rho             -8.80 -0.602  0.245 0.519 9.23
  
  Coefficients: 
                Estimate Std. Error z value Pr(>|z|)    
  (Intercept):1   0.3031     0.0134   22.70  < 2e-16 ***
  (Intercept):2  -0.1004     0.0141   -7.14  9.6e-13 ***
  (Intercept):3   0.5023     0.0149   33.62  < 2e-16 ***
  x1:1            0.4050     0.0142   28.57  < 2e-16 ***
  x1:2            0.5743     0.0158   36.31  < 2e-16 ***
  x2:1            0.3108     0.0137   22.70  < 2e-16 ***
  x2:2            0.6796     0.0162   41.87  < 2e-16 ***
  ---
  Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  
  Names of linear predictors: probitlink(mu1), probitlink(mu2), rho
  
  Log-likelihood: -10858 on 29993 degrees of freedom
  
  Number of Fisher scoring iterations: 2 
  
  No Hauck-Donner effect found in any of the estimates
  
  > 
  > # inverse Mills Ratios
  > imr  <- invMillsRatio( bProbit )
  Error in invMillsRatio(bProbit) : 
    the bivariate probit (binom2.rho) must be either estimated with link 'rhobit' or 'identity'/'identitylink'
  Execution halted