Learn R Programming

HeckmanEM (version 0.2-2)

Influence: Influence Analysis for the Heckman Selection model

Description

This function conducts influence analysis for a given `HeckmanEM` object. The influence analysis can be conducted using several types of perturbations (not available for the contaminated Normal model).

Usage

Influence(object, type, colx = NULL, k = 3.5)

Value

Returns a list of class HeckmanEM.influence with the following elements:

M0

A vector of length \(n\) with the aggregated contribution of all eigenvectors of the matrix associated with the normal curvature.

benchmark

\(M_0 + k\times \mathrm{sd}(M_0)\)

influent

A vector with the influential observations' positions.

type

The perturbation type.

Arguments

object

A `HeckmanEM` object to perform the analysis on.

type

A character string indicating the type of perturbation to perform. The types can be one of "case-weight","scale","response" and"exploratory".

colx

Optional integer specifying the position of the column in the object's matrix x that will undergo perturbation. Only required when type is "exploratory".

k

A positive real constant to be used in the benchmark calculation: \(M_0 + k\times \mathrm{sd}(M_0)\). Default is 3.5.

Author

Marcos Oliveira

References

Insert any relevant references here.

See Also

HeckmanEM

Examples

Run this code
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)

datas <- rHeckman(x, w, beta, gamma, sigma2, rho = 0.6, nu, family = "T")
y     <- datas$y
cc    <- datas$cc
# \donttest{
heckmodel <- HeckmanEM(y, x, w, cc, family = "Normal", iter.max = 50)

global <- CaseDeletion(heckmodel)
plot(global)

local_case <- Influence(heckmodel, type = "case-weight")
local_case$influent # influential values here!
plot(local_case)

local_scale <- Influence(heckmodel, type = "scale")
local_scale$influent # influential values here!
plot(local_scale)

local_response <- Influence(heckmodel, type = "response")
local_response$influent # influential values here!
plot(local_response)

local_explore <- Influence(heckmodel, type = "exploratory", colx = 2)
local_explore$influent # influential values here!
plot(local_explore)

# }

Run the code above in your browser using DataLab