HeckmanEM {HeckmanEM} | R Documentation |
Fit the Normal, Student-t or Contaminated normal Heckman Selection model
Description
'HeckmanEM()' fits the Heckman selection model.
Usage
HeckmanEM(
y,
x,
w,
cc,
nu = 4,
family = "T",
error = 1e-05,
iter.max = 500,
im = TRUE,
criteria = TRUE,
verbose = TRUE
)
Arguments
y |
A response vector. |
x |
A covariate matrix for the response y. |
w |
A covariate matrix for the missing indicator cc. |
cc |
A missing indicator vector (1=observed, 0=missing) . |
nu |
When using the t- distribution, the initial value for the degrees of freedom. When using the CN distribution, the initial values for the proportion of bad observations and the degree of contamination. |
family |
The family to be used (Normal, T or CN). |
error |
The absolute convergence error for the EM stopping rule. |
iter.max |
The maximum number of iterations for the EM algorithm. |
im |
TRUE/FALSE, boolean to decide if the standard errors of the parameters should be computed. |
criteria |
TRUE/FALSE, boolean to decide if the model selection criteria should be computed. |
verbose |
TRUE/FALSE, boolean to decide if the progress should be printed in the screen. |
Value
An object of the class HeckmanEM with all the outputs provided from the function.
Examples
n <- 100
nu <- 3
cens <- 0.25
set.seed(13)
w <- cbind(1,runif(n,-1,1),rnorm(n))
x <- cbind(w[,1:2])
c <- qt(cens, df=nu)
sigma2 <- 1
beta <- c(1,0.5)
gamma <- c(1,0.3,-.5)
gamma[1] <- -c*sqrt(sigma2)
set.seed(1)
datas <- rHeckman(x,w,beta,gamma,sigma2,rho = 0.6,nu,family="T")
y <- datas$y
cc <- datas$cc
# Normal EM
res.N <- HeckmanEM(y, x, w, cc, family="Normal",iter.max = 50)
# Student-t EM
res.T <- HeckmanEM(y, x, w, cc, nu = 4, family="T", iter.max = 50)