iidJack: Jackknife iid Decomposition from Model Object

View source: R/iidJack.R

iidJackR Documentation

Jackknife iid Decomposition from Model Object

Description

Extract iid decomposition (i.e. influence function) from model object.

Usage

iidJack(object, ...)

## Default S3 method:
iidJack(
  object,
  data = NULL,
  grouping = NULL,
  cpus = 1,
  keep.warnings = TRUE,
  keep.error = TRUE,
  cl = NULL,
  trace = TRUE,
  ...
)

Arguments

object

a object containing the model.

...

[internal] only used by the generic method.

data

[data.frame] dataset used to perform the jackknife.

grouping

[vector] variable defining cluster of observations that will be simultaneously removed by the jackknife.

cpus

[integer >0] the number of processors to use. If greater than 1, the fit of the model and the computation of the influence function for each jackknife sample is performed in parallel.

keep.warnings

[logical] keep warning messages obtained when estimating the model with the jackknife samples.

keep.error

[logical]keep error messages obtained when estimating the model with the jackknife samples.

cl

[cluster] a parallel socket cluster generated by parallel::makeCluster that has been registered using registerDoParallel.

trace

[logical] should a progress bar be used to trace the execution of the function

Value

A matrix with in row the samples and in columns the parameters.

Examples

n <- 20
set.seed(10)
mSim <- lvm(c(Y1,Y2,Y3,Y4,Y5) ~ 1*eta)
latent(mSim) <- ~eta
categorical(mSim, K=2) <- ~G
transform(mSim, Id ~ eta) <- function(x){1:NROW(x)}
dW <- lava::sim(mSim, n, latent = FALSE)

#### LVM ####
## Not run: 
m1 <- lvm(c(Y1,Y2,Y3,Y4,Y5) ~ 1*eta)
latent(m1) <- ~eta
regression(m1) <- eta ~ G
e <- estimate(m1, data = dW)

iid1 <- iidJack(e)
iid2 <- iid(e)
attr(iid2, "bread") <- NULL

apply(iid1,2,sd)
apply(iid2,2,sd)
quantile(iid2 - iid1)

## End(Not run)



bozenne/lavaSearch2 documentation built on Feb. 13, 2024, 10:18 p.m.