rHeckman: Generate data from the Heckman Selectio model (Normal or...

Description Usage Arguments Value Examples

View source: R/rHeckman.R

Description

'rHeckman()' generate a ramdom sample from the Heckman selection model (Normal or Student-t).

Usage

1
rHeckman(x, w, beta, gamma, sigma2, rho, nu = 4, family = "T")

Arguments

x

A covariate matrix for the response y.

w

A covariate matrix for the missing indicator cc.

beta

Values for the beta vector.

gamma

Values for the gamma vector.

sigma2

Value for the variance.

rho

Value for the dependence between the reponse and missing value.

nu

Value for the degrees of freedom.

family

The family to be used (Normal or T).

Value

Return an object with the response (y) and missing values (cc).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
cens <- 0.25
nu <- 4
set.seed(20200527)
w <- cbind(1,runif(n,-1,1),rnorm(n))
x <- cbind(w[,1:2]) 

family <- "T"
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(iter)
data <- rHeckman(x,w,beta,gamma,sigma2,rho,nu,family=family)

## End(Not run)

HeckmanEM documentation built on May 19, 2021, 5:07 p.m.