Running examples in ‘sampleSelection-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: invMillsRatio
> ### Title: Inverse Mill's Ratio of probit models
> ### Aliases: invMillsRatio
> ### Keywords: models
> 
> ### ** Examples
> 
> ## 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

> 
> nObs <- 1000
> 
> # 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) -3.453 -0.8976  0.4642 0.7572 2.132
probitlink(mu2) -3.848 -0.7063 -0.2122 0.7033 5.372
rhobitlink(rho) -5.567 -0.7005  0.2781 0.5355 4.546

Coefficients: 
              Estimate Std. Error z value Pr(>|z|)    
(Intercept):1  0.31020    0.04203   7.381 1.57e-13 ***
(Intercept):2 -0.04664    0.04345  -1.074    0.283    
(Intercept):3  1.11165    0.12343   9.006  < 2e-16 ***
x1:1           0.37714    0.04417   8.539  < 2e-16 ***
x1:2           0.43339    0.04661   9.299  < 2e-16 ***
x2:1           0.29819    0.04379   6.810 9.78e-12 ***
x2:2           0.67878    0.05080  13.362  < 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: -1118.951 on 2993 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) -3.429 -0.8999  0.4581 0.7580 2.129
probitlink(mu2) -3.780 -0.7152 -0.2083 0.7024 5.506
rho             -5.694 -0.6807  0.2865 0.5334 4.382

Coefficients: 
              Estimate Std. Error z value Pr(>|z|)    
(Intercept):1  0.31020    0.04203   7.381 1.57e-13 ***
(Intercept):2 -0.04664    0.04345  -1.074    0.283    
(Intercept):3  0.50487    0.04599  10.979  < 2e-16 ***
x1:1           0.37714    0.04417   8.539  < 2e-16 ***
x1:2           0.43339    0.04661   9.299  < 2e-16 ***
x2:1           0.29819    0.04379   6.810 9.78e-12 ***
x2:2           0.67878    0.05080  13.362  < 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: -1118.951 on 2993 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